gettext OperationsThe initialization of locale data should be done with more or less the same code in every program, as demonstrated below:
int
main (argc, argv)
int argc;
char argv;
{
...
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
...
}
PACKAGE and LOCALEDIR should be provided either by
`config.h' or by the Makefile. For now consult the gettext
sources for more information.
The use of LC_ALL might not be appropriate for you.
LC_ALL includes all locale categories and especially
LC_CTYPE. This later category is responsible for determining
character classes with the isalnum etc. functions from
`ctype.h' which could especially for programs, which process some
kind of input language, be wrong. For example this would mean that a
source code using the (cedille character) is runnable in
France but not in the U.S.
So it is sometimes necessary to replace the LC_ALL line in the
code above by a sequence of setlocale lines
{
...
setlocale (LC_TIME, "");
setlocale (LC_MESSAGES, "");
...
}
or to switch for and back to the character class in question.
Go to the first, previous, next, last section, table of contents.