Runtime system messages
This section describes how to translate default English .msg message files in a different language.
Runtime system error messages are provided in .iem message files. The system message files use the same technique as user defined message files. The default message files (msg) are located in the $FGLDIR/msg/en_US directory.
For backward compatibility with IBM®
Informix® 4GL, some of
these system error messages are used by the runtime system to display
messages during a dialog instruction. For example, end users may
get the error message -1309 "There
are no more rows in the direction you are going" when scrolling
an a DISPLAY ARRAY
list in TUI mode.
If your application language is not English, you will need to translate some of the system messages to a specific locale and language. If your application language is English, you might just want to customize the default messages.
Here are some examples of system messages that can appear at runtime:
Number | Description |
---|---|
-1204 | Invalid year in date. |
-1304 | Error in field. |
-1305 | This field requires an entered value. |
-1306 | Please type again for verification. |
-1307 | Cannot insert another row - the input array is full. |
-1309 | There are no more rows in the direction you are going. |
To use your own customized system messages, do this:
- Create a new directory under $FGLDIR/msg, using the same name as your
current locale. For example, if
LANG=fr_FR.ISO8859-1
, you must create$FGLDIR/msg/fr_FR.ISO8859-1
. - Copy the original system message source files (.msg) from
$FGLDIR/msg/en_US
to the locale-specific directory. - Edit the source files with the .msg suffix and translate the messages.
- Recompile the message files with the fglmkmsg tool to produce .iem files. Make sure you have set the correct locale!
- Run a program to check if the new messages are used.
With this technique, you can deploy multiple message files in different languages and locales in the same FGLDIR/msg directory.
You can use the fglmkmsg tool with the -r
option to revert a
.iem file to a source .msg file.
There is no need to translate all messages of the .msg files: Most of the error messages are unexpected during a program execution and therefore can stay in English. The messages subject of translation can be found in the 4glusr.msg and rds.msg files.
The locale can be set with different environment variables (see setlocale manual pages for more details). To identify the locale name, the runtime system first looks for the LC_ALL value, then LC_CTYPE and finally LANG.
Pay attention to locale settings when editing message files and compiling with fglmkmsg: The current locale must match the locale used in the .msg files.
The .iem files used at runtime must match the current locale used by programs. This is automatic, as long as you put the correct files in the corresponding $FGLDIR/msg/$LANG directory.