GNOME Bugzilla – Bug 119790
glib should require ngettext
Last modified: 2011-02-18 16:13:45 UTC
As discussed in bug 116236, glib should require ngettext() so that other applications on top can safely assume that this functionality is present. Also, a full set of macros such as _(, N_(, L_( in glib are also suggested in that report.
Defining _() and friends in a public GLib header doesn't sound like a good idea. While it may work for apps which just need it to call gettext(), libraries must use dgettext() and pass their own translation domain to it.
It's premature to require ngettext for GLib-2.4. Maybe for 2.6. As far as the macros go, one possiblity would be to require special inclusions of #include <glib/gintl.h> or #include <glib/gintl-lib.h>. (Also, would prevent problems with apps that are already defining these macros. I don't think we can just make glib.h suddenly start defining them.)
A new header sounds good to me. All I'm looking for is a way to stop pulling them in from libgnome that gets them from libbonobo.
Owen, what do you expect to change wrt. to ngettext between 2.4 and 2.6 ?
- Time will pass - Systems using glibc-2.1 will become less common - Systems using old non-GNU gettext will become less common. Would it be a disaster to require ngettext for 2.4? No. Is there any hard and fast rule here? No. But my gut feeling is that waiting for 2.6 will be less troublesome than doing it now.
Its not that important anyway. Modules which want to use ngettext can just check the availability by themselves. The main problem is that we need to figure out how to deal with the po file compatibility. Its easy to redefine N_() to fall back to gettext if ngettext isn't available, but we probably need to do some po-file-munging in order to make older msgfmts happy.
Actually, there's another reason to require ngettext in the glib stack as well (detected during QA of Serbian translation, so that's why it's so late detected :): a message which would better look with ngettext. #: glib/gfileutils.c:393 glib/gfileutils.c:458 #, c-format msgid "Could not allocate %lu bytes to read file \"%s\"" (This should probably be punted for 2.6 along with the requirement for ngettext itself)
We do this now.