Go to main content

International Language Environments Guide for Oracle® Solaris 11.3

Exit Print View

Updated: December 2018
 
 

Composite Locales

The LC* variables, such as LC_CTYPE or LC_MESSAGES, described in Locale Categories, can also be set in a terminal along with the LANG variable. When the LC* variable is set, they override the LANG setting for the particular category. This type of locale setting is called composite locale.

$ export LANG=de_DE.UTF-8
$ export LC_MESSAGES=en_US.UTF-8

In this example, applications that correctly handle the locale settings would operate in German locale but have their localized output printed in English. The output of locale command in this case would be as follows:

$ locale
LANG=de_DE.UTF-8 
LC_CTYPE="de_DE.UTF-8" 
LC_NUMERIC="de_DE.UTF-8" 
LC_TIME="de_DE.UTF-8" 
LC_COLLATE="de_DE.UTF-8" 
LC_MONETARY="de_DE.UTF-8" 
LC_MESSAGES=en_US.UTF-8 
LC_ALL=

The LC_MESSAGES variable is in this case printed without double quotes, which indicates that the value is explicitly set. The other LC* variables inherit their values from the LANG variable. The LC_ALL variable can be used to override all of the LANG and LC* settings. For more information, see the locale(1) and setlocale(3C) man pages.


Caution

Caution  -  Do not use multiple character sets in composite locales. For example, setting LANG=en_US.UTF-8 and LC_MESSAGES=ja_JP.eucJP leads to unpredictable results.