Gettext

The educational technology and digital learning wiki
Revision as of 17:51, 21 January 2010 by Daniel K. Schneider (talk | contribs) (Created page with ' 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 mu…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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
  1. 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.

Links