Locale Names (Compact 7)
3/12/2014
A locale name is based on the language tagging conventions of RFC 4646, and is represented by LOCALE_SNAME.
The general format of a locale name is <language>-<COUNTRY/REGION>. The placeholder <language> value represents a lowercase ISO 639 language code. Use the ISO 639-1 codes when available. Otherwise, use the ISO 639-2/T codes. The placeholder <COUNTRY/REGION> value specifies an uppercase ISO 3166-1 country/region identifier. For example, the locale name for English (United States) is "en-US" and the locale name for Chinese (Taiwan) is "zh-TW".
Note
The constant LOCALE_NAME_MAX_LENGTH gives the maximum length of a locale name. It includes space for a terminating null character.
A neutral locale name, one with no country/region, uses the following format: <language>. If it is a neutral locale for which the script is significant, the format is <language>-<Script>.
If you must distinguish a locale from another locale for the same language and country/region because it uses a different script, the LOCALE_SNAME value follows the format <language>-<Script>-<COUNTRY/REGION>, where <Script> is an initial-uppercase ISO 15924 script code. For example, the LOCALE_SNAME value for the specific locale Uzbek (Latin, Uzbekistan) is "uz-Latn-UZ". The <Script> component is not used in cases where a language is written in only one script.
You designate sort orders for locales by using sort order identifiers, for example, SORT_DEFAULT. To distinguish two or more sort orders for the same language and country/region, the locale name follows the format <language>-<COUNTRY/REGION>_<sort order>. If you must distinguish both script and sort order, the name follows the format <language>-<Script>-<COUNTRY/REGION>_<sort order>. You do not explicitly specify the default sort order, only the alternative sort order. For example, Hungarian (Hungary) with either SORT_DEFAULT or the numerically equivalent SORT_HUNGARIAN_DEFAULT is designated "hu-HU". Hungarian (Hungary) with the sort order SORT_HUNGARIAN_TECHNICAL is designated "hu-HU_technl".
To create your own custom locale, the locale name must follow the format of <language>-<COUNTRY/REGION>-x-<custom> or <language>-<Script>-<COUNTRY/REGION>-x-<custom>, where <custom> is an alphanumeric string specific to the supplemental locale.
Requirements
Header |
winnls.h |
Library |
Coreloc.lib |