0
votes

With ZF1, if you have plural forms, do you have to pass an array to $this->translate(), even if you just want the first plural form (i.e. singular)?

When I do this: $this->translate('Tournament'), it returns an array instead of a string.

If so, then I have to do something like: $this->translate(array('Tournament', 'Tournaments', 1)), which is quite silly, as the 2nd form will never be used.

1

1 Answers

0
votes

As far as I can tell, it does work like that. :-(

I'm going to update Zend_Translate_Adapter as follows:

From:

        // return original translation
        if ($plural === null) {
            $this->_routed = array();
            return $this->_translate[$locale][$messageId];
        }

To:

        // return original translation
        if ($plural === null) {
            $this->_routed = array();

            $translation = $this->_translate[$locale][$messageId];

            if (is_array($translation)) {
                return $translation[0];
            }

            return $translation;
        }