Generating Localized Files

The following sections discuss the generation of files for an internationalized application. Static and dynamic output are considered for both UIL and C/C++ generation. In static output, strings are created when the source code is generated. In dynamic output, strings are incorporated at run time by reference to a separate source.

Generating UIL

Static and dynamic output

Static and dynamic output are handled in the same manner when generating UIL. Typically, App-defaults files are not used. Instead, the application maintains a list of messages in a separate UIL file for each locale. When the application is built, the appropriate UIL is compiled into a UID and then used.

Use the Constant Manager and File Manager to create each of the locale-specific UIL files:

· Code all output (for example, warning, error, and informational messages) as constants.

· Set the file placement for this output to the appropriate UIL file. The application then fetches the value of the constant from the UID at run time.

Generating C and C++

Your application handles static and dynamic output differently in C/C++.


Static output

When generating C/C++, save Strings and XmStrings, as well as other locale-specific information such as fonts and colors, in app-defaults. To do this, you can take advantage of the X environment variables XFILESEARCHPATH and XUSERFILESEARCHPATH.

The following table lists the substitutions X and Motif allow in these paths:











Value of the filename parameter, or the application's class name if filename is NULL


Value of the type parameter


Value of the suffix parameter


Language string associated with the specified display


Language part of the display's string


Territory part of the display's string


Code set part of the display's string



Value of the UID filename parameter

See the section "Finding File Names" in X Window System Toolkit by Paul J. Asente and Ralph R. Swick (p. 860 in ISBN 1-55558-051-3) for further details.

Dynamic output

If you plan to use C or C++ instead of UIL to handle string output, write your application so that dynamic output uses a message catalog. A message catalog is a method for storing and fetching strings to/from external sources.

Message catalog options

You have three options for a message catalog:

· Use the MNLS standard

· Use the XPG standard

· Design your own

Note: To use one of the first two methods, your operating system must support it. Different operating systems require different storage locations for the catalog.

Designing Your Own Message Catalog

Designing your own message catalog is your only choice if you plan to run on a set of operating systems that do not share a common standard.


The following procedure is one of many ways of designing your message catalog:

1. Use the Berkeley DBM library, which, given a key or a tag string, fetches the corresponding message string.

2. Represent the tag string in Builder Xcessory as constants.

3. Use the DBM string fetching routines, passing the tag string and a default message string as parameters. If the lookup of the message catalog yields no match for the tag string, display the default message string.