translate / l10n-guide

Localisation guide
https://docs.translatehouse.org/projects/localization-guide/
56 stars 69 forks source link

Is Slovenian gettext plural form wrong? #22

Open mlocati opened 9 years ago

mlocati commented 9 years ago

I think that in https://github.com/translate/l10n-guide/blob/master/docs/l10n/pluralforms.rst the plural form for Slovenian is wrong: nplurals=4; plural=(n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 || n%100==4 ? 3 : 0);

I don't know Slovenian, but it seems to me that it should be like the one described in gettext source code: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);

Please note that the values are shifted by one...

beernarrd commented 6 years ago

https://github.com/translate/translate/pull/3273 explains why it was not wrong

mlocati commented 6 years ago

Well, both in https://github.com/translate/translate/blob/master/translate/lang/data.py and in http://docs.translatehouse.org/projects/localization-guide/en/latest/l10n/pluralforms.html I see that for Slovenian we have n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3

Furthermore, using the gettext cldr-plurals tool (with the plurals.xml definition of CLDR 32.0.1:

cldr-plurals sl path/to/cldr/32.0.1/common/supplemental/plurals.xml

we have

nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100>=3 && n%100<=4 ? 2 : 3);
beernarrd commented 6 years ago

I don't know when it was reverted, but in 2015 it was allready fixed: https://github.com/translate/translate/blob/93dda8f3ab5e1a9e3e08466490e5037b793e34b4/translate/lang/data.py Gnutext has also opened a bug on this topic since 2015 to change the documentation. https://savannah.gnu.org/bugs/?45591 If cldr-plurals tool need a bugreport to change the plural string to the good one, i will open it based on what will have been changed by #45591.

beernarrd commented 6 years ago

Found the reverting commit: https://github.com/translate/translate/pull/3593. Must be undone. As said there, we want to have this: msgid[0] = CLRD other {0, 5..100, 105..200, ...} msgid[1] = CLRD one {1, 101, 201, ...} msgid[2] = CLRD two {2, 102, 202, ...} msgid[3] = CLRD few {3,4; 103,104...}

nijel commented 6 years ago

The plurals for Slovenian are currently identical in Gettext, translate-toolkit and l10n guide and they also match CLDR. The ordering of plurals matches what is used in other languages - the first plural (having index 0) usually accounts for CLDR one (if language has it). On the other side I can see that quite some projects do use the alternative ordering which @beernarrd is pushing, so it certainly has some use. Anyway has somebody tried to push the change to Gettext? I think it really should start there so that new translations will get this automatically....

BTW: I'm currently looking into plurals anyway for Weblate (for https://github.com/WeblateOrg/weblate/issues/1550), if you want to look deeper into differences between different source it's available here: https://github.com/WeblateOrg/language-data/blob/master/PLURALS_DIFF.md

beernarrd commented 6 years ago

I tried to push in gettext https://savannah.gnu.org/bugs/?45591