середа, 22 грудня 2021 р. 19:26:03 EET Bruno Haible написано:
Hi, dear Ukrainian translators,
I am the GNU gettext maintainer, and I would like to support correct plural
forms also for Ukrainian in the GNU gettext tools, out of the box, and improve
the GNU gettext documentation.
You certainly know about the "plural forms", as documented here:
https://www.gnu.org/software/gettext/manual/html_node/Plural-forms.html
I have gotten different data about Ukrainian, thus my question.
* The page
https://l10n.gnome.org/teams/uk/ suggests the formula
nplurals=4; plural=(n==1 ? 0 : n%10==1 && n%100!=11 ? 1 : n%10>=2 &&
n%10<=4 && (n%100<10 || n%100>=20) ? 2 : 3);
* But the GNU gettext documentation and CLDR suggest the formula
nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4
&& (n%100<10 || n%100>=20) ? 1 : 2);
Which one is correct? That is, in sentences with plurals,
does a sentence with the number 21, 31, 41 always look like the sentence
with the number 1 ?
If you are not sure: There are certainly books about the grammar of
your language, that describe this detail.
Best regards,
Bruno
Hi,
Let's see. The whole header says:
"Plural-Forms: nplurals=4; plural=n==1 ? 3 : n%10==1 && n%100!=11 ? 0 :
n"
"%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 :
2;\n"
which means
Plural-Forms: nplurals=4; plural=n==1 ? 3 : n%10==1 && n%100!=11 ? 0 : n%10>=2
&& n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;
or in human readable form:
3rd form for n=1
0th form for (n div 10=1) and (n div 100 not equal 11) or simpler "21, 31..."
1st form for 2, 3, 4, 22, 23 , 24...
2nd form for 5, 6, 7, 8...
As you can see, it is the same as CLDR form for all cases, but the case n=1.
You might be asking _why on Earth!!!?_ Can it be simpler?
Heh... The standard form works only for the messages with a replacer.
Consider the examples from gettext man:
https://www.gnu.org/savannah-checkouts/gnu/gettext/manual/html_node/Plura...
1.
ngettext ("%d file removed", "%d files removed", n)
Perfect. The standard form works just fine. %d is replaced by the number and
all 3 standard forms fit.
2.
ngettext ("One file removed", "%d files removed", n)
Trouble. The form 0 for Slavic languages is for 1, 21, 31... But in words they
are not "One", they are "One, Twenty-one..." Such plurals cannot be
translated
with three forms at all. The validity check of tools like Transifex refuses any Slavic
langauge
translation.
If you translate
"One file removed"
"%d files removed"
"%d files removed"
the validation will be failed because the first form (0th case) does not
contain enough cases to be split into "1, 21, 31..."
If you translate
"%d file removed"
"%d files removed"
"%d files removed"
the validation will be failed because there is "%d" in the first case, but the
checker thinks there should not be any replacer...
3.
ngettext ("Delete the selected file?",
"Delete the selected files?", n)
Fail. Without number (replacer), there are only two plural forms in the Slavic
languages: "one" and "many". But the 0th rule in the standard (CLDR)
combines
"one" and "many". They should be split to give the correct
translation.
That's why Russian, Serbian and Ukrainian KDE and GNOME teams use the plural
rules with 4 forms (n=1 is separated in its own case).
Hope this helps to understand the current GNOME, KDE, and Transifex plural forms.
Thanks for your work.
Best regards,
Yuri