[Top][All Lists]

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

Re: using gettext for libraries

From: Petr Vandrovec
Subject: Re: using gettext for libraries
Date: Wed, 3 Jan 2001 20:40:59 MET-1

On  3 Jan 01 at 17:29, Andrew Clausen wrote:
> Petr Vandrovec wrote:
> > You should use bindtextdomain, dgettext, and eventually
> > dcgettext, dngettext, dcngettext and bind_textdomain_codeset. Forget
> > about gettext, ngettext and other domain-less functions.
> Thanks.
> > > So, why is there always exactly one domain active?
> > 
> > Because of it is convient for programs. Libraries must always use
> > dgettext(), as does libc or other correctly internationalized libraries.
> Why not have allow an arbitary number of domains?  Worried about
> collisions?

As at least gettext-0.10.35 uses linked list in bindtextdomain(), so number
of text domains is unlimited. You can use any domain name (which you 
previously bound to some message file, of course) with dgettext(). Only 
just one of them is selected by textdomain() as default for [n]gettext() 
function. You can hardly have two defaults.

Nothing prevents program from not using gettext, and use dgettext instead.
But you'll get shorter generated code, unless you have

#define gettext(X) dgettext(NULL, (X))

(which is what gettext does). It is also more convient to translators if
you have all messages from one project in one file, and not splitted into
set of random pieces, possibly with duplicates. Also example gettext
Makefiles do not handle multiple domains in one directory very well.

If you are in doubts, just look through implementation. 
                                                Best regards,
                                                    Petr Vandrovec

reply via email to

[Prev in Thread] Current Thread [Next in Thread]