File: gettext.info, Node: Locale Environment Variables, Next: The LANGUAGE variable, Prev: Locale Names, Up: Setting the POSIX Locale 2.3.2 Locale Environment Variables ---------------------------------- A locale is composed of several _locale categories_, see *note Aspects::. When a program looks up locale dependent values, it does this according to the following environment variables, in priority order: 1. ‘LANGUAGE’ 2. ‘LC_ALL’ 3. ‘LC_xxx’, according to selected locale category: ‘LC_CTYPE’, ‘LC_NUMERIC’, ‘LC_TIME’, ‘LC_COLLATE’, ‘LC_MONETARY’, ‘LC_MESSAGES’, ... 4. ‘LANG’ Variables whose value is set but is empty are ignored in this lookup. ‘LANG’ is the normal environment variable for specifying a locale. As a user, you normally set this variable (unless some of the other variables have already been set by the system, in ‘/etc/profile’ or similar initialization files). ‘LC_CTYPE’, ‘LC_NUMERIC’, ‘LC_TIME’, ‘LC_COLLATE’, ‘LC_MONETARY’, ‘LC_MESSAGES’, and so on, are the environment variables meant to override ‘LANG’ and affecting a single locale category only. For example, assume you are a Swedish user in Spain, and you want your programs to handle numbers and dates according to Spanish conventions, and only the messages should be in Swedish. Then you could create a locale named ‘sv_ES’ or ‘sv_ES.UTF-8’ by use of the ‘localedef’ program. But it is simpler, and achieves the same effect, to set the ‘LANG’ variable to ‘es_ES.UTF-8’ and the ‘LC_MESSAGES’ variable to ‘sv_SE.UTF-8’; these two locales come already preinstalled with the operating system. ‘LC_ALL’ is an environment variable that overrides all of these. It is typically used in scripts that run particular programs. For example, ‘configure’ scripts generated by GNU autoconf use ‘LC_ALL’ to make sure that the configuration tests don't operate in locale dependent ways. Some systems, unfortunately, set ‘LC_ALL’ in ‘/etc/profile’ or in similar initialization files. As a user, you therefore have to unset this variable if you want to set ‘LANG’ and optionally some of the other ‘LC_xxx’ variables. The ‘LANGUAGE’ variable is described in the next subsection.
