Skip to content

Latest commit

 

History

History
34 lines (22 loc) · 2.44 KB

I18N.md

File metadata and controls

34 lines (22 loc) · 2.44 KB

Internationalisation

The base language for Openclerk is English (NZ). With issue 152, Openclerk 0.22+ now supports multiple languages, and these translations can be crowd-sourced.

Openclerk uses two services for i18n:

  • Google Translate Toolkit, which provides a nice interface for automated translation using Google Translate.
  • Transifex, where anyone can submit translation fixes or new languages for the project, and is free for open source.

tests/LocaleTest generates locale/template.json and locale/template.txt, which serve as i18n templates.

Translation with Google Translate Toolkit

  1. locale/template.txt is uploaded to Toolkit and associated to each necessary language.
  2. Toolkit will automatically match previously translated strings using the Translation Memory (TM), otherwise new strings can be translated manually for each language.
  3. Once complete, the translated file is saved to locale/translated/locale_fr.txt.
  4. Running php -f convert-google.php translates the locale/translated/locale_fr.txt to locale/fr.php, and the strings are now available to Openclerk.
  5. This script will also generate locale/translate/locale_fr.json, which can be uploaded to Transifex to prepopulate the language there.

Translation with Transifex

  1. locale/template.json is uploaded to Transifex which automatically is associated to necessary languages.
  2. Users and administrators can view and edit the translations online.
  3. Once complete, the translated file is downloaded with "Download for use" and saved to locale/translated/for_use_openclerk_templatejson_fr.json.
  4. Running php -f convert.php translates this JSON file to locale/fr.php, and the strings are now available to Openclerk.

Using the translation framework

tests/LocaleTest will parse through the site and find all instances of t(), ht() and plural(), and add these to the template file. This means there is no need to manually track i18n strings separately. This also means that all translation strings are using English (NZ) as the base language.

Available locales are defined in get_all_locales().

In the future, the i18n framework will be moved into a separate project.