scripts for language support in applications

This is following the gettext standard as used in NoteTree.

To be honest I don't always use it, this was actually the first application I did not just stuff in an implementation of my own because I wanted to get to know the canonical way (that Django also uses). I generally find my own easier to work with (for instance in Rst2Html).

The way to do this consists of a couple of steps, with a function for each step:

Preparing the environment

binfab lang.init <project> <lang>

Generates a directory "locale" onder de <project> directory containing an LC_MESSAGES directory for each language indicated by <lang> ('.' is default, this creates both "en" and "nl").

Collecting the texts (or symbols) to translate

binfab lang.gettext <project> <source>

Generates a PO file per <source> in the directory from which it is started (should be moved to "locale" as pygettext doesn't do that). When you enter "." for <source> the entire project is inspected. The output file is named messages-<source>.po except for "." there the name becomes messages-all.po.

Bundling the texts to translate:

binfab lang.merge <project> <lang> <source>

Generates/updates a PO file for <lang> based on (changes in) the POT file. <source> works like with gettext <lang> must be a regular language code so you can't do all-in-one with a default as with init

The actual translating:

binfab lang.poedit <project> <lang>

Lets you edit a specific PO file using the program POEDIT. From this program you can directly compile to MO (is it done by default on saving? Is this why there isn't a separate command for this in this file?)

Getting the (updated) translations ready to work with:

binfab lang.place <project> <lang> <appname>

Copies a specific <lang>.mo file to the appropriate LC_MESSAGES directory en renames it to <appname>.mo.