Basic Steps in Internationalization
An internationalized application's executable image is portable between languages and regions. To internationalize software, you should:
Use the interfaces described in this book to create software with an environment that can be modified dynamically without the necessity of recompiling.
Divide software into executable code and messages. The messages include all printable and displayable messages that the user might see. Keep the message strings in a message catalog.
Message strings are translated for a language or region. A locale includes the message strings and methods to specify sorting.
To use a localized version of a product, the user sets certain environment variables. The product then displays messages in their translated form. Date, time, currency and other information is formatted and displayed according to locale-specific conventions. Message translations and online help contents are provided throughout different layers, as described in the following diagram.
Figure 1-1 Functions and Structure of Locales in the Solaris Operating Environment
Localization Functions in Solaris Interfaces
The OS locale layer provides the basic locale database and functions that are plugged into the OS system interface at the application's runtime. Applications access these OS locale modules through standard APIs.
The X11 locale layer provides the interface to X input method and X output method so that the X11 applications can allow local text input and display. Fonts are provided to enable applications to display characters from various languages.
CDE/Motif is built on top of the X11 window system. Hence, it can utilize the X11 locale capability through X11 APIs. Solaris localizations have various locale-specific configurations for CDE applications in order to make the desktop functional within the target locale. Message translations and online help contents are provided throughout different layers.
What Is a Locale?
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 library definitions of the ANSI C Language standard.
A locale consists of a number of categories for which there is country-dependent formatting or other specifications. A program's locale defines its codesets, date and time formatting conventions, monetary conventions, decimal formatting conventions, and collation (sort) order.
A locale can be composed of a base language, the country (territory) of use, and optional codeset. Codeset is usually assumed. For example, German is de, an abbreviation for Deutsch, while Swiss German is de_CH, CH being an abbreviation for Confederation Helvetica. This allows for specific differences by country, such as currency units notation.
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 locale (English for the United States), while an English-speaking user in Great Britain can select en_GB (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 operand is set, it overrides not only LANG, but all the separate locale categories as well.
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 it from the locale without the modifier.
All Solaris product locales preserve the Portable Character Set characters with US-ASCII code values.
For more information on 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 as C.
Full and Partial Locales
A full Solaris locale has all of the listed functions and the localized system messages in the relevant language. Partial locales have no localized messages installed. All locales in the Solaris environment are capable of displaying localized messages, provided that localized messages for the relevant language are installed. For example, the following locales can be either partial or full locales:
de_DE.ISO8859-1
de_DE.ISO8859-15
de_DE.UTF-8
de_AT.ISO8859-1
de_AT.ISO8859-15
de_CH.ISO8859-1
When the German message translations are installed using the Language CD, all of the above locales become full locales because they have access to a fully translated desktop. The language CD contains message translations for the following languages and locales:
German
French
Spanish
Swedish
Italian
Japanese
Korean
Simplified Chinese locale
Traditional Chinese locale
All partial locales are available on the Software CD. Message translations are available on the Languages CD.
All English locales are also full locales and are available on the Software CD.