php-gettext / Gettext

PHP library to collect and manipulate gettext (.po, .mo, .php, .json, etc)
MIT License
688 stars 134 forks source link

Plural parsing for MO files appears to ignore Plural-Forms #273

Closed asmecher closed 3 years ago

asmecher commented 3 years ago

In php-gettext 4.x, PO loading used to parse the Plural-Forms header in order to determine which plural form to apply for a number:

https://github.com/php-gettext/Gettext/blob/4.x/src/Translator.php#L213

See the examples described at https://www.gnu.org/software/gettext/manual/html_node/Translating-plural-forms.html.

However, the gettext-php 5.x rewrite appears to discard the list of conditions mapping to each plural translation, i.e. getPluralForm is never used to fetch the stored set of rules in forming a translation.

oscarotero commented 3 years ago

The Translator in version 5 is a different package: https://github.com/php-gettext/Translator It uses the same code as in 4.x as you can see here: https://github.com/php-gettext/Translator/blob/master/src/Translator.php#L186

asmecher commented 3 years ago

Ah! That explains why I couldn't find it :) Thanks, @oscarotero!