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 106700 - Please use ngettext for handling plurals in gnome-utils
Please use ngettext for handling plurals in gnome-utils
Status: RESOLVED FIXED
Product: gnome-utils
Classification: Deprecated
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-utils Maintainers
gnome-utils 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. (2.80 KB, patch)
2003-09-21 06:42 UTC, Christian Neumair
none Details | Review
Proposed patch #2 (4.71 KB, patch)
2003-10-01 14:51 UTC, Christian Neumair
none Details | Review
New patch against HEAD. (5.71 KB, patch)
2003-12-12 13:37 UTC, Christian Neumair
none Details | Review

Description Christian Rose 2003-02-21 10:03:44 UTC
#: logview/info.c:186
#, c-format
msgid "%ld bytes"

#: gfloppy/src/progress.c:123
#, c-format
msgid ""
"The floppy has been formatted, but <b>%d bad blocks</b> (out of %d) have "
"been found and marked."

#: gsearchtool/gsearchtool.c:831
#, c-format
msgid "%d files found"

#: gsearchtool/gsearchtool-callbacks.c:299
#, c-format
msgid "This will open %d separate files. Are you sure you want to do this?"

#: gsearchtool/gsearchtool-callbacks.c:302
#, c-format
msgid "Open %d Files?"

#: gsearchtool/gsearchtool-callbacks.c:404
#, c-format
msgid "This will open %d separate folders. Are you sure you want to do this?"

#: gsearchtool/gsearchtool-callbacks.c:407
#, c-format
msgid "Open %d Folders?"


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 Glynn Foster 2003-05-19 10:14:55 UTC
was this decided that this should be standard?
Comment 2 Christian Neumair 2003-09-21 06:42:48 UTC
Created attachment 20150 [details] [review]
Proposed patch.
Comment 3 Christian Neumair 2003-09-21 06:46:12 UTC
Gman: It makes translators' lifes easier since it bundles strings that
belong to each other at one location inside the po files:

#: gsearchtool/gsearchtool.c:1237
#, c-format
msgid "%d file found"
msgid_plural "%d files found"
msgstr[0] "%d Dateien gefunden"
msgstr[1] "%d Dateien gefunden"

menthos: You can safely ignore the last 4 strings since these messages
only show up if a file limit (5) is exceeded.

regs,
 Chris
Comment 4 Christian Rose 2003-09-30 08:24:01 UTC
Can we have this issue revisited now?
Comment 5 Danilo Segan 2003-09-30 15:57:45 UTC
None of these can be ignored for correct plural forms support.

For instance, in Serbian language, plural is not used if the number
ends in 1 (eg. 21, 31, 7271 are all written with *singular*).

Also, in Serbian and some other languages (see the GNU gettext.info
manual for more examples), the word used depends in more subtle ways
than just plural and not-plural (for instance, numbers ending in 2, 3
or 4 use another form for nouns and adjectives that follow them, so
we've got "Otvori 24 knjige" and "Otvori 27 knjiga" for "Open %d books").
Comment 6 Christian Neumair 2003-09-30 21:16:48 UTC
Danilo: Your problem seems to be very weird and very fundamental - and
doesn't have anything to do with this bug report.
Are there any other approaches? Have there been any efforts for
resolving this?
Any concrete proposal?

regs,
 Chris
Comment 7 Danilo Segan 2003-09-30 21:57:25 UTC
Manny, "my problem" is exactly what plural forms and ngettext solve.
Please see the plural forms section in gettext.info manual (eg. "info
gettext" and then "m plural<RET>" if you're using standalone info
viewer; yelp can view info files too).

As a matter of fact, similar example (for Polish) is given on that page:
     In Polish we use e.g. plik (file) this way:
          1 plik
          2,3,4 pliki
          5-21 pliko'w
          22-24 pliki
          25-31 pliko'w

What probably bothers you is how is it defined that there are more
than two plural forms. That is defined in PO file header (translation
of msgid "") in field Plural-Forms. For a concrete, working example,
see gnome-games/po/sr.po.


So, the idea behind ngettext was not to make "translators' job easier
by bundling strings together", but rather, to make it possible for
Russian, Polish, Serbian, Croatian, Slovenian, and *many* other
languages have it translated *correctly*.
Comment 8 Christian Neumair 2003-10-01 14:51:11 UTC
Created attachment 20409 [details] [review]
Proposed patch #2
Comment 9 Glynn Foster 2003-11-10 02:41:31 UTC
any traction here? seems like this should be a gnome wide decision.
Comment 10 Christian Rose 2003-11-10 11:42:45 UTC
It is a gnome wide decision (see bug 116236 which is linked to this
one), and AFAIK the decision has already been made (see the last
comment in that report).

gnome-games (bug 106697), gnopernicus (bug 116235), gnome-applets (bug
116986), gnome-terminal (bug 106699), and nautilus-cd-burner (bug
123857) all use ngettext already, so prolly gnome-utils could and
should too.
Comment 11 Danilo Segan 2003-12-11 17:47:47 UTC
The following all seem very related, and should probably belong into
one ngettext call (except maybe the zero-case):
#: gsearchtool/gsearchtool.c:565
msgid "No Files Found"

#: gsearchtool/gsearchtool.c:570
msgid "One File Found"

#: gsearchtool/gsearchtool.c:571
msgid "One file found"

#: gsearchtool/gsearchtool.c:574
#, c-format
msgid "%d Files Found"
Comment 12 Christian Neumair 2003-12-12 13:37:23 UTC
Created attachment 22366 [details] [review]
New patch against HEAD.
Comment 13 Glynn Foster 2003-12-12 22:48:46 UTC
Looks good to me. You can commit when Dennis gives you permission on
the gsearchtool parts of the patch.
Comment 14 Dennis Cranston 2003-12-30 17:41:24 UTC
In gsearchtool.c,

+	message_string = ngettext ("%d file Found",
+				   "%d files Found",
+				   total_files);

This string should read "found" not "Found".

Assuming the patch has been tested, please commit it with the above fix.
Comment 15 Christian Neumair 2003-12-30 19:00:29 UTC
Done. Closing.

regs,
 Chris