This is the mail archive of the
mailing list for the glibc project.
Re: The behavor of printing out libc message catalog without calling setlocale()
- To: GOTO Masanori <gotom at debian dot or dot jp>
- Subject: Re: The behavor of printing out libc message catalog without calling setlocale()
- From: Ulrich Drepper <drepper at redhat dot com>
- Date: 07 Nov 2000 08:40:44 -0800
- Cc: libc-alpha at sourceware dot cygnus dot com
- References: <14855.54816.588406.72159A@fe.dis.titech.ac.jp>
- Reply-To: drepper at cygnus dot com (Ulrich Drepper)
GOTO Masanori <firstname.lastname@example.org> 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
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 `------------------------