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


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.


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()?