### Locale Naming Conventions

The setlocale library function that selects the active locale maps the descriptive locale name into the name of the locale object before loading the locale and making it accessible.

In IBM C and C++ Compilers programs, the locale modules are referred to by descriptive locale names. The locale names themselves are not case sensitive. The names have three parts and follow the format:

>     <Language>_<Territory>.<Codeset>

The parts of a locale name are:

Language | is a two-letter abbreviation for the language name. The abbreviations come from the ISO 639 standard.
Territory | is a two-letter abbreviation for the territory name. The abbreviation comes from the ISO 3166 standard.
Codeset | is the name registered by the MIT X Consortium that identifies the registration authority that owns the specific encoding. A modifier may be added to the registered name but is not required. The modifier is of the form @modifier and identifies the coded character set as defined by that registration authority. Note: On FAT file systems, the modifier cannot be used as it causes the filename to exceed the 8 character FAT filename limit.

The Codeset parts are optional. If they are not specified, Codeset defaults to IBM-nnn, where nnn is the current code page. (The modifier portion defaults to nothing.)

The setlocale function tries to load the locale as follows:

- If the locale name contains the drive letter (for example, C:) or the backslash character, it is a fully-qualified name (such as \IBMCXXW\LOCALE\EN_US\IBM-850). The name must specify the name of a DLL that contains the locale. If you do not specify the extension .LCL, it is appended to the name.
- If the locale name does not contain a drive letter or the backslash character, it is not a fully-qualified name. The setlocale function tries to load the locale from the current directory, or from the directories that you specified in the LOCPATH environment variable. The specified paths are searched to find the DLL that contains the locale.

The LOCALDEF utility processes the locale name parameter to produce a filename suitable for use with the FAT file system as follows:

1. The locale name parameter is separated into two parts, language_territory and codeset.
2. If you specify the codeset name, the locale name is built as:

          language_territory\codeset.lcl

3. If you do not specify the codeset name, the locale name is built as:

          language_territory.lcl

4. If the locale cannot be found, the function GetOEMCP from the Windows SDK or DosQueryCp from the OS/2 Developers Toolkit is called to determine the current codepage. The codeset name is built as IBM-nnn, where nnn is the current codepage. The locale name is then built as:

          language_territory\codeset.lcl

The exceptions to the rule above are these two special locale names, which are already recognized:

- C
- POSIX

Internationalization
Localization and Locales

Customize a Locale

Locale Categories
Locales Provided on Windows
Locales Provided on OS/2