Translated messages and 'gettext' API (was Re: [I18n-sig] Literal strings)
Brian Takashi Hooper
Sun, 04 Jun 2000 11:03:07 +0900
On Fri, 02 Jun 2000 21:05:18 +0200
"M.-A. Lemburg" <email@example.com> wrote:
> Brian Takashi Hooper wrote:
> > 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.)
> If I understand this right, Peter's version does not need the
> GPLed gettext lib, right ? What are the license terms for
> the Python gettext version and your modified one ?
Peter's fintl.py, and my modified version of fintl.py, are by themselves
freestanding modules, they do not require libintl or the gettext
library, they are Python reimplementations (of just the message
retrieval API). Peter's is free for any use and my module inherits that
license (is also free).
The .so I made which modifies the C gettext library is, obviously,
GPL'ed - however, it doesn't seem like it would be too hard to, again,
make a free implementation which just understands GNU (and, if possible,
Solaris-style and other platforms if there are) .mo files and implements
only gettext, dgettext, etc.