Item9697: Enhance i18n infrastructure to support translation of extensions.
Current State: Closed
Released In: 2.0.0
Target Release: major
For the moment, we have some good infrastructure to translate the core, but nothing easy to use to translate extensions.
User interface internationalisation
gives some guidelines on how to extend that.
Also, pootle seems to expect files to be in one directory per language, and not flat like we have.
Hence, my proposal (and I'd love feedbacks), is the following:
- For foswiki core we would split them in a directory per language:
core/locale/Foswiki.pot other suggestion
- For extensions, we would just add the locales in their directory:
- In SVN:
The changes to the core would be minimal, as Foswiki::I18N only needs to loop over all .po files inside
, instead of simply adding the
states that we could consider having configure merge the .po files together for performance. I
am not sure it's worth it, and I'd rather keep it split so it's easier to see and remove.
- 16 Sep 2010
I've added the checker to trunk to compile the .po file into a .mo file. Maybe they should be merged at compile time, creating a single .mo file for the collection of .po files for each language?
Does this one need a feature proposal?
- 16 Mar 2011
Following up the today's IRC
discussion I learned that pootle does not necessarily need all po files of one language in one directory; it can be configured both ways.
So actually the minimal change that possibly works is:
- leave all core po files where they are:
- let plugins have their translations in
Patch is here
Also, I've attached a changed
tool that can deal with plugins extracting strings.
There are a few things to bootstrap translation:
- generate the translation template file: in locale/<plugin-name>/Foswiki.pot:
- for each language that you want to translate:
msgmerge -o <foswiki-root>/trunk/<plugin-name>/locale/<plugin-name>/<language>.po \
Note that these steps will copy-paste the headers from the original core translations into the Foswiki.pot template.
You might want to change these to adjust them to the proper copyright and authorship for the plugin.
To upgrade a plugin's strings use:
msgmerge -U <foswiki-root>/trunk/<plugin-name>/locale/<plugin-name>/<language>.po \
- 09 Jan 2012