GNOME Bugzilla – Bug 123865
Please use ngettext for handling plurals in GHex
Last modified: 2007-08-03 16:37:07 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.
Created attachment 20470 [details] [review] Use ngettext in findreplace.c
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...
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.
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.
Any news on this?
This patch is no longer applicable to SVN. Committed an updated fix.