Upravit

Sdílet prostřednictvím


Retrieving and Setting Locale Information

The application must be able to retrieve and set specific information about available locales and languages. Each element of locale information, such as the name of a particular day of the week or the character used as a decimal separator, has a corresponding constant. The available constants are defined in Locale Information Constants.

Your application always stores and manipulates locale information as a null-terminated string. No binary data is allowed, and any numeric values must be specified as text. Each type of information has a particular format. Also, several types are linked together so that changing one type changes the value of the other type as well.

To retrieve locale information, the application calls GetLocaleInfo or GetLocaleInfoEx with the constant that corresponds to the required information. The application can call SetLocaleInfo to set an item of locale information.

Note

Although a locale identifier might be supported, it is not available for use by an application unless the corresponding locale is also installed.

 

Since most locale information constants are mutually exclusive, only one type of information can be handled at a time. The exceptions to this rule are LOCALE_USE_CP_ACP, LOCALE_RETURN_NUMBER, and LOCALE_NOUSEROVERRIDE, which can be combined with other constants using a binary OR.

Caution

Use of LOCALE_NOUSEROVERRIDE is strongly discouraged as it disables user preferences.

 

Like a number of applications, for example Microsoft Active Directory, your application can maintain its strings in a sortable database. For more information, see Handling Sorting in Your Applications.

Using National Language Support

Locale Information Constants

Handling Sorting in Your Applications

Working with Custom Locales