Monday, January 14, 2013

Check and change Solaris Locale

To check and change Solaris Locale. Below document is from Sunsolve.

How to view the current locale setting

The current locale setting can be viewed with:
# locale
LANG=en_US
LC_CTYPE= "en_US"
LC_NUMERIC= "en_US"
LC_TIME= "en_US"
LC_COLLATE= "en_US"
LC_MONETARY= "en_US"
LC_MESSAGES= "en_US"
LC_ALL=en_US
How to change the locale setting

Locales can be set or changed in 3 ways:

Via the CDE login locale

As a user-specific locale

As a system default locale

To change the current locale setting, first confirm that the desired locale is installed on the system with:

# locale -a
de
en_AU
en_CA
en_UK
C
If the desired locale is not in the list, you will need to install the appropriate packages for that locale. (See the Note below for more information about locale packages.)

How to change the locale via the CDE login locale

To change the locale for a new CDE session by selecting a different locale from the CDE login screen:

On the CDE login banner:

Choose options - languages

Under languages - choose the new locale

The CDE banner will re-cycle and then you can login to the selected locale.

Note: If a user has a different default locale set in their environment, then that locale setting will override the selected CDE login locale.

How to set a user-specific locale

Note: The syntax for setting the locale variables (LANG and LC_*) is shell dependent.

For sh, ksh:

# LANG=; export LANG
# LC_ALL=; export LC_ALL
Example:

# LANG=C; export LANG
# LC_ALL=C; export LC_ALL
For csh:

# setenv LANG
# setenv LC_ALL
Example:

# setenv LANG C
# setenv LC_ALL C
Note: To set a default locale for a user's environment, set the LANG or LC_* variables in a user's shell initialization file such as $HOME/.profile or $HOME/.cshrc

How to change the locale by setting the system default locale

To set or change the system default locale, edit the /etc/default/init file and set the LANG and LC_* variables.

LANG=C
LC_ALL=C
Example from the /etc/default/init file:

# Lines of this file should be of the form VAR=value, where VAR is one of
# TZ, LANG, or any of the LC_* environment variables.
LANG=C
LC_ALL=C
Note: The system must be rebooted after making changes to the /etc/default/init file in order for the changes to take effect.

After setting or changing the locale, verify that the locale is set correctly:

Check if the locale is set correctly by running the locale command without any options:

# locale
LANG=C
LC_CTYPE= "C"
LC_NUMERIC= "C"
LC_TIME= "C"
LC_COLLATE= "C"
LC_MONETARY= "C"
LC_MESSAGES= "C"
LC_ALL=C