[Top][All Lists]

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

Clarification of using gettext from within library.

From: David Bruce
Subject: Clarification of using gettext from within library.
Date: Wed, 29 Dec 2010 14:09:35 -0600

Hi Bruno et al,

I maintain two gettext-using programs (tuxmath and tuxtype) that have
informally (copy/paste) shared a lot of code for some time.  This
common code is now being made into a real library, libt4kcommon.  The
plan is for the library (t4kcommon) to use the program's (tuxmath)
translation domain, rather than its own.

I have studied the gettext manual section on preparing library sources
and see the following sentence:

"When you are preparing a library, not a program, for the use of
gettext, only a few details are different. Here we assume that the
library has a translation domain and a POT file of its own. (If it
uses the translation domain and POT file of the main program, then the
previous sections apply without changes.)"

Does this mean that the program does all the initialization and the
library none, or that the library must call all three of setlocale(),
bindtextdomain(), and textdomain()?  The documentation seems to imply
the latter, but it would make sense for me that the library's
bindtextdomain() call would not be needed if it is using the
translation domain of the program.

Also, I take it that the library in our scenario should use gettext()
rather than dgettext().

Thanks for any help,

David Bruce

reply via email to

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