ZF-10288: Zend_Form and Zend_Navigation seem to have problems with plural translations

Issue Type: Bug Created: 2010-08-10T04:12:00.000+0000 Last Updated: 2011-04-06T17:56:24.000+0000 Status: Open Fix version(s): Reporter: Stefan Bradl (madrenegade) Assignee: Christian Albrecht (alab) Tags: - Zend_Form

  • Zend_Navigation

Related issues: Attachments:


I have noticed that Zend_Navigation does not handle plural forms correctly. If you use a plural message id for the label element inside a xml navigation config file the label will not get translated and an empty label is shown.

Zend_Form also seems to have problems with this. When using a plural form for labels the following warning occurs: PHP Warning: trim() expects parameter 1 to be string, array given in /usr/share/php/Zend/Form/Decorator/Label.php on line 254

I recently noticed what the real problem could be:

I have a gettext translation with this entry: msgid "CATEGORY" msgid_plural "CATEGORIES" msgstr[0] "Category" msgstr[1] "Categories"

Now when you use "CATEGORIES" as a label for a form element or a navigation element the translation adapter is called with this string as messageId This messageId cannot be found because for plural translations an array is expected by the translate function but a string is given.


Posted by Kai Uwe (kaiuwe) on 2011-04-06T12:06:24.000+0000

You can use not only the messageId for plural, because Zend_Translate and Gettext from PHP doesn't support it.

Think out loud: The both methods Zend_Navigation_Page::setLabel() and Zend_Form_Element::setLabel() accept an array like Zend_Translate_Adapter::translate()?

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.