Go to main content

International Language Environments Guide for Oracle® Solaris 11.4

Exit Print View

Updated: November 2020

Managing Available Locales

In a default installation of Oracle Solaris, the ten Core Locales are available. You can add support for additional locales.

This section describes the different ways to add support for additional languages.

Adding or Removing Locales by Using nlsadm

You can use the install-locale, list-locale, and uninstall-locale subcommands of the nlsadm command to administer locales and manage national language properties. For more information, see the nlsadm(8) man page.

To install a locale and any available translations, use the install-locale subcommand. For example, to install the Danish locale, you would use the following command:

# nlsadm install-locale da_DK.UTF-8

To list the locales available for installation based on the current image, use the list-locale command.

$ nlsadm list-locale
af_ZA.UTF-8        af    ZA         UTF-8    -         -      

On a default installation, this command lists only the locales available from the installed packages. More locales are available in the package repository, which you can display by using the –a option.

$ nlsadm list-locale -a
Reading package information from IPS publisher's repository (it could take couple of minutes) ...
af_ZA.UTF-8         af    ZA         UTF-8      -        -      

To uninstall a locale (Danish) and all related translations, use the following command:

# nlsadm uninstall-locale da_DK.UTF-8

Note - Due to the structure of packaging, sometimes the requested locale changes cannot be made and additional locales will be installed or removed as a side-effect. In such cases, nlsadm command will provide a solution with minimal impact and inform you about the additional changes needed before committing them.

Locale Facets

To understand the packaging of language support related components in Oracle Solaris 11, you must be familiar with the concept of locale facets.

What Is a Facet?

In earlier releases of Oracle Solaris, optional components such as documentation, localization, or debug files were split into separate packages. The Image Packaging System in Oracle Solaris 11 enables Oracle Solaris to keep the optional components in the same package by using special tags called facets. Facets make the packaging simpler, while keeping disk space usage low if you do not need the additional features. For more information about facets, see Package Facets and Variants in Updating Systems and Adding Software in Oracle Solaris 11.4 and Chapter 4, Allowing Variations in Packaging and Delivering Software With the Image Packaging System in Oracle Solaris 11.4.

The locale facets are used to mark files or actions that are language or locale specific. For example, in the manifest of the web/wget package, the file /usr/share/locale/ja/LC_MESSAGES/wget.mo is tagged with locale.ja=true. This tag indicates that the file, which contains Japanese translations of the wget messages, will be installed only when support for Japanese is enabled by setting the locale.ja facet to true.

Structure of Locale Facets

There is no fixed format for the locale facets. The following convention is used in the Oracle Solaris IPS repositories:


language is a two-letter language code from the ISO 639 standard, and territory is a two-letter territory code from ISO 3166.

For example, locale.fr is used to select files common for all French locales, and locale.fr_FR is used to select files specific to French in France.

Note -  You need to set both locale.fr and locale.fr_FR to True to get files installed to support French in France.

Adding or Removing Locales by Using pkg

To add language support, set the pertinent locale facet with the pkg change-facet command by using the pkg command. For example, you can use the following command to install and add support for French as spoken in France.

  • To install files common for all French locales and specific to French in France

    # pkg change-facet locale.fr=True locale.fr_FR=True
  • To install files common for all French locales and specific to all of the French variants

    # pkg change-facet locale.fr=True locale.fr_*=True

To remove files, specify False or None instead of True. False explicitly deselects applicable files. None removes the specific facet configuration and causes applicable files to get deselected implicitly because locale.*=False is configured in default installations. For more information about facet configuration, see the pkg(7) man page.

Legacy Locales

Although the default system locales in Oracle Solaris use UTF-8 encoding, a number of legacy locales can be used as well. You can install or remove legacy locales by using the nlsadm command, as described in Adding or Removing Locales by Using nlsadm.

Starting with Oracle Solaris 11.4, legacy locales are delivered together with the recommended locales in the system/locale package and their installation procedure is the same.

Locale Aliasing

While the most common locales are usually well supported across the major operating systems, their names are different in many cases. For example, although Oracle Solaris uses fr_FR.UTF-8 as the locale name for French as spoken in France using UTF-8 encoding, IBM AIX uses FR_FR, and HP-UX 11.11 and RHEL 5.4 use fr_FR.utf8. This inconsistency can be burdensome in a heterogeneous environment or when migrating to Oracle Solaris.

To address this issue, support for locale aliases was introduced in libc in Oracle Solaris 11. Locale name aliases are accepted and mapped to corresponding canonical locale names, if any, during the locale selection process, as specified in the setlocale(3C) man page, and message object or message catalog processing, as specified in the gettext(1), catopen(3C), and gettext(3C) man pages.

In addition, to provide better compatibility with earlier Oracle Solaris releases, the messaging functions now look for the message object or catalog using the obsolete Oracle Solaris locale names, such as fr or fr_FR, as additional locale names to check against. For more information, see "Short Form Locales" in the "Localization" section on the End of Feature Notices for Oracle Solaris 11 page.

For example, typical use case is a predominantly Linux environment where the Linux style locale name is used in the locale announcement in the user's shell initialization file. For example, the command setenv LANG ja_JP.utf8 is included in $HOME/.login, and the home directory is NFS-mounted. In this network environment, when a user logs into an Oracle Solaris 11.4 system, the locale alias support mechanism will internally and transparently map the locale name into the corresponding Oracle Solaris locale name, which is ja_JP.UTF-8, and will honor and support the user-specified locale name. Similarly, when non Oracle Solaris locale names are passed to a remote Oracle Solaris 11.4 system through ssh(1), they will be recognized, honored, and supported.

For more information about local aliasing, see the locale_alias(7) man page, which also has full lists of locale name mappings.