This example illustrates how to create a locale named TEXAN using the charmap file representing the ibm-437 encoded character set. The locale is derived from the locale representing the English language and the cultural conventions of the United States.
For this example, use the locale for the English language in the United States (en_us\ibm-437.loc).
For example, create a subdirectory called TEXAN in the IBM C and C++ Compilers locale directory and copy locale en_us\ibm-437.loc from the locale directory, \IBMCXXO\LOCALE (OS/2) or \IBMCXXW\LOCALE (Windows), with the following command:
copy en_us\ibm-437.loc \IBMCXXW\LOCALE\TEXAN\ibm-437.loc
copy en_us\ibm-437.loc \IBMCXXO\LOCALE\TEXAN\ibm-437.loc
Do not rename the locale source file.
For our example locale, we modify the representation of date and time information to include the greeting "Howdy Pardner" by changing:
d__fmt "%a %b %e %H:%M:%S %Z %Y"
to read:
d_t_fmt "Howdy Pardner %a %b %e %H:%M:%S %Z %Y"
To create our example TEXAN locale from the command line in the directory containing our loadable locale files, and if IBM C and C++ Compilers is installed on drive X, type:
localdef /f X:\IBMCXXW\LOCALE\IBM-437.cm /i X:\IBMCXXW\LOCALE\TEXAN\IBM-437.loc X:\IBMCXXW\LOCALE\TEXAN\IBM-437.lcl
localdef /f X:\IBMCXXO\LOCALE\IBM-437.cm /i X:\IBMCXXO\LOCALE\TEXAN\IBM-437.loc X:\IBMCXXO\LOCALE\TEXAN\IBM-437.lcl
The customized locale is now ready to be used in application programs by calls to the setlocale function. For example, programs can activate the TEXAN locale with the C or C++ statement:
setlocale(LC_ALL, "texan");
Example: Select a Locale Explicitly by Name
Example: Select a Locale Using Environment Variables
![]()
Make Your Program International
Select a Locale
Supply DLLs for Locale Handling