Software Internationalization Guide

POSIX and XPG Internationalization Model
Software Internationalization Guide526225-002
3-9
Generating Message Catalogs
Example: Message Source File From an Internationalized
Program
This is an example of a message source file in US English that contains program
messages in a format defined by XPG. This example is based on the program used in
the previous example:
$ English message source file
$set 1 main module
1 "Main Menu"
2 "1 - Add Record"
3 "2 - Delete Record"
4 "3 - Modify Record"
5 "4 - Quit"
6 "Make A Selection:"
7 "You pressed an invalid key. Try Again"
$set 2 add_record_module
1 "1 - Add Record Number"
2 "2 - Enter First Name"
3 "3 - Enter Last Name"
4 "4 - Enter Phone Number"
$set 3 delete_record_module
1 "1 - Delete Record Number"
$set 4 modify_record_module
1 "1 - Modify Record Number"
2 "2 - Modify First Name"
3 "3 - Modify Last Name"
4 "4 - Modify Phone Number"
This program can accommodate other locales easily, because the text in this file can
be localized for each supported locale—the source code does not need to be revised
for each locale.
Generating Message Catalogs
A message catalog is typically a direct-access storage area containing program
messages. Message catalogs are generated using the XPG-specified gencat utility.
The input to the gencat utility is one or more message source files, or output from the
mkcatdefs utility. mkcatdefs preprocesses a message source file to change
symbolic identifiers into numeric constants, then produces a set of commands suitable
for passing to gencat. The runcat utility can be used to create a message catalog if
the mkcatdefs and gencat utilities can be run using no options.
The output of the gencat utility is a message catalog that contains all the message
data in a machine-readable format and offers data security by preventing unwanted
changes to the message data.
Figure 3-2 on page 3-10 shows the generation of a Spanish and an English message
catalog.
See the associated reference pages either online or in the Open System Services
Shell and Utilities Reference Manual for more information about these utilities.