Linux FAQ's & Manuals


environment variables

setting the desired locale is done by setting the following locale specific environment variables:

lc_ctype

character classification and case conversion. also indicates the language which should be used with xim (see section 6.1).
lc_numeric

non-monetary numeric formats.
lc_time

date and time formats.
lc_collate

collation order used for comparing and sorting.
lc_monetary

monetary formats.
lc_messages

formats of informative and diagnostic messages and interactive responses (also for graphical user interfaces).
lc_paper

paper format.
lc_name

lc_address

lc_telephone

lc_measurement

lc_identification

lang

the value of this variable is used as the default value for all lc_* variables which are not explicitly set.
lc_all

global override for all of the above lc_* variables ignoring lang.
language

this variable is a gnu extension and overrides lc_messages, (even if lc_all is set).

the syntax for these environment variables (except for language) is defined as:

[language[_territory][.codeset][@modifier]]

``language'' is the iso 639 language code3 (two lower case letters) and ``territory'' is the country code according to iso 31664 (two upper case letters).

while for the lc_* variables the value should consist of exactly one specification of a locale with the above syntax, the value of the language variable can consist of a colon separated list of locale names. this makes it possible for example to set:

     language="zh_tw.utf-8:ja_jp.utf-8:de_de.utf-8" 

if one wants to see traditional chinese messages if available and if not use japanese messages as fallback and if these are not available either use german messages. only if those aren't available either fall back to the english default messages5.

some more details about the meaning and usage of some of the locale specific environment variables can be found in ``the open group base specifications issue 6'' http://www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap08.html. but beware, there are some minor differences in the naming of the locales as described in ``the open group base specifications'' and the naming used under linux. this specification uses lang=fr_fr as an example, but the correct spelling under linux is lang=fr_fr, the language code must be lower case and the country code must be upper case under linux. the examples shown in this specification are probably for some other flavour of a unix like system (aix?).



footnotes

... code3
see http://www.evertype.com/standards/iso639/iso639-en.html
and http://www.loc.gov/standards/iso639-2/
... 31664
see http://www.iso.ch/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html
... messages5
see also ``the gnu c library reference manual'' (it is in the package ``glibc-info''), section ``user influence on `gettext''' for more information about language.
2005-03-09