After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 694032 - Incorrect plural strings
Incorrect plural strings
Status: RESOLVED FIXED
Product: gnome-contacts
Classification: Core
Component: general
3.7.x
Other Linux
: High major
: ---
Assigned To: GNOME Contacts maintainer(s)
GNOME Contacts maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2013-02-17 16:26 UTC by Piotr Drąg
Modified: 2013-02-20 19:17 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Piotr Drąg 2013-02-17 16:26:32 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
Comment 2 Piotr Drąg 2013-02-17 22:12:58 UTC
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);
Comment 3 Erick Perez Castellanos 2013-02-18 14:32:17 UTC
(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.
Comment 4 Piotr Drąg 2013-02-18 15:00:36 UTC
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);
Comment 5 Erick Perez Castellanos 2013-02-18 15:22:18 UTC
(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 ??
Comment 6 Piotr Drąg 2013-02-18 15:27:32 UTC
Yes, because as explained on the wiki page linked above, some languages have complex systems for plural number.
Comment 7 Erick Perez Castellanos 2013-02-18 19:00:56 UTC
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 ?
Comment 8 Piotr Drąg 2013-02-18 23:04:50 UTC
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.
Comment 9 Erick Perez Castellanos 2013-02-20 18:42:21 UTC
(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
Comment 10 Piotr Drąg 2013-02-20 19:17:06 UTC
Now it's perfect, thank you!