Jump to content

UniCreateLocaleObject

From EDM2
Revision as of 15:16, 1 November 2011 by Martini (talk | contribs)

UniCreateLocaleObject

UniCreateLocaleObject(localeSpecType, localeSpec, result)
This function creates a locale object.

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:

Module

Define (C/C++)

Export name/Ordinal

Calling conversion

Cdecl32

Example Code

integer      localeSpecType;
PVOID        localeSpec;
LocaleObject localeObj;
integer      rc;
...
rc = UniCreateLocaleObject(localeSpecType, localeSpec, localeObj);
...

Related Functions

UniFreeLocaleObject

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.

CategoryPrecedenceUsage
LC_ALLHighestSetting LC_ALL takes precedence over any other locale environment variable.
LC_COLLATEEqual precedenceSpecifies collation (sorting) rules.
LC_CTYPEEqual precedenceSpecifies character classification and case conversion.
LC_MESSAGESEqual precedenceSpecifies the values for affirmative and negative answers, and the language for displayed messages.
LC_MONETARYEqual precedenceSpecifies monetary formats and currency symbol.
LC_NUMERICEqual precedenceSpecifies decimal formats.
LC_TIMEEqual precedenceSpecifies date and time formats.
LANGLowestSetting 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



Back to OS/2 API