UniCreateLocaleObject
This function creates a locale object.
Contents
Syntax
UniCreateLocaleObject(localeSpecType, localeSpec, result) ;
Parameters
- localeSpecType - integer - input
- Specifies the type of value of localeSpec.
- localeSpec - PVOID - input
- The specific type or locale token as defined by localeSpecType.
- result - LocaleObject - output
- The locale object for use.
Constants
The constants for use for localeSpecType:
Returns
An integer with values of:
Calling Convention
Example Code
integer localeSpecType; PVOID localeSpec; LocaleObject localeObj; integer rc; ... rc = UniCreateLocaleObject(localeSpecType, localeSpec, localeObj); ...
Related Functions
Notes
UniCreateLocaleObject create the locale object for the locale specified by localeSpec. The LocaleObject contains all the data and methods necessary to perform locale specific operations or accept the localeObj. Upon successful creation, all categories are created and initialized.
When localeSpec is a character string (multi-byte or UCS), it identifies the locale to be used for initialization. The locale name UNIV is reserved and refers to the definitions provide default behavior for functions.
If localeSpec is NULL, the locale name UNIV is used.
When localeSpec is a locale token as indicated by localeSpecType, the token identifies the locale to be initialized.
If localeSpec is an empty character string (multi-byte or UCS), the locale object is initialized using the settings in the locale environment variables.
Category | Precedence | Usage |
---|---|---|
LC_ALL | Highest | Setting LC_ALL takes precedence over any other locale environment variable. |
LC_COLLATE | Equal precedence | Specifies collation (sorting) rules. |
LC_CTYPE | Equal precedence | Specifies character classification and case conversion. |
LC_MESSAGES | Equal precedence | Specifies the values for affirmative and negative answers, and the language for displayed messages. |
LC_MONETARY | Equal precedence | Specifies monetary formats and currency symbol. |
LC_NUMERIC | Equal precedence | Specifies decimal formats. |
LC_TIME | Equal precedence | Specifies date and time formats. |
LANG | Lowest | Setting LANG takes precedence over any undefined locale environment variable. This may be used in conjunction with LC_COLLATE, LC_CTYPE, LC_MESSAGES, LC_MONETARY, LC_NUMERIC, and LC_TIME. |
If the specified locale is valid and supported, UniCreateLocaleObject allocates memory for the new object. It is the application's responsibility to free this memory with a call to UniFreeLocaleObject when the object is no longer needed. If the function fails for any reason, the contents localeObj are undefined.
The locale token provides a shorthand notation for specifying a locale. The format of the locale token is as returned by a call to UniLocaleStrToToken. The format is defined as an unsigned integer of four octets.
Examples of typical usage:
1. The locale environment variables are set as follows:
LANG=de_DE LC_MONETARY=en_US
The localeSpec argument is an empty multibyte or UCS character string.
This example creates a localeObj with all categories set to de_DE except for LC_MONETARY which has the value of en_US.
2. The locale environment variables are set as follows:
LANG=fr_FR
The localeSpec argument is an empty multibyte or UCS character string.
This example creates a locale object with all categories set to fr_FR.
3. The locale environment variables are set as follows:
LC_ALL=it_IT LANG=fr_FR
The localeSpec argument is an empty multibyte or UCS character string.
This example creates a locale object with all categories set to it_IT.
OS Version Introduced
OS/2 Warp