Translated messages and 'gettext' API (was Re: [I18n-sig] Literal strings)

Brian Takashi Hooper brian@garage.co.jp
Sat, 03 Jun 2000 00:41:36 +0900


Hi there,

[snip]
> [M.-A. Lemburg]:
> > I'm currently using my own scheme for solving the NLS problem,
> > but it currently only work on a per-process basis. What I am
> > looking for now, is a way to be able to set the language
> > on a per user (of a single server process) basis.
> > 
> > Is the gettext approach useful for this too, i.e. does it
> > allow fast switching of the target language ?
> 
> Not as is.  

I also ran into this same problem and made a slightly expanded Python
implementation of gettext (based on Peter's fintl.py!) that adds a few
calls to allow the language to explicitly be set for each call, which
makes it a little more appropriate for applications where each thread,
or perhaps even each call, might have a different language preference.

I've also experimentally used interpositioning with a hacked version of
gettext, compiled as a .so, to enable a C version of the same stuff
(basically, just allowing an explicit language argument to dcgettext,
which if supplied is used instead of getting the language from the
environment).

Does this seem useful to anyone?  If so, I'll put the code up somewheres
(actually, even if not, what the heck.)

-Brian