This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: The behavor of printing out libc message catalog without calling setlocale()


GOTO Masanori <gotom@debian.or.jp> writes:

> IMHO, it is inappropriate behavior that we must call
> setlocale() in any case we have libc's translated .po file.
> So, (3-1) or (3-2) is the best solution to fix it.

First, you haven't said which version of glibc you are using.  We had
a change in this area lately.  Second, calling setlocale() is always
necessary if any of the locale-related environment variables is to be
used (LC_ALL, LC_xxx, LANG).  This changed recently but only aligned
glibc code with the behavior of gettext outside glibc (it was simply a
bug).  You seem not to like this but it is how it's supposed to work
(it works just like catgets() with the NL_CAT_LOCALE flag set).  You
can even give reasons for this: a program must be able to say that it
does not want any translations and this happens by not using
setlocale().

Having said this, there is a loophole.  If the user set the LANGUAGE
environment variable the requested translation is always used.  I'm
not especially happy about this but don't see a way to not do this.
Also, it might help in situations like yours.

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]