How Client-Library and Server-Library set up default localization values

When a Client-Library or Server-Library application calls the CS-Library routine cs_ctx_alloc to allocate a context structure, CS-Library loads default localization information into the new context structure.

To load default localization information, CS-Library follows these steps:

  1. CS-Library looks for a locale name, searching for the LC_ALL and LANG. environment variables, in order:

    • If LC_ALL is defined, CS-Library uses its value as the locale name. If LC_ALL is not defined but LANG is defined, CS-Library uses its value as the locale name.

    • If neither LC_ALL nor LANG is defined, CS-Library uses a locale name of “default.”

  2. CS-Library looks up the locale name in the locales file to determine which language and character set are associated with it.

  3. CS-Library loads localized messages and character set information appropriate to the language and character set determined in step 2.

This process provides the new context structure with all of the localization information that it needs.