Go to main content

International Language Environments Guide for Oracle® Solaris 11.4

Exit Print View

Updated: February 2022
 
 

Managing User's Locale

This section provides information about how to set locale and how to select locale in GNOME display manager.

Setting the Locale in a Terminal Session

You can change the locale in a terminal session by setting the LANG variable as follows:

$ export LANG=locale

For example, to change to the de_DE.UTF-8 locale, use the following command:

$ export LANG=de_DE.UTF-8

To verify the locale has been successfully changed, run the locale command:

$ 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="de_DE.UTF-8" 
LC_ALL=

For more information, see the locale(1) man page.

To obtain the list of locales available in a system, use the following command:

$ nlsadm list-locale

For more information about installing more locales, see Managing Available Locales.

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.


Language Selection in Desktop Session

The desktop session language is configured in the Region & Language panel settings. Choose the language from the Language list. The desktop session starts with the selected language at the next login. Formats such as date and number are also configured from the Formats list.

Persistent Locale Setting for Terminal Sessions

To make a locale setting persistent and apply it to newly opened terminal sessions, place the export statement in the user's shell initialization files. For more information, see About the User Work Environment in Managing User Accounts and User Environments in Oracle Solaris 11.4.

Locale Negotiation Over Remote Connections

Applications that provide remote access such as ssh or zlogin might perform locale negotiation, which is an attempt to match current user locale setting against the potentially different set of locales available on the remote location. This process can have unexpected results, for example:

  • User expects to get a shell with the remote system's default system locale but gets a different, negotiated locale.

  • User expects to get a negotiated locale but because it is not available, the shell is set up with default system locale.

For more information about the locale negotiation mechanism in Secure Shell, see ssh(1) and sshd(1M) man pages.

For more information, see Managing Secure Shell Access in Oracle Solaris 11.4.