### Example: Customize an Existing Locale

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.

1. Determine the source of the locale you are going to use.

   For this example, use the locale for the English language in the United States (en_us\ibm-437.loc).

2. Create your own directory, then copy the selected file from the source directory to your directory and rename it.

   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.

3. In your new file, change the locale variables to the desired values.

   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"

4. Generate a new loadable locale file using the LOCALDEF utility, and place the produced module in the directory where your loadable locale files are located.

   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

5. Make sure that the directory containing your new loadable locale file is specified in the LOCPATH environment variable.
6. If you are shipping a locale, you must also supply locale DLLs with your application.

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

Internationalization

Make Your Program International
Select a Locale
Supply DLLs for Locale Handling

Locale Categories