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 106699 - Please use ngettext for handling plurals in gnome-terminal
Please use ngettext for handling plurals in gnome-terminal
Status: RESOLVED FIXED
Product: gnome-terminal
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: GNOME Terminal Maintainers
GNOME Terminal Maintainers
Depends on:
Blocks: 116236
 
 
Reported: 2003-02-21 10:03 UTC by Christian Rose
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch. Making a distinction between two and two+n profiles is totally crappy. (1.47 KB, patch)
2003-09-21 07:54 UTC, Christian Neumair
none Details | Review
Same thing as before, now using , ngettext both times (1.80 KB, patch)
2003-09-30 22:20 UTC, Mariano Suárez-Alvarez
none Details | Review

Description Christian Rose 2003-02-21 10:03:42 UTC
#: src/terminal-profile.c:3080
#, c-format
msgid "Palette had %d entries instead of %d\n"

#: src/terminal.c:2477
msgid "Delete these two profiles?\n"

#: src/terminal.c:2479
#, c-format
msgid "Delete these %d profiles?\n"


As mentioned in
http://developer.gnome.org/doc/tutorials/gnome-i18n/developer.html#plurals,
this way of handling plurals is broken for many locales. A way to solve
this is by using ngettext instead as mentioned in that document.
A simple code example of code using ngettext:

  g_printf (ngettext ("Found %d file.", "Found %d files.", nbr_of_files),
nbr_of_files);
Comment 1 Christian Neumair 2003-09-21 07:54:47 UTC
Created attachment 20158 [details] [review]
Proposed patch. Making a distinction between two and two+n profiles is totally crappy.
Comment 2 Christian Rose 2003-09-30 08:24:35 UTC
Can we have this issue revisited now?
Comment 3 Mariano Suárez-Alvarez 2003-09-30 22:20:04 UTC
The following path uses ngettext in both instances. Is it any better?
Comment 4 Mariano Suárez-Alvarez 2003-09-30 22:20:56 UTC
Created attachment 20395 [details] [review]
Same thing as before, now using , ngettext both times
Comment 5 Danilo Segan 2003-09-30 23:17:33 UTC
Yes, I think the second patch is better.

Reason is that msgid is extracted from the first parameter to
ngettext, and that was empty string in the first patch, so we could
expect some "undefined behaviour" (or at least a conflict with PO
header which is actually msgid "").
Comment 6 Mariano Suárez-Alvarez 2003-09-30 23:20:54 UTC
Actually, the  `Delete these %s profiles' was not using ngettext in
the original patch...
Comment 7 Danilo Segan 2003-09-30 23:33:11 UTC
Yes, quite correct — I've misread it for something else ;-)

So, definitely, the second patch is what's wanted out of ngettext support.
Comment 8 Mariano Suárez-Alvarez 2003-10-01 00:32:53 UTC
Applied the 2nd patch to HEAD.
Comment 9 Christian Neumair 2003-10-01 06:09:26 UTC
I think the 2nd patch just adds overhead:
I didn't ngettextize the 2nd string since it's inside an
   if (count > 1)
condition. Adding ngettext ("sth", "sth else", count) in there is no
good, is it?

regs,
 Chris
Comment 10 Danilo Segan 2003-10-01 11:07:14 UTC
Manny, please see what I've said in bug 106700 -- this is required,
it's not overhead.

The singular form is really not required for english, but since it's
used as msgid "" for that entry by gettext, it must be there; then,
it's better that it sounds sane to translatora.

Please mark this as FIXED, because it is fixed.
Comment 11 Mariano Suárez-Alvarez 2003-10-01 11:32:37 UTC
Well, it appears that pluralization in Slovenian has four special
cases, not two: one for 1, and one for each set of numbers ending in
2, 3 and 4, respectively. So if the Slovenian translators are to be
able to translate the sentence `Delete these %d profiles' correctly
for all values of %d, we do need to use ngettext here, don't we?

Note I do not speak/know anything about Slovenian: I have simply read
the (GNOME?) Localization Guidelines for Developers
(http://developer.gnome.org/doc/tutorials/gnome-i18n/developer.html#plurals).

Marking as FIXED...
Comment 12 Christian Rose 2003-10-02 02:00:26 UTC
Mariano: You're right, the second ngettext is needed. I think Chris is
thinking too much in the western "1 singular form and only 1 plural
for anything > 1" way of handling plurals.