Locale is one provided by the implementation that is accessible to the application. Locale utility writes a information about locale environment to the standard output.A locale can be composed of a base language, country of use, and codeset (Ex: CA for canada , US for united states).Normally the locale name is specified by the LANG variable.If the LC_ALL variable is set,then it will overrides all the LANG variables.
language[_territory][.codeset] [@modifier]
root@Unixarena-SOL11:~# locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_ALL=
root@Unixarena-SOL11:~#
en = English
US = United states of America
If the value is en_GB ,then “English for Great Britain”.
Here we will see how to view the locale settings and how to change it in system wide/user level.
1.To see the current locale settings for the system.(login as root)
root@Unixarena-SOL11:~# locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_ALL=
root@Unixarena-SOL11:~#
You can also view this settings in /etc/TIMEZONE file .
root@Unixarena-SOL11:~# cat /etc/TIMEZONE
#__GENERATED__V1__
#
# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
#
# This file is /etc/default/init. /etc/TIMEZONE is a symlink to this
# file.
#
#
# WARNING: CHANGES TO THIS FILE WILL BE OVERWRITTEN BY THE SYSTEM.
#
CMASK=022
TZ=localtime
LANG=en_US.UTF-8
root@Unixarena-SOL11:~#
2.To see the currently installed locale on the system,
root@Unixarena-SOL11:~# locale -a
C
POSIX
de_DE.UTF-8
en_US.UTF-8
es_ES.UTF-8
fr_FR.UTF-8
it_IT.UTF-8
ja_JP.UTF-8
ko_KR.UTF-8
pt_BR.UTF-8
zh_CN.UTF-8
zh_TW.UTF-8
root@Unixarena-SOL11:~#
If the desired locale is not in the list, then you need to install the appropriate packages for that locale from Solaris DVD.
-bash-4.1$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_ALL=
-bash-4.1$ vi .profile
-bash-4.1$ cat .profile
LANG=C
-bash-4.1$ logout
root@Unixarena-SOL11:~# su - lingesh
Oracle Corporation SunOS 5.11 11.1 September 2012
-bash-4.1$ locale
LANG=C
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_ALL=
-bash-4.1$
LC_TYPE
LC_TIME
LC_MONETARY
LC_NUMERIC
LC_COLLATE
LC_MESSAGES
-bash-4.1$ ls -lrt /etc/TIMEZONE
lrwxrwxrwx 1 root root 14 Jun 11 06:34 /etc/TIMEZONE -> ./default/init
-bash-4.1$
After editing the file , you need to reboot the server to take effect the new settings.
Current /etc/default/init file.
root@Unixarena-SOL11:~# tail /etc/TIMEZONE
# Configuration" Rights Profile may set the corresponding
# properties of the svc:/system/environment:init service
# instance and refresh the instance.
# See init(1M) for further details.
#
# WARNING: CHANGES TO THIS FILE WILL BE OVERWRITTEN BY THE SYSTEM.
#
CMASK=022
TZ=localtime
LANG=en_US.UTF-8
root@Unixarena-SOL11:~#
After editing the file.
root@Unixarena-SOL11:~# tail /etc/TIMEZONE
# properties of the svc:/system/environment:init service
# instance and refresh the instance.
# See init(1M) for further details.
#
# WARNING: CHANGES TO THIS FILE WILL BE OVERWRITTEN BY THE SYSTEM.
#
CMASK=022
TZ=localtime
#LANG=en_US.UTF-8
LANG=C
root@Unixarena-SOL11:~#
Hope this post is informative to you .Please leave a comment if you have any doubt.I will get back to you .
deepti says
Hi,
I need to change similar settings as below in solaris as below settings are for windows for issue where the arabic characters is read in reversed order. Please tell me how to do similar changes in solaris Please help.
The following need to be done on the Windows server in order to resolve this issue :
1/ Enable the unicode from Control Panel –> Region –> change system locale –> Arabic
2/ Enable bidirectional script transformations from Control Panel –> IBM i Access for Windows (32-bit) –> Language
Kyle Hanslovan says
This info was very useful today. Thanks for concisely explaining the system wide vs. user wide setting.