How language definition of singular and plural is defined/changed in subversion scripts

Yuri Chornoivan yurchor at ukr.net
Thu Mar 18 22:00:16 GMT 2021


четвер, 18 березня 2021 р. 23:40:05 EET Matjaž Jeran написано:
> Hi,
> 
> I have maintained the trunk collection of Slovenian translations for KF5.
> Slovenian does have some peculiar characteristics not found in the majority
> of other languages such as not only singular and plural but also dual and
> two forms of plural.
> 
> Because of the the initial string in the .po file is different then most of
> other.  The poEdit suggests the following string
> 
> "Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100>=3 &&
> n" "%100<=4 ? 2 : 3);\n"
> "X-Generator: Poedit 2.4.2\n"
> 
> I notice that if some error or change is detected in some .po file
> than this string is sometimes changed to
> 
> "Plural-Forms: nplurals=4; plural=(n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 ||
> n" "%100==4 ? 3 : 0);\n"
> 
> I can not explain in which cases this happens and when not.
> 
> Should I report that as bug somewhere?
> 
> Cheers
> Matjaž

Hi,

That's not actually a bug. poEdit hardcodes the plural forms from CLDR [1], 
but they not work for software translations for some Slavic languages.

The following is an explanation for Ukrainian (the same thing holds true for 
Belarusian, Russian, Serbian).

Consider the examples from gettext man (the same thing holds true for 
KDE too, just replace "%d" with "%1"):

https://www.gnu.org/savannah-checkouts/gnu/gettext/manual/html_node/Plural-forms.html

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 
"right" at all. The validity check refuses any Slavic language 
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 headers of some files.

Thanks for your work.

Best regards,
Yuri

[1] http://cldr.unicode.org/index/cldr-spec/plural-rules





More information about the kde-i18n-doc mailing list