Visitors: 15027632

Latest Articles


HOWTO: Create or Modify a Message Catalog PDF Print E-mail
User Rating: / 3
Written by Michael Felt   
Message Catalogs are used to seperate the text messages from programs or applications. This simplifies the problem of supporting multiple languages and/or codesets. The AIX Message Facility calls the individual files - message catalogs.

A Message Catalog is one or more sets of message strings and is stored in a binary format.
Modifying Language Files

AIX messages are not stored in the programs, but are stored as a seperate resource
(NLS - National Language Support). Each family of applications
has what is called a message catalog and the file name has .cat as it's suffix.

For each translation there is a seperate directory - /usr/lib/nls/msg/${LANG}.
AIX supports multiple languages at run-time.

Unknown to most, catalogs can be modified. The most dangerous of modifying these system
files is that your modification might get overwritten by a software update. However,
if you either create a seperate LANG directory, or just keep your modifications well
documented, it should not be a problem.

For examining and modifying language files - or creating a new one for an application!
- the programs needed are:
dspmsg: display a single message, or a default message if it cant be found in a catalog
dspcat: display the entire catalog
gencat: create a binary message catalog from a textual message file

Messages catalogs consist of one or more sets of message strings:
Usage: dspmsg [-s SetNumber] CatalogName MessageNumber ['default' [Argument...]]

If there is only one set of messages the SetNumber argument can be ommitted. If there
is more than one message set, and the argument is not provided, the first set is displayed.

compare these commands:

dspmsg -s 1 smit 3 #display message 3 from set 1

dspmsg -s 3 smit 1 #display message 1 from set 3

dspmsg smit 1
dspmsg smit 3

Modifying existing catalogs.
The easiest way to accomplish this is to use dspcat to output the entire catalog to
a textfile and edit that. I recommend editing a copy of that file, so you can easily
compare differences (using diff for example).

For this example I am going to modify the tsm catalog to change the login and password
messages of the login program.

1. dspcat tsm >tsm_orig.msg
2. cp tsm_orig.msg tsm_new.msg
3. vi tsm_new.msg
4. diff tsm_orig.msg tsm_new.msg
5. gencat tsm_new.msg >
6. cp /usr/lib/nls/msg/en_US

Output of the diff command shows I edited three of the messages in set 1

michael@x054:[/home/michael/msgs]diff tsm_new.msg tsm_orig.msg
< 1 : 1 Identity:
< 1 : 2 %s's Authentification:
> 1 : 1 login:
> 1 : 2 %s's Password:
Authorized use only:
Authorized Console use only:
Console login:

< Prev   Next >

Legacy PDFs

AIX 5.2
AIX 5.1