colobot/colobot-data — pull request #3 by OdyX (2012-12-31 11:15:17+00:00)
Title: Handle levels' translations with po4a

This series of commits permits to manage gettext translations for levels; the gen_levels_xml.sh script handles the extraction, handling and re-injection of the translations in the level files.

I invite the reviewer to review the commits one-by-one (instead of the final result) as the commits line can help to understand the mechanics.

Roughly:

* extraction of the translatable strings towards a level-specific XML file and a category-specific XHTML file;
* initial creation of the pot and po files using the XHTML files, once for all levels in the category;
* update of the pot and po files using the split XML files;
* po4a handles the XML-to-po-to-XML update mechanism: any update in a .po file is reflected in the XML file;
* back-injection of the translated strings from the XML to the level files.

The reason for using an XHTML file is that the combination of XML and po4a makes the latter choke on similar strings in different levels. I also started by using ini files, but they fail: http://bugs.debian.org/696997 so XML was the simplest and most robust transitional translation file I could use.

I am aware that it is quite a heavy infrastructure for few translation strings, but I think it can reveal to be quite robust when the need for additional translations will occur: it is quite easy to add them and translators can share the translation load by having relatively small and self-contained pofiles to work with.