• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to add and set new locale in solaris

by admin

A locale is a collection of files, data and sometimes code which contain the necessary information to adapt Solaris to a specific geographical market.
A locale is essentially a “bundle”, containing information such as:
1. the messages displayed to the user (localized messages)
2. codesets
3. date and time formatting conventions
4. monetary conventions decimal formatting conventions
5. collation (sort) order
6. fonts and/or other writing specific information.

The default naming convention for a locale is :

language[_territory][.codeset] [@modifier]

for example :

solaris locales

Note: In Solaris, there can be several locales for a single language.
For example, French is spoken in France and in Canada, but each country has different ways of displaying monetary and time information. Therefore, there is both the fr_FR locale (French – France) as well as the fr_CA locale (French – Canada) to accomodate these different cultural conventions.

Viewing locales and locale settings

To view the current locale settings:

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

As you can see above currently all the locale categories are set to “C”.

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

# locale -a
C
POSIX
iso_8859_1

Adding new locale

As seen above there are only 3 locales installed on the system (C, POSIX, iso_8859_1). In order to change the locale we must first get it installed from the Solaris 10 DVD. To install a new locale first find the local name you want to install from the below command :

# localeadm -lv
Verbose mode
Checking for installed packages. This could take a while.

..... (output ommitted for brevity) ....
Checking for India region (india) (verbose mode)
(c_solaris packages)
package SUNWeuluf not found
package SUNWinleu not found

No packages found.
..... (output ommitted for brevity) ....

From the above command output, you can get all the available locale names. Suppose you want to install locale to have indian languages. First mount the Solaris ISO. and then install the locale named india using the localeadm command.

# mount -F hsfs -o ro `lofiadm -a /path/to/solaris_iso` /mnt
# localeadm -a india -d /mnt/Solaris_10/Product

To verify the newly installed locale :

# locale -a
C
POSIX
bn_IN.UTF-8
en_IN.UTF-8
gu_IN.UTF-8
hi_IN.UTF-8
iso_8859_1
kn_IN.UTF-8
mr_IN.UTF-8
ta_IN.UTF-8
te_IN.UTF-8

Setting new locale

1. Changing locales gloablly for all users
So now if you want to set the date and time format in Inian language Hindi you can set LC_TIME locale category to hi_IN.UTF-8. This requires a reboot of the system. Edit the /etc/default/init file and set/add the LANG and LC_* variables.

# vi /etc/default/init
LC_TIME=hi_IN.UTF-8

Reboot the system:

# shutdown -i6 -g0 -y

2. Setting user specific locales
Different locales can also be set for different users on the same system. To do this edit the profile of the individual user to export the specifi locales. For example,

# vi $HOME/.profile
LC_TIME=hi_IN.UTF-8; export LANG

Verify

To verify the new locales set :

LANG=
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME=hi_IN.UTF-8
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_ALL=

Check the current date, and you would see the the in the Hindi language.

solaris set locale

Filed Under: Solaris

Some more articles you might also be interested in …

  1. Solaris : How to increase the Inodes on UFS file system with newfs command
  2. How to create an OBP boot device alias in Solaris [SPARC]
  3. How to add swap file in Solaris
  4. Solaris Volume Manager (SVM) : Understanding metadb Flags
  5. How to Create a Datalink in Non-Global Zone from the Global Zone in Solaris 11
  6. Solaris : How to scan new storage LUNs (scsi/iscsi/fc/sas)
  7. How to enable or disable telnet in Solaris 10
  8. How to update Solaris 11 system Using IPS
  9. How to configure IPMP in Solaris 11 – Active-Active & Active-Standby
  10. How to verify non-global solaris zone is installed

You May Also Like

Primary Sidebar

Recent Posts

  • aws ec2: CLI for AWS EC2 (Command Examples)
  • aws cur – Create, query, and delete AWS usage report definitions (Command Examples)
  • aws configure – Manage configuration for the AWS CLI (Command Examples)
  • aws cognito-idp: Manage Amazon Cognito user pool and its users and groups using the CLI

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright