NOTE: If you are a developer, please use a private wiki based on foswiki/trunk on a daily base ...or use trunk.foswiki.org to view this page for some minimal testing.
Use Item9693 for docu changes for 1.2 and 2.0.

Item9697: Enhance i18n infrastructure

Priority: CurrentState: AppliesTo: Component: WaitingFor:
Enhancement Waiting for Release Engine Configure, I18N  
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:
    • Before: core/locale/de.po -- core/locale/Foswiki.pot
    • After: core/locale/de/core.po -- core/locale/core.pot
    • After: core/locale/de/Foswiki.po -- core/locale/Foswiki.pot other suggestion
  • For extensions, we would just add the locales in their directory:
    • In SVN: JQueryPlugin/locale/de/JQueryPlugin.po and JQueryPlugin/locale/JQueryPlugin.pot
    • Installed: .../locale/de/JQueryPlugin.po and .../locale/JQueryPlugin.pot

The changes to the core would be minimal, as Foswiki::I18N only needs to loop over all .po files inside locale/$lang, instead of simply adding the locale/$lang.po for language $lang.

ALERT! MichaelDaum 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.

-- OlivierRaginel - 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?

-- GeorgeClark - 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: locale/<language>.po
  • let plugins have their translations in locale/<plugin>/<language>.po

Patch is here.

Also, I've attached a changed xgettext tool that can deal with plugins extracting strings.

There are a few things to bootstrap translation:

  1. generate the translation template file: in locale/<plugin-name>/Foswiki.pot:
    mkdir <foswiki-root>/trunk/<plugin-name>/locale/<plugin-name>
    <foswiki-root>/tools/xgettext-plugin <plugin-name>
         
  2. for each language that you want to translate:
    msgmerge -o <foswiki-root>/trunk/<plugin-name>/locale/<plugin-name>/<language>.po \
                <foswiki-root>/trunk/core/locale/<language>.po \
                <foswiki-root>/trunk/<plugin-name>/locale/<plugin-name>/Foswiki.pot
         

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 \
            <foswiki-root>/trunk/<plugin-name>/locale/Foswiki.pot

-- MichaelDaum - 09 Jan 2012
 

ItemTemplate edit

Summary Enhance i18n infrastructure
ReportedBy OlivierRaginel
Codebase
SVN Range
AppliesTo Engine
Component Configure, I18N
Priority Enhancement
CurrentState Waiting for Release
WaitingFor
Checkins Foswikirev:14959
TargetRelease major
ReleasedIn 1.2.0
CheckinsOnBranches trunk
trunkCheckins Foswikirev:14959
Release01x01Checkins
Topic attachments
I Attachment Action Size Date Who Comment
xgettext-pluginEXT xgettext-plugin manage 3.7 K 09 Jan 2012 - 14:44 MichaelDaum  
Topic revision: r6 - 22 Oct 2012, MichaelDaum
 
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. see CopyrightStatement. Creative Commons LicenseGet Foswiki at sourceforge.net. Fast, secure and Free Open Source software downloads