利用者:Xiaoxiangquan/GoogleSummerOfCode/2011/Internationalization design
Garlic's Design of Internationalization(i18n)
We use GNU Gettext to translate strings. Here is the standard workflow.
GNU Gettext workflow
- Firstly, a programmer writes a piece of code containing strings that he wants them to be translated into end users' local language. The original code is like:
ot->name = "Quit";
To use GNU Gettext, the programmer wrote like this:
/* header for gettext */
#include <libintl.h>
...
ot->name = gettext("Quit");
- Then the programmer ran the command xgettext, which will scan the source files specified, and gather the words in gettext(""). Finally, xgettext will gennerate a .pot file, whose suffix means a PO Template.
- A po is a translation file with items like:
msgid "Wave" msgstr "Vague"
Actually, this is a po for French, generally named fr.po.