Re: gnome-i18n.h



>> In several of the libgnomeui files I've been playing with, the stuff from
>> i18n.h is replicated with a slight variation, the comment says:
>> /* Library must use dgettext, not gettext.  */

>> However, some of the libgnomeui files just use gnome-i18n.h. Seems
>> like one set of files or the other is doing the wrong thing.

Elliot> Everything should just include gnome-i18n.h

This isn't right for most of libgnome/libgnomeui.

Translatable strings in the libraries must be run through `dgettext'
and not `gettext' at run time.  The reason is that library text is
almost certainly in a different translation domain from the main
application.  `gettext' uses the default domain, while `dgettext' lets
you specify the domain as an argument.

So in the libraries we ordinarily write:

	#define _(String) dgettext (PACAKGE, String)

whereas in an application we'd write

	#define _(String) gettext (String)


The situation is actually somewhat more complicated than this.  There
are places in libgnomeui where the text is assumed to be supplied in
its untranslated form by the application, and not by some library.  So
in this case we always use gettext.  For instance, gnome-app-helper
does this.  (Incidentally, this is mildly lame.  Instead we should
supply a way to set the translation domain on a case-by-case basis.)


I agree that writing the same boilerplate #if code in every file isn't
good.  Instead we should introduce a new private header which is not
installed, and use that in the library code.


I think gnome-i18n.h should be a public header file for use by Gnome
apps.  So it should define _ to use gettext, not dgettext.

Tom



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]