The behavor of printing out libc message catalog without calling setlocale()
Ulrich Drepper
drepper@redhat.com
Tue Nov 7 10:46:00 GMT 2000
GOTO Masanori <gotom@debian.or.jp> writes:
> What standard is it described?
No standard describes gettext. I've written gettext with some friends
of mine.
> If calling setlocale() is needed anytime when we set locale-related
> env variables, we must write setlocale() into hello.c ?!
Yes.
> # Why don't you have setlocale(LC_ALL,"") in crt0.o? :-)
Because this would violate existing standards.
> If we set the locale-related variables but a program does not
> call setlocale(), it should work as same as LC_ALL=C. Unix98 said that:
>
> For C-language programs, the POSIX locale is the default locale
> when the setlocale() function is not called.
Yes. That's what we do.
> I set only LANGUAGE=ja_JP.eucJP, the sample 1 and 2 program
> which is written in my previous mail fail to print out Japanese
> messages everytime (print out not "Success" or Japanese libc's
> message catalog but "????").
That is because you haven't set the LC_CTYPE category and therefore
the program does not know why character set you use. It uses the C
locale character set which is ASCII.
Basically, setlocale() must always be called.
> A program which does not call setlocale() should not print out
> any libc's translated message.
Unless you use LANGUAGE.
> Current glibc write out translated messages whenever we do not
> call setlocale(). It is not appropriate.
I don't agree. This is the behavior we implemented a long time ago
(at a time when the glibc team consisted of two people). If you don't
want to have translations in this case don't use LANGUAGE. Use LC_ALL
or LANG.
--
---------------. ,-. 1325 Chesapeake Terrace
Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA
Red Hat `--' drepper at redhat.com `------------------------
More information about the Libc-alpha
mailing list