Question

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.

Était-ce utile?

La solution

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;
        }
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top