python-babel / babel

The official repository for Babel, the Python Internationalization Library
http://babel.pocoo.org/
BSD 3-Clause "New" or "Revised" License
1.31k stars 438 forks source link

Invalid Hungarian plural form #817

Open felipeochoa opened 2 years ago

felipeochoa commented 2 years ago

Overview Description

Similar to #816, the plural form for Hungarian that is manually maintained does not match the CLDR definition.

PR #431 explicitly ignored the Hungarian rule because for some sentence constructions a separate plural form is not necessary. However, I believe that Babel should follow the CLDR form and allow translators to customize or leave messages unchanged on a case by case basis.

Steps to Reproduce

>>> import babel, babel.messages.plurals, babel.plural
>>> print(babel.messages.plurals.get_plural('hu'))
nplurals=1; plural=0;
>>> print(babel.plural.to_gettext(babel.Locale('hu').plural_form))
nplurals=2; plural=(((n == 1)) ? 0 : 1)

Additional Information

The PR referenced this site, which explains that sometimes plurals are not needed. However, sometimes they are (I think in something "I have %d dog, and my dog is pretty", the latter requires different forms for 1 vs. others).

In any case, if the phrase does not change between singular and plural, it's easy enough for translators to copy-paste the same phrasing into two msgstr inputs.

felipeochoa commented 2 years ago

I've found some other languages where the manual list does not match the CLDR. Would you be open to a PR removing that manual list and using the CLDR data for plurals instead? It would be a breaking change for those who had been using the wrong plural forms I think

akx commented 2 years ago

A PR to get the plural forms from the CLDR would be welcome!

It would be grand to see a diff between the old and new entries, too.