Locale Identifiers
Each locale has a unique identifier, a 32-bit value that consists of a language identifier and a sort order identifier. The locale identifier is a standard international numeric abbreviation and has the components necessary to uniquely identify one of the installed operating system-defined locales. NLS supports both predefined locale identifiers and custom identifiers.
Note
Locale names can be used with functions introduced in Windows Vista that take a locale name as a parameter, instead of a locale identifier. For more information, see Calling the "Locale Name" Functions. Use of locale names instead of locale identifiers is always preferable.
The following illustration shows the format of the bits in a locale identifier.
+-------------+---------+-------------------------+
| Reserved | Sort ID | Language ID |
+-------------+---------+-------------------------+
31 20 19 16 15 0 bit
Predefined Locale Identifiers
The predefined locale identifiers supported by NLS are defined in the National Language Support (NLS) API Reference.
NLS uses the following locale information constants to represent locale identifiers.
- LOCALE_SLANGUAGE or LOCALE_SLOCALIZEDLANGUAGENAME
- LOCALE_SNAME
- LOCALE_SSCRIPTS
- LOCALE_IDEFAULTANSICODEPAGE
Custom Locale Identifiers
Windows Vista: NLS supports the custom locale identifiers represented by the following locale information constants.
Building a Locale
You can use the Locale Builder utility provided by NLS to build locales. For more information, see Microsoft Locale Builder.
Your application can construct a locale identifier using the MAKELCID macro. Alternatively it can use one of the default identifiers corresponding to the constants listed below.
Retrieval of Locale Identifiers
An application can retrieve the current locale identifiers by using the GetSystemDefaultLCID and GetUserDefaultLCID functions. Each thread can set and retrieve its own locale with SetThreadLocale and GetThreadLocale.
Related topics