[strings] Plural forms invalid in all translations
Submitted by an unknown user
Link to original bug (#717677)
Description
---- Reported by shotwell-maint@gnome.bugs 2011-03-28 23:19:00 -0700 ----
Original Redmine bug id: 3433
Original URL: http://redmine.yorba.org/issues/3433
Searchable id: yorba-bug-3433
Original author: Коренберг Марк
Original description:
For example:
#: src/CollectionPage.vala:440
msgid "Export Photo/Video"
msgid_plural "Export Photos/Videos"
msgstr0 "??????? ??????/?????"
msgstr1 "??????? ??????/?????"
msgstr2 "??????? ??????/?????"
As the number is not included in the text (difinitely the bug), I can not translate correctly to non-english languages.
For this example, 1 photo and 21 photo will be translated to the same string (for Russian language – see plurals-forms formula). and in case when exporting 21 photots, user might think that he exporting 1 photo.
So, do not expect, that single (not plural) form is only for one item.
There are many places in code (see .po file) where that bug occur.
If code will fixed, .po file should look like this:
#: src/CollectionPage.vala:440
msgid “Export %d Photo/Videoâ€
msgid_plural “Export %d Photos/Videosâ€
msgstr^(=footnote)"0":#fn0^ “??????? %d ??????????/?????â€
msgstr^(=footnote)"1":#fn1^ “??????? %d ??????????/?????â€
msgstr^(=footnote)"2":#fn2^ “??????? %d ??????????/?????â€
---- Additional Comments From shotwell-maint@gnome.bugs 2013-05-01 11:39:00 -0700 ----
History
Comment 1
Updated by Коренберг Марк over 2 years ago
Other example:
#: src/Dialogs.vala:472
#, c-format
msgid "1 duplicate photo/video was not imported:n"
msgid_plural "%d duplicate photos/videos were not imported:n"
msgstr0 "%d ???? ??/??? ?? ?? ???????????:n"
msgstr1 "%d ????? ??/??? ?? ?? ???????????:n"
msgstr2 "%d ?????? ??/??? ?? ?? ???????????:n"
so, if one video was not imported, construction like this:
printf("1 duplicate photo/video was not imported:n", 1)
will be executed, and it's error for printf-like functions. Never replcae %d with constant!
Comment 2
Updated by Adam Dingle over 2 years ago
mmarkk is right that there's some danger in using ngettext() with strings that don't contain a number. In Russian, plural forms vary depending on the preceding number, and after “21†are the same as the singular. So if you're exporting 21 photos/videos, we display a message like “Export Photo/Videoâ€, which looks odd.
mmarkk's proposed solution is to include the number in the string. The problem is that in languages like English, the number seems redundant (in the singular case) or unnecessary (in the plural case) in these strings. For example, if I select a single photo to export, it seems nicer in English if the export dialog has a title “Export Photo†rather than “Export 1 Photoâ€.
I think the best solution is to include the number in the string in languages like Russian where the singular and plural sometimes have the same form, but to exclude it in languages like English. So then the .po file could look like this:
#: src/CollectionPage.vala:440
msgid "Export Photo/Video"
msgid_plural "Export Photos/Videos"
msgstr0 "??????? %d ??????/?????"
msgstr1 "??????? %d ??????/?????"
msgstr2 "??????? %d ??????/?????"
We could include a translation note for such strings saying that we've omitted the number in English, but that translators should add it for their language if needed for clarity.
Comment 3
Updated by Adam Dingle over 2 years ago
- Priority set to High
Comment 4
Updated by Коренберг Марк over 2 years ago
I think that in cases where the number of elements does not matter, constructions like this:
puts(ngettext(“Export Photo/Videoâ€,“Export Photos/Videosâ€,n))
should be replaced with:
puts(n==1?gettext("Export Photo/Video"):gettext("Export Photos/Videos"))
In Russian, it will be translated as:
msgid "Export Photo/Video"
msgstr "??????? ??????????/?????"
msgid "Export Photos/Videos"
msgstr "??????? ??????????/?????"
Comment 5
Updated by Adam Dingle over 2 years ago
@mmarkk,
I thought about the possibility you suggested in comment 5. I agree that would work great for English and Russian. My one concern is that some languages have a dual case in which there different plural forms for 1, 2 or many:
http://en.wikipedia.org/wiki/Dual_(grammatical_number)
http://ru.wikipedia.org/wiki/????????????_?????
I think that in some of these languages it might be necessary to use the dual form even when there is no preceding number. For example, according to the English Wikipedia page on the dual, here are plural forms for “wolf†in Slovene without numerals:
- nominative singular: volk
- nominative dual: volkova
- nominative plural: volkovi
So for a Slovene speaker, maybe it would be strange if they selected two photos, and then we displayed a message using the non-dual plural form.
But on the other hand, perhaps this would be only a minor annoyance or they wouldn't even notice. If so, your suggestion would make sense.
Comment 6
Updated by Adam Dingle over 2 years ago
- Target version set to 0.10
Comment 7
Updated by claudep - over 2 years ago
IMHO, either you are using a proper plural string with a %d variable, either you are using an undefined plural. I'm not sure there is any other intermediary way to do it in a clean way. Moreover if this is for a dialog title, it does not matter so much after all.
Comment 8
Updated by Marcel Stimberg over 2 years ago
I think a solution close to the one proposed in [comment:5 comment 5] but without the problems mentioned in [comment:6 comment 6] would be to special case n == 1 and still use ngettext for the rest, i.e. replace
puts(ngettext("Export Photo/Video","Export Photos/Videos",n))
with
puts(n == 1? gettext(“Export Photo/Videoâ€) : ngettext("", “Export Photos/Videosâ€, n))
This would definitely need comments to not confuse translators but would allow coping with all the cases mentioned so far.
Comment 9
Updated by Adam Dingle over 2 years ago
- Subject changed from Plural forms invalid in all translations to [strings] Plural forms invalid in all translations
Comment 10
Updated by Adam Dingle over 2 years ago
Lucas and I just discussed this. We're going to go with the solution in comment 5 above.
Comment 11
Updated by Lucas Beeler over 2 years ago
- Status changed from Open to 5
- Resolution set to fixed
- % Done changed from 0 to 100
Fixed in 17cc6173.
Comment 12
Updated by Charles Lindsay 7 months ago
- Status changed from 5 to Fixed
--- Bug imported by chaz@yorba.org 2013-11-25 21:53 UTC ---
This bug was previously known as bug 3433 at http://redmine.yorba.org/show_bug.cgi?id=3433
Unknown Component Using default product and component set in Parameters Unknown milestone "unknown in product shotwell. Setting to default milestone for this product, "---". Setting qa contact to the default for this product. This bug either had no qa contact or an invalid one.
Version: 0.10
Resolution: RESOLVED FIXED