clintbellanger/flare — Issue #196: Using po4a to extract strings from data files
Author: SBasalaev
Created: 2011-11-25 11:50:08+00:00
State: open

This is just a suggestion. You may or may not support this, I'll just describe pros and cons.

Recently I requested (see #190) if it is possible to modify xgettext.py include source references in data.pot. And now it comes to my mind that Flare data files use format similar to .ini files. And instead of supporting custom script existing solution could be used.

This solution is called *po4a* (PO for all) and among other formats it supports ini files. For example command
`po4a-gettextize -f ini -m quests/averguard_keep.txt`
will produce

```gettext
...
#: quests/averguard_keep.txt:13
#, no-wrap
msgid "Report to Guill in the Goblin Warrens."
msgstr ""

#: quests/averguard_keep.txt:18
#, no-wrap
msgid "Defeat Ukkonen in the Goblin Warrens."
msgstr ""
...
```
It will automatically generate header, remove duplicates and so on. So generally all you need is to feed it with list of data files.

Yes, this is yet another external dependency, but it is only used to generate pot file, it is not needed neither in building nor in translating.

The greatest objection to its using, however, is how it determines which strings to extract. From ini files po4a extracts all strings that are in form `id="string"`, i.e. quoted values. So it will require quoting all translatable strings and proper handling of this case in engine. On the other hand the whole approach with quotes may be simpler to use as instead of hardcoding which strings to translate in game you may use quote as signal to do this.