KCMS CMM Developer's Guide

Localizing Messages

Note that the message strings are arguments in the dgettext(3I) function that marks these strings for inclusion in the kcssolmsg_strings.po file upon running xgettext()() on this code file.

These are very terse notes on what the application or library should contain and what you should run to create a file of messages ready to be translated into the local language.

See setlocale(3C), bindtextdomain(3I), gettext(3I), dgettext(3I),and msgfmt(1) for information on internationalization and localization.

Application Module

The application, or library module must include the following code:

#include

<locale.h> #include <libintl.h>

setlocale("LC_MESSAGES",

"<language>");

bindtestdomain("string_file_name","directory");

dgettext("string_file_name",

"message");

where

language is one of the language locale directories in /usr/lib/locale

directory is the location of the installed translated message file, string_file_name

message is the message string to translate

Developer

As the CMM developer, you must do the following tasks to create a file of messages to translate into the local language:

  1. Use the -lintl linker option when building.

  2. Run xgettext on files using the dgettext() function.

  3. Edit the resulting .po file to translate the messages into the appropriate language.

  4. Run msgfmt on the .po file to create a .mo file.

  5. Move the .mo file to the appropriate directory, such as /usr/openwin/lib/locale/<language>/LC_MESSAGES.

The application should then pick up the translated messages.