Skip Navigation Links | |
Exit Print View | |
International Language Environments Guide for Oracle Solaris 11.1 Oracle Solaris 11.1 Information Library |
Oracle Solaris and the Global Market
Internationalization and Localization Overview
International Monetary Formats
Language Word and Letter Differences
2. Unicode and UTF-8 Locale Support
3. Working with Languages and Locales
A key concept for application programs is that of a program's locale. The locale is an explicit model and definition of a native-language environment. The notion of a locale is explicitly defined and included in the POSIX standard which can be accessed through http://opengroup.org.
A locale consists of a number of categories for which country-dependent formatting or other specifications exist. A program's locale defines its code sets, date and time formatting conventions, monetary conventions, decimal formatting conventions, and collation (sort) order.
A locale name can be composed of a base language, country (territory) of use, and codeset. For example, German language is de, an abbreviation for Deutsch, while Swiss German is de_CH, CH being an abbreviation for Confederation Helvetica. This convention allows for specific differences by country, such as currency unit notation. In Oracle Solaris 11 the default locale codeset is UTF-8, an ASCII compatible 8-bit encoding form of Unicode. The fully defined locale name for Swiss German would thus be de_CH.UTF-8.
More than one locale can be associated with a particular language, which allows for regional differences. For example, an English-speaking user in the United States can select the en_US.UTF-8 locale (English for the United States), while an English-speaking user in Great Britain can select en_GB.UTF-8 (English for Great Britain).
Generally the locale name is specified by the LANG environment variable. Locale categories are subordinate to LANG but can be set separately, in which case they override LANG. If the LC_ALL environment variable is set, it overrides LANG and all the separate locale categories.
The locale naming convention is:
language[_territory][.codeset][@modifier]
where a two-letter language code is from ISO 639, a two-letter territory code is from ISO 3166, codeset is the name of the codeset that is being used in the locale, and modifier is the name of the characteristics that differentiate the locale from the locale without the modifier.
All Oracle Solaris product locales preserve the Portable Character Set characters with US-ASCII code values.
For more information about the portable character set, refer to X/Open CAE Specification: System Interface Definitions, Issue 5" (ISBN 1-85912-186-1).
A single locale can have more than one locale name. For example, POSIX is the same locale as C.
The C locale, also known as the POSIX locale, is the POSIX system default locale for all POSIX-compliant systems. The Oracle Solaris operating system is a POSIX system. The Single UNIX Specification, Version 3, defines the C locale. You can register at http://www.unix.org/version3/online.html to read and download the specification.
You can specify your internationalized programs to run in the C locale in the following two ways:
Unset all locale environment variables. Runs the application in the C locale.
$ unset LC_ALL LANG LC_CTYPE LC_COLLATE LC_NUMERIC LC_TIME LC_MONETARY LC_MESSAGES
Explicitly set the locale to C or POSIX.
$ export LC_ALL=C $ export LANG=C
Some applications check the LANG environment variables without actually calling setlocale(3C) to reference the current locale. In this case, shell is explicitly set to the C locale by specifying the LC_ALL and LANG locale environment variables. For the precedence relationship among locale environment variables, see the setlocale(3C) man page.
To check the current locale settings in a terminal environment, run the locale(1) command.
$ locale LANG=C LC_CTYPE="C" LC_NUMERIC="C" LC_TIME="C" LC_COLLATE="C" LC_MONETARY="C" LC_MESSAGES="C" LC_ALL=
The types of locale categories are as follows:
Character classification and case conversion.
Specifies date and time formats, including month names, days of the week, and common full and abbreviated representations.
Specifies monetary formats, including the currency symbol for the locale, thousands separator, sign position, the number of fractional digits, and so forth.
Specifies the decimal delimiter (or radix character), the thousands separator, and the grouping.
Specifies a collation order and regular expression definition for the locale.
Specifies the language in which the localized messages are written, and affirmative and negative responses of the locale (yes and no strings and expressions).
Specifies the layout engine that provides information about language rendering. Language rendering (or text rendering) depends on the shape and direction attributes of a script.
The following table lists Oracle Solaris 11 core locales:
Table 1-1 Languages and Core locales
|
Core locales have better coverage at the level of localized messages than the locales available for additional installation. Oracle Solaris OS components such as Installer or Package Manager are localized only in core locales while localized messages for third-party software such as GNOME or Firefox are often available in more locales.
All locales in the Oracle Solaris environment are capable of displaying localized messages, provided that the localized messages for the relevant language and application are present. Additional locales including all their available localized messages can be added to the system from the installation repository by modification of pkg facet properties. For more information, see Installing Additional Locales.