Gettext is a common package, widely used for message localisation.
The "gettext" package have two main parts - the message extraction and preparing utilites, and a library for runtime message handling.
CLIP use some "gettext" utilities for message extracting and preparing of message files, but use own code for runtime message handling.
CLIP have number of utilites to make the message handling easier.
Locale message roadmap:
Extracting of message and creating the .pot (po-template) file.
For extracting messages from C sources may be used xgettext command from gettext package.
CLIP automatically extract messages, quoted in [] brackets, and store them in $CLIPROOT/locale/pot/<modulename>/<filename>.pot file.
The <modulename> determined by CLIP from current working directory name, or may be specified by environment variable CLIP_MODULE.
The <filename> determined from name of compiled file.
Use script clip_msgmerge to merge .pot files from directory $CLIPROOT/locale.pot with translated .po files in directory $CLIPROOT/locale.po.
clip_msgmerge merge files for all locales in $CLIPROOT/locale.po/<locale>. To add new locale you just need create appropriate directory, for example, $CLIPROOT/locale.po/ru_RU.KOI8-R for locale ru_RU.KOI8-R.
You must edit created .po files in any text editor, or use specialized po-file editor, like kbabel from KDE suite.
Charset definition in .po file. | |
---|---|
Please check the field "Content-Type: text/plain; charset=ASCII" in first entry of .po file. You must set valid value of charset, used in this file (for example, "Content-Type: text/plain; charset=KOI8-R"). This is very important for correct message handling. |
And the last step: invoke script clip_msgfmt to format messages into compiled message file in directory $CLIPROOT/locale.mo
Now, CLIP runtime will fetch nesessary messages from this files, and substitute it in your program.