GNOME Bugzilla – Bug 552053
Using two types of plural form
Last modified: 2012-08-21 01:57:16 UTC
Please describe the problem: When I translate nautilus I found two types of plural form: 1. the plural form with explicit number in a message 2. the plural form without one. for English 1) and 2) the same, but for some other languages it's not the same. for example, the translation of message "Copying %'d file (in \"%B\") to \"%B\"" (case 1) to Russian is - Копируется 20 файлов (из \"%B\") в \"%B\" (for n=20) - Копируется 21 файл (из \"%B\") в \"%B\" (for n=21) - Копируется 22 файла (из \"%B\") в \"%B\" (for n=22) but the plural form of message "Copying file (in \"%B\") to \"%B\" (case 2) should be translated as - Копируется файл (из \"%B\") в \"%B\" (for n=1) - Копируются файлы (из \"%B\") в \"%B\" (for n>1) As you see two types of plural form are not incompatibled for Russian and I think for some other languages. I found 4 message of plural form 2): #: ../src/file-manager/fm-directory-view.c:7309 #, fuzzy, c-format msgid "Move the selected folder out of the trash to \"%s\"" msgid_plural "Move the selected folders out of the trash to \"%s\"" #: ../src/file-manager/fm-directory-view.c:7313 #, fuzzy, c-format msgid "Move the selected folder out of the trash" msgid_plural "Move the selected folders out of the trash" #: ../src/file-manager/fm-directory-view.c:7319 #, fuzzy, c-format msgid "Move the selected file out of the trash to \"%s\"" msgid_plural "Move the selected files out of the trash to \"%s\"" #: ../src/file-manager/fm-directory-view.c:7323 #, fuzzy, c-format msgid "Move the selected file out of the trash" msgid_plural "Move the selected files out of the trash" Steps to reproduce: 1. 2. 3. Actual results: Expected results: Does this happen every time? Other information:
Thanks for your bug report. I do understand that plural formats may change if the number is not included in the message string (i.e. form 2) - but what is the actual issue? Isn't it possible to specify which form to use in the .po file for a given string?
(In reply to comment #1) > > Isn't it possible to specify which form to use in the .po file for a given > string? > Wnen we use only one type of plural form it's ok, but when we use both we have a problem. In Russian the plural form with explicit number we can describe like this: Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2); when n=1,21,31,41, ..., 91 we have the one form but when we use type plural form type 2 we need one form for n=1 and one form for n>1. thus for n=21,31, ..., 91 there is no way to determine which form we should use. e.g. translation of "Copying %'d file (in \"%B\") n=1 Копируется 1 файл (из \"%B\") в \"%B\" n=21 Копируется 21 *файл* (из \"%B\") в \"%B\" but translation of "Copying file (in \"%B\") n=1 Копируется файл (из \"%B\") в \"%B\" n=21 Копируются *файлы* (из \"%B\") в \"%B\"
I think I understand the issue. But I do not see any problem or "bug" here, because you could redefine the plural form to achieve both forms, for instance using: "Plural-Forms: 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);\n" That way, you could use msgid "Copying %'d file (in \"%B\") to \"%B\"" msgid_plural "Copying %'d files (in \"%B\") to \"%B\"" msgstr[0] "Копируется %'d файл (из «%B») в «%B»" msgstr[1] "Копируется %'d файл (из «%B») в «%B»" msgstr[2] "Копируются %'d файла (из «%B») в «%B»" msgstr[3] "Копируется %'d файлов (из «%B») в «%B»" Note that [0] would be used for 1 only, so you have to duplicate [0] and [1] each time a number is specified. In contrast, the following is an example how you achieve n=1 vs. n!=1, i.e. when no explicit numbers are specified: msgid "Copying file (in \"%B\") to \"%B\"" msgid_plural "Copying files (in \"%B\") to \"%B\"" msgstr[0]="Копируется файл (из \"%B\") в \"%B\"" msgstr[1]="Копируются файлы (из \"%B\") в \"%B\"" msgstr[2]="Копируются файлы (из \"%B\") в \"%B\"" msgstr[3]="Копируются файлы (из \"%B\") в \"%B\"" If you decide to use the above scheme, don't forget to convert the old translations. Does that sounds reasonable?
No, it's not reasonable. Forms are fixed for a language, modification will confuse translators.
So the solution is not to use ngettext for n=1 vs. n>1 decisions if the number does not occur explicitly in the string?
I think this is the solution. We had this in some package, I don't remember which exactly.
Created attachment 122264 [details] [review] use plural form only for messages with explicit number
Changing component as a part of ongoing bug reorganisation work.
Patch available, setting TM.
Created attachment 221936 [details] [review] use plural form only for messages with explicit number
Review of attachment 221936 [details] [review]: Looks good to me.
Attachment 221936 [details] pushed as c59ee71 - use plural form only for messages with explicit number