Using a CS_LOCALE structure to set custom localization values

When a client connects to an Open Server application, Open Server creates a CS_LOCALE structure reflecting the client’s language and character set. For example, when a french/cp850 client logs in to a us_english/iso_1/binary Open Server application, the Open Server application creates a french/cp850 CS_LOCALE structure for that connection.

The information in this structure is available to Open Server programmers, who can call cs_locale to copy the information into a newly-allocated CS_LOCALE structure.

You can install custom localization information in the application-wide context structure before calling srv_version. To do this, an application:

  1. Calls cs_loc_alloc to allocate a CS_LOCALE structure.

  2. Calls cs_locale with type set to CS_LC_ALL to load the CS_LOCALE with custom localization values. A type of CS_LC_ALL ensures that the CS_LOCALE is loaded with localization values that are internally consistent.

  3. Calls cs_config with property set to CS_LOC_PROP to copy the custom localization values into the application’s context structure.

  4. Calls cs_loc_drop to deallocate the CS_LOCALE.