┌──────────────────────────────────────────────────────────────────────┐ │IBM Visual Age C++ for OS/2 provides locale databases and a switching │ │mechanism as well as programming interfaces. │ └──────────────────────────────────────────────────────────────────────┘
It would be an ideal implementation of the locale if IBM OS/2 Warp provides the locale files and the mechanism. Otherwise, a software provider needs to ship locale databases with the product. Unfortunately, the current version of IBM OS/2 Warp does not support XPG4. Instead, the IBM Visual Age C++ for OS/2 provides the following internationalization facilities:
The locale of the IBM Visual Age C++ for OS/2 has the following naming convention:
<language>_<territory>.<codeset>
where -
language:
┌──────────────────────────────────────────────────────────────────────┐│The user default locale can be set via environment variables. │ └──────────────────────────────────────────────────────────────────────┘
The LANG environment variable specifies the locale name for all the locale categories in the absence of the LC_ALL and other LC_* (LC_COLLATE, LC_CTYPE, LC_MESSAGES, LC_MONETARY, LC_NUMERIC and LC_TIME) environment variables. The LC_ALL environment variable also specifies the locale name for all categories. The environment variables has precedence over any of the other environment variables starting with LC_. Other LC_* environment variables specify the locale name for the respective locale category.
The following is an example of setting the environment variables.
SET LANG=en_us SET LC_TIME=de_deAll locale categories are set to en_us (English-US) except for LC_TIME, which is set to de_de (Germany-German).
┌──────────────────────────────────────────────────────────────────────┐ │The LOCPATHenvironment variable determines directories where the │ │locale files exist. │ └──────────────────────────────────────────────────────────────────────┘
The file name of the locale database is determined by the code set name. At run time, IBM Visual Age C++ for OS/2 searches the locale file in the current directory. If it doesn't exist, it searches the file depending on the LOCPATH environment variable, environment variables which specify the user default locale such as LANG, and the locale name. For instance, if the current code page is 949, LANG environment variable is set to ko_kr, and LOCPATH is set to x:\ibmcpp\locale, it searches x:\ibmcpp\locale\ko_kr\ibm-949.LCL file as the locale database.
This primer does not intend to describe the detailed mechanism and utilities of locale. For the further details of the locale definition and implementation, refer to the following books: