GNOME Bugzilla – Bug 694032
Incorrect plural strings
Last modified: 2013-02-20 19:17:06 UTC
Commit http://git.gnome.org/browse/gnome-contacts/commit/?id=325fd8feb1e6b78f189483feeb4fc937a5758479 added new code which uses incorrect plural handling in strings. Here are lines that need to be corrected: string msg = _("%d contact%s deleted").printf (contact_list.size, contact_list.size > 1 ? "s" : ""); string msg = _("%d contact%s linked").printf (contact_list.size, contact_list.size > 1 ? "s" : ""); Instructions on how to use plurals correctly can be found here: https://live.gnome.org/TranslationProject/DevGuidelines/Plurals
Fixed: http://git.gnome.org/browse/gnome-contacts/commit/?id=33f403186b12daf82a805668d42bc94ed6c327c2
I'm sorry, but this is not the right fix. Please use ngettext as shown in this example: g_printf (ngettext ("Found %d file.", "Found %d files.", nbr_of_files), nbr_of_files);
(In reply to comment #2) > I'm sorry, but this is not the right fix. Please use ngettext as shown in this > example: > > g_printf (ngettext ("Found %d file.", "Found %d files.", nbr_of_files), > nbr_of_files); The thing is the translation is splitted into two different strings, one for singular and other for plural.
Well, it shouldn't be two separate strings. Maybe you could use something like this? string msg = ngettext ("%d contact linked", "%d contacts linked", contact_list.size).printf (contact_list.size);
(In reply to comment #4) > Well, it shouldn't be two separate strings. Maybe you could use something like > this? > > string msg = ngettext ("%d contact linked", "%d contacts linked", > contact_list.size).printf (contact_list.size); I could, I found ngettext wrapping in vala already, bt as you see, I changed the messages. For singular is "Contacts Linked" | "Contacts deleted" For plural is "%d contacts linked" | "%d contacts deleted" So I only need to include the number in of them. Do you still want me to use ngettext ??
Yes, because as explained on the wiki page linked above, some languages have complex systems for plural number.
Fixed: http://git.gnome.org/browse/gnome-contacts/commit/?id=da878cd7f0f55d326b3160173696bf4dd9b5c3e8 (In reply to comment #6) > Yes, because as explained on the wiki page linked above, some languages have > complex systems for plural number. Could you check and close the bug if it works for you ?
You need to use ngettext for EVERY plural string, as many languages have different cases for various numbers - so translation of "2 contacts linked" and "5 contacts linked" will be different.
(In reply to comment #8) > You need to use ngettext for EVERY plural string, as many languages have > different cases for various numbers - so translation of "2 contacts linked" and > "5 contacts linked" will be different. Yeah, sorry, I should have read the wiki page till the end the first time. Fixed: http://git.gnome.org/browse/gnome-contacts/commit/?id=ffc049a96f4713550eefdfee3dcb22d97f9a0d97
Now it's perfect, thank you!