Software Internationalization Guide

POSIX and XPG Internationalization Model
Software Internationalization Guide526225-002
3-5
Setting the User Locale Environment
3. LANG takes precedence when neither LC_ALL nor the LC variables are defined.
4. If LC_ALL, the LC variables, and LANG are all undefined, the default locale (the
C/POSIX locale) is used.
In the following example, all aspects of the French locale (fr_FR) are supported
except collation, which is based on German (de_DE) conventions:
LANG=fr_FR.ISO8859-1
LC_COLLATE=de_DE.IS08859-1
In the next example, however, the precedence of LC_ALL overrules German collation:
LC_ALL=fr_FR.ISO8859-1
LC_COLLATE=de_DE.IS08859-1
The assignment to LC_COLLATE has no effect because LC_ALL takes precedence
over all other international environment variables.
Setting the User Locale Environment
A user’s environment can inherit the C/POSIX default locale or be set to a different
locale. The user’s environment is set either from the users start-up file or from the
OSS shell. For the environment settings to take effect the locale must be exported,
whether from a start-up file or from the shell.
With a start-up file, the environment settings are retained until the user modifies the
start-up file. At the shell level, environment settings remain intact until the user exits
the session or resets the values. If a locale is not defined, the users environment
defaults to the C/POSIX locale.
Examples: Setting the Locale from a Start-Up File
In this example, a section of a start-up file sets the user environment to interact with
the user in US English but to display the date and time formats in German:
export LANG=en_US.ISO8859-1
export LC_TIME=de_DE.ISO8859-1
In this example, a section of a start-up file sets the user environment to interact with
the user in French but to collate according to the German dictionary:
export LANG=fr_FR.ISO8859-1
export LC_COLLATE=de_DE.ISO8859-1
Example: Setting the Locale From the Shell
This example uses the shell to set the locale first to US English, then to Spanish, and
then to French:
$export LANG=en_US.ISO8859-1
$date
15 Mar 1994, 09:45
$export LC_ALL=es_ES.ISO8859-1