Tuesday, September 6, 2011

GNU Gettext library

gettext is a l10n and i18n library

1. The texts inside source code should be wrapped by gettext function

So the text "My Name is..." becomes _("My Name is...")

2. Then xgettext runs on source code to generate .pot file, which contains the a list of all translatable strings. Translator edits .po files.

msginit --locale=fr --input=name.pot 

3. The .po files are compile into binary .mo file with msgfmt

4. The user, on Unix-type systems, sets the enviroment variable LC_MESSAGES, and the program will display strings in the selected language, if there is an .mo file for it.Then using msginit program translator derives .po file for example for french it will be

No comments:

Post a Comment