Gettext
Jump to navigation
Jump to search
A note on PO. *.po is a file name extension of gettext, the GNU internationalization and localization (i18n) library. Gettext uses the following principle:
- All source code must use Gettext calls when using strings. (e.g. print("salut") would become print (gettext ("salut") or the shorcut print (_("salut"))
- The language used in the code will be the key for all translation languages
- xgetttext then can extract all these from the source and produce a *.pot template file.
- This template file then is use to produce editable *.po files that look like this
- src/name.c:36
msgid "My name is %s.\n" msgstr "Je m'appelle %s.\n"
Msgid (the key and original language) and msgstr the translated string can be displayed side-by side by so-called PO editors or PO-capable editors like emacs.