Chapter 2. Locales
An internationalized system has no built-in assumptions or dependencies on code set, character
classification, character comparison rules, character collation order, monetary formatting, numeric
punctuation, date and time formatting, or the text of messages. A locale is defined by these language and
cultural conventions. An internationalized system processes information correctly for different locations. For
example, in the United States, the date format, 9/6/2002, is interpreted to mean the sixth day of the ninth
month of the year 2002. The United Kingdom interprets the same date format to mean the ninth day of the
sixth month of the year 2002. The formatting of numeric and monetary data is also country-specific, for
example, the U.S. dollar and the U.K. pound.
All locale information must be accessible to programs at run time so that data is processed and displayed
correctly for your cultural conventions and language. This process is called localization. Localization
consists of developing a database containing locale-specific rules for formatting data and an interface to
obtain the rules.
Understanding Locale
A locale comprises the language, territory, and code set combination used to identify a set of language
conventions. These conventions include information on collation, case conversion, and character
classification, the language of message catalogs, date-and-time representation, the monetary symbol, and
numeric representation.
Locale information contained in the locale definition source files must first be converted into a locale
database by the localedef command. The setlocale subroutine can then access this information and set
locale information for applications. To deal with locale data in a logical manner, locale definition source
files are divided into six categories. Each category contains a specific aspect of the locale data. The LC_*
environment variables and the LANG environment variable can be used to specify the desired locale. For
more information on locale categories, see “Understanding Locale Categories” on page 8.
Typical User Scenarios
Users might encounter several NLS-related scenarios on the system. This section lists common scenarios
with suggested actions to be taken.
v User keeps default code set
The user might be satisfied with the default code set for language-territory combinations even where
more than one code set is supported. The user might keep the default code set if the current user
environment uses that code set, or if the user is new and has no code set preference.
The language-territory selected at system installation time is defaulted to the appropriate locale based
on the default code set. The default keyboard mappings, default font, and message catalogs are all
established around the default code set. This scenario requires no special action from the user.
v User changes code set from the default code set
Users of a Latin-1 or Japanese locale might want to migrate their data and NLS environment to a
different (nondefault) code set. This can be done in the following fashion:
– When the user has existing data that requires conversion
Flat text files that require conversion to the preferred code set can be converted through the Users
application in Web-based System Manager, the SMIT Manage the Language Environment
®
menu, or
the iconv utility. User-defined structured files require conversion through user-written conversion
tools that use the iconv library functions to convert the desired text fields within the structured files.
– When the user wants to change to the other code set
Where more than one code set is supported for a language-territory combination, the user may
change to a nondefault locale by using:
© Copyright IBM Corp. 2002, 2005 7