Skip Navigation Links | |
Exit Print View | |
International Language Environments Guide for Oracle Solaris 11.1 Oracle Solaris 11.1 Information Library |
2. Unicode and UTF-8 Locale Support
3. Working with Languages and Locales
Locale Selection in GNOME Display Manager
How to Select a Locale in GNOME Desktop Manager
How to Start a Session in a Different Language
Setting the Locale in a Terminal Session
How to Add Language Support in Package Manager
Adding Language Support From the Command Line
Locale Selection in the Installer
Locale Selection in the Automated Installer
Selecting Locales to Be Installed
Setting the Default System Locale, Keymap and Timezone
In a default installation of Oracle Solaris, the following core locales are available, with only one locale per language:
Chinese - Simplified (zh_CN.UTF-8)
Chinese - Traditional (zh_TW.UTF-8)
English (en_US.UTF-8)
French (fr_FR.UTF-8)
German (de_DE.UTF-8)
Italian (it_IT.UTF-8)
Japanese (ja_JP.UTF-8)
Korean (ko_KR.UTF-8)
Portuguese - Brazilian (pt_BR.UTF-8)
Spanish (es_ES.UTF-8)
The following sections describe the different ways to add support for additional languages.
In order to better understand the procedure to install language support in Oracle Solaris 11, you should become familiar with the concept of facets.
In earlier Oracle Solaris releases, the optional components such as documentation, localization or debug files used to be split into separate packages. The Image Packaging System in Oracle Solaris 11 allows Oracle to keep the optional components in the same package 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 on facets, see Package Facets and Variants in Adding and Updating Oracle Solaris 11.1 Software Packages and Chapter 5, Allowing Variations, in Packaging and Delivering Software With the Image Packaging System in Oracle Solaris 11.1.
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 facet.locale.ja=true. This tag indicates that the file, containing Japanese translations of the wget messages, will only be installed when support for Japanese is enabled by setting the facet.locale.ja facet to true.
There is no fixed format for the locale facets. The following convention is used in the Oracle IPS repositories:
facet.locale.{language}[_territory]
language is a two-letter language code from the ISO 639 standard, and territory is a two-letter territory code from ISO 3166.
All the optional components of the installed packages will be updated automatically.
Note - Package Manager manages only languages present in the system/locale package. Use the command line to add or remove support for any other language.
To add language support from the command line, set the pertinent locale facet with the pkg change-facet command. For example, you would use the following command to add support for French as spoken in France.
To install files common for all French locales
# pkg change-facet facet.locale.fr=True
To install files specific to French in France
# pkg change-facet facet.locale.fr_FR=True
You would use the following commands to add support to all available French variants.
To install files common for all French locales
# pkg change-facet facet.locale.fr=True
To install all files specific to all of the French variants
# pkg change-facet facet.locale.fr_*=True
In previous Oracle Solaris releases the default system locale was configured in the /etc/default/init file. In Oracle Solaris 11, the settings have been moved to the corresponding properties of the svc:/system/environment:init service. Service properties can be edited using the svccfg(1M) command. For example, to change the default system locale to fr_FR.UTF-8, you would run the following commands:
# svccfg -s svc:/system/environment:init setprop environment/LANG = astring: \ fr_FR.UTF-8
The service has to be refreshed for the change to take effect:
# svcadm refresh svc:/system/environment
The value of the service property can be verified by the following command:
# svccfg -s svc:/system/environment:init listprop environment/LANG
While the default system locales in Oracle Solaris use UTF-8 encoding, a number of legacy locales can be used as well.
Note - The GNOME desktop environment supports only UTF-8 locales.
Legacy locale support is contained in the system/locale/extra package. Run the following command to install legacy locale support:
# pkg install pkg:/system/locale/extra
To enable support for a specific language, set the corresponding locale facet to true. For example, to install the da_DK.ISO8859-1 locale (and, in fact, all of the da_DK locales), you would enable facet.locale.da and facet.locale.da_DK as follows:
# pkg change-facet facet.locale.da=True
# pkg change-facet facet.locale.da_DK=True
While the most common locales are usually well supported across the major operating systems, their names are different in many cases. As an example, while 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 has been 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 setlocale(3C), and message object or message catalog processing, as specified in 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 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 Oracle Solaris 11 - End of Feature Notices page.
A 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 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. In the same way, when non-Solaris locale names are passed to a remote Oracle Solaris 11 machine through ssh(1), they will be recognized, honored, and supported.
For more details, refer to the locale_alias(5) man page, which also has full lists of locale name mappings.