Select a Locale
To select a locale category during program
execution, call the setlocale function. This function has two arguments:
- category specifies the locale category. The LC
environment variables that match the names of locale categories are:
- LC_ALL
- LC_COLLATE
- LC_CTYPE
- LANG
The
LANG environment variable is functionally
equivalent to LC_ALL and provided only for AIX
compatibility. Use LC_ALL rather than LANG to
avoid conflict with other programs which use LANG
to specify the locale. If the locale
specification format from such programs does not
match that of VisualAge C++, setlocale() may
return NULL.
- LC_MESSAGES
- LC_MONETARY
- LC_NUMERIC
- LC_TIME
- LC_TOD
- LC_SYNTAX
- locale is the
name of the locale from which to take the value for the
category. You can use this argument in the following
ways:
- Omit the locale argument to
establish a locale which reflects the current
values of the environment variables.
- Pass NULL as the locale name
string to tell the function to query the current
locale without modifying it.
- Pass an empty string to set the
current locale as specified by the LC environment
variable. If the environment variable isn't set,
the current locale is set to the default POSIX C
locale.
If you set environment variables inside a DOS session
on the Windows operating system, the changes are not visible to
setlocale.
Example: Select a Locale Explicitly by name
Example: Select a Locale Using Environment Variables

Internationalization

Make Your Program
International
Customize a Locale
Convert Character
Coding

Locale-Sensitive
Interfaces
Locale Naming
Conventions
Locales
Provided on OS/2
Locales
Provided on Windows