gettext: Locale Environment Variables

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