Understanding locale environment variables
Multicultural support uses several environment variables to influence the selection of locales. You can set the values of these variables to change search paths for locale information:
- LANG
- Specifies the installation default locale.Note: The LANG environment variable value is established at installation. (This is the locale every process uses unless the LC_* environment variables are set). The LANG environment variable can be changed by using the Manage Language Environment menu in SMIT. The C and POSIX locales are designed to offer the best performance.
- LC_ALL
- Overrides the value of the LANG environment variable and the values of any other LC_* environment variables.
- LC_COLLATE
- Specifies the locale to use for LC_COLLATE category information. The LC_COLLATE category determines character-collation or string-collation rules governing the behavior of ranges, equivalence classes, and multicharacter collating elements.
- LC_CTYPE
- Specifies the locale to use for LC_CTYPE category information. The LC_CTYPE category determines character handling rules governing the interpretation of sequences of bytes of text data characters (that is, single-byte versus multibyte characters), the classification of characters (for example, alpha, digit, and so on), and the behavior of character classes.
- LC__FASTMSG
- Specifies that default messages are used for the C and POSIX locales
and that
NLSPATH
are ignored when LC__FASTMSG is set totrue
. Otherwise, POSIX compliant message handling will be performed. The default value will beLC__FASTMSG=true
in the /etc/environment file. - LC_MESSAGES
- Specifies the locale to use for LC_MESSAGES category information. The LC_MESSAGES category
determines rules governing affirmative and negative responses and
the locale (language) for messages and menus.
Application developers who write applications that do not display multibyte characters on a terminal should make sure the LC_MESSAGES value is not set to
C@lft
. If necessary, disable the setting with the putenv("LC_MESSAGES=") subroutine. The result is output that uses translated message catalogs.C@lft
is disabled by login sessions that can display multibyte characters. Processes launched using cron or inittab retain theC@lft
LC_MESSAGES value and use the setlocale() subroutine to establish the language environment for default messages. - LC_MONETARY
- Specifies the locale to use for LC_MONETARY category information. The LC_MONETARY category determines the rules governing monetary-related formatting.
- LC_NUMERIC
- Specifies the locale to use for LC_NUMERIC category information. The LC_NUMERIC category determines the rules governing nonmonetary numeric formatting.
- LC_TIME
- Specifies the locale to use for LC_TIME category information. The LC_TIME category determines the rules governing date and time formatting.
- LOCPATH
- Specifies the search path for localized information, including
binary locale files, input methods, and code-set converters. Note: All setuid and setgid programs ignore the LOCPATH environment variable.
- NLSPATH
- Specifies the search path for locating message catalog files. This environment variable is used by the Message Facility component of the multicultural support subsystem. See the catopen subroutine for more information about expected format of the NLSPATH variable.
The environment variables that affect locale selection can be grouped
into three priority classes: high, medium, and low. Environment variables
in the high priority class are:
- LC_ALL
- LC_COLLATE
- LC_CTYPE
Environment variables in the medium priority class are:
- LC_MESSAGES
- LC_MONETARY
- LC_NUMERIC
- LC_TIME
The environment variable in the low priority class is:
- LANG
When a locale is requested by the setlocale subroutine
for a particular category or for all categories, the environment
variable settings are queried by their priority level in the following
manner:
- If the LC_ALL environment variable is set, all six categories
use the locale it specified. For example, if the LC_ALL environment
variable is equal to
en_US
and the LANG environment variable is equal tofr_FR
, a call to the setlocale subroutine sets each of the six categories to theen_US
locale. - If the LC_ALL environment variable is not set, each individual
category uses the locale specified by its corresponding environment
variable. For example, if the LC_ALL environment variable
is not set, the LC_COLLATE environment variable is set to
de_DE
, and the LC_TIME environment variable is set tofr_CA
, then a call to the setlocale subroutine sets the LC_COLLATE category tode_DE
and the LC_TIME category tofr_CA
. Neither environment variable has precedence over the other in this situation. - If the LC_ALL environment variable is not set, and a value
for a particular LC_* environment variable is not set, the
value of the LANG environment variable determines the setting
for that specific category. For example, if the LC_ALL environment
variable is not set, the LC_CTYPE environment variable is
set to
en_US
, the LC_NUMERIC environment variable is not set, and the LANG environment variable is set tois_IS
, then a call to the setlocale subroutine sets the LC_CTYPE category toen_US
and the LC_NUMERIC category tois_IS
. The LANG environment variable specifies the locale for only those categories not previously determined by anLC_*
environment variable. - If the LC_ALL environment variable is not set, a value
for a particular LC_* environment variable is not set, and
the value of the LANG environment variable is not set, the
locale for that specific category defaults to the
C
locale. For example, if the LC_ALL environment variable is not set, the LC_MONETARY environment variable is set tosv_SE
, the LC_TIME environment variable is not set, and the LANG environment variable is not set, then a call to the setlocale subroutine sets the LC_MONETARY category tosv_SE
and the LC_TIME category toC
.