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 123865 - Please use ngettext for handling plurals in GHex
Please use ngettext for handling plurals in GHex
Status: RESOLVED FIXED
Product: ghex
Classification: Applications
Component: general
unspecified
Other other
: Normal normal
: ---
Assigned To: Jaka Mocnik
Jaka Mocnik
Depends on:
Blocks:
 
 
Reported: 2003-10-04 22:48 UTC by Danilo Segan
Modified: 2007-08-03 16:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Use ngettext in findreplace.c (444 bytes, patch)
2003-10-04 22:50 UTC, Danilo Segan
none Details | Review

Description Danilo Segan 2003-10-04 22:48:31 UTC
(Following paragraphs copied from bug 116236 verbatim)
As mentioned in
http://developer.gnome.org/doc/tutorials/gnome-i18n/developer.html#plurals,
the common 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);

This is the relevant message.

#: src/findreplace.c:519
#, c-format
msgid "Replaced %d occurencies."


I'll attach a patch below.
Comment 1 Danilo Segan 2003-10-04 22:50:03 UTC
Created attachment 20470 [details] [review]
Use ngettext in findreplace.c
Comment 2 Jaka Mocnik 2004-01-10 16:13:55 UTC
that would be nice - btw, my language also knows of a "dual" not only
singular and plural, so how do we handle that;)

btw, does gnome have a policy regarding use of ngettext? how would my
decision to use it affect the translators and all the users of gnome?
I am really quite unfamiliar with the l10n/i18n tools.

anyway, there is no time for that for the 2.6 series since we are
entering freeze period, but perhaps for 2.8...
Comment 3 Christian Rose 2004-01-10 17:57:11 UTC
The freezes don't affect ghex, do they? Ghex isn't included in GNOME
2.5/2.6 (http://www.gnome.org/start/2.5/modules/).

As for the current ngettext policy, many desktop modules already used
ngettext in GNOME 2.4, and in GNOME 2.5 many developer-libs modules do
that aswell. See the central bug 116236 for discussions about this in
core modules and links to many resolved requests for use of ngettext
in core modules.

As for "dual" I'm not quite sure what you mean. You'll have to
remember though that the ngettext API is intentionally designed with
the English use of singular and plural in mind, but the plural rules
that translators can use as a direct consequence of ngettext being
used allows for almost any form of plural use. I think you'll find
good examples of this in
http://developer.gnome.org/doc/tutorials/gnome-i18n/developer.html#plurals.
Comment 4 Danilo Segan 2004-01-10 20:01:37 UTC
Jaka,
ngettext precisely solves those issues for Serbian, Slovenian (that's
your language, right?), Russian...

If you need help to make use of it (in translations), feel free to
e-mail me or gnome-i18n list, or drop by #i18n at irc.gnome.org
(someone there will probably be able to help).  You can also check the
gettext info manual, which even contains sample rule for Slovenian (I
don't know if it's correct):

Plural-Forms: nplurals=4; plural=n%100==1 ? 0 : n%100==2 ? 1 :
n%100==3 || n%100==4 ? 2 : 3;

(you use this in PO file header, and later add translations as
msgstr[0], msgstr[1], msgstr[2] and msgstr[3])

As a sidenote, I'm really surprised that your program doesn't use
this, even though your language pretty much requires it ;)

As for GNOME acceptance, as menthos said, it's pretty much decided
stuff: ngettext goes in. If you wish, I may add a configure check for
ngettext as well.
Comment 5 Kjartan Maraas 2005-07-03 17:03:20 UTC
Any news on this?
Comment 6 Rodney Dawes 2007-08-03 16:37:07 UTC
This patch is no longer applicable to SVN. Committed an updated fix.