(gettext) Triggering

Info Catalog (gettext) Importing (gettext) Sources (gettext) Preparing Strings
 4.2 Triggering `gettext' Operations
 The initialization of locale data should be done with more or less the
 same code in every program, as demonstrated below:
      main (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' or `hello' 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 c, (c-cedilla
 character) is runnable in France but not in the U.S.
    Some systems also have problems with parsing numbers using the
 `scanf' functions if an other but the `LC_ALL' locale is used.  The
 standards say that additional formats but the one known in the `"C"'
 locale might be recognized.  But some systems seem to reject numbers in
 the `"C"' locale format.  In some situation, it might also be a problem
 with the notation itself which makes it impossible to recognize whether
 the number is in the `"C"' locale or the local format.  This can happen
 if thousands separator characters are used.  Some locales define this
 character according to the national conventions to `'.'' which is the
 same character used in the `"C"' locale to denote the decimal point.
    So it is sometimes necessary to replace the `LC_ALL' line in the
 code above by a sequence of `setlocale' lines
        setlocale (LC_CTYPE, "");
        setlocale (LC_MESSAGES, "");
 On all POSIX conformant systems the locale categories `LC_CTYPE',
 are available.  On some systems which are only ISO C compliant,
 `LC_MESSAGES' is missing, but a substitute for it is defined in GNU
 gettext's `<libintl.h>'.
    Note that changing the `LC_CTYPE' also affects the functions
 declared in the `<ctype.h>' standard header.  If this is not desirable
 in your application (for example in a compiler's parser), you can use a
 set of substitute functions which hardwire the C locale, such as found
 in the `<c-ctype.h>' and `<c-ctype.c>' files in the gettext source
    It is also possible to switch the locale forth and back between the
 environment dependent locale and the C locale, but this approach is
 normally avoided because a `setlocale' call is expensive, because it is
 tedious to determine the places where a locale switch is needed in a
 large program's source, and because switching a locale is not
Info Catalog (gettext) Importing (gettext) Sources (gettext) Preparing Strings
automatically generated byinfo2html