A typical internationalized Open Client/Server application uses the initial localization values determined by LC_ALL, LANG, or the “default” entry in the locales file to localize.
Initial localization values are determined at runtime, when the Open Client/Server application calls the CS-Library routine cs_ctx_alloc to allocate a CS_CONTEXT structure. When an application makes this call, CS-Library loads initial localization information into the new context structure.
The localization information includes:
Language
Character set
Collating sequence
Date and time formats
The loading process works as follows:
The application calls cs_ctx_alloc.
CS-Library searches the environment for the LC_ALL or LANG environment variables to determine a locale name. The following table describes this search:
Is LC_ALL defined? |
Is LANG defined? |
CS-Library action |
---|---|---|
Yes |
N/A |
Use LC_ALL’s value as the locale name. |
No |
Yes |
Use LANG’s value as the locale name. |
No |
No |
Use a locale name of “default,” which means CS-Library loads one of the following:
|
CS-Library looks up the locale name in the locales file to determine the associated language and character set (a collating sequence may or may not be specified). If the locale name does not exist in the locales file, cs_ctx_alloc returns an error.
CS-Library loads the new context structure with the appropriate localization information.