3 ms·
Gettext [1] does actually offer a way around this problem, which works fairly well in practice. You can define the number of plurals and rules to select a plur
by johkra 16y ago
Gettext [1] does actually offer a way around this problem, which works fairly well in practice.
You can define the number of plurals and rules to select a plural case. Then you have as many translations as plural forms in your translation (po) file.
Arabic for instance has 6 plural cases with the following rules [2]:
nplurals=6; plural= n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5;
See also http://wiki.amule.org/index.php/Translations#Plural_forms http://wiki.amule.org/index.php/Translations#Plural_forms for an example of both a rule and the resulting code in the po file.
[1] http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms http://www.gnu.org/software/gettext/manual/gettext.html#Plur...
[2] http://translate.sourceforge.net/wiki/l10n/pluralforms http://translate.sourceforge.net/wiki/l10n/pluralforms