Setting up the infrastructure

First, make your project's file type decision (see Localization Formats for details):

  • HTML/PHP
  • .lang
  • gettext (.po)

Assuming you chose gettext, you'll need to follow the steps below to set up the infrastructure for localizing your web application. 

Requirements: PHP with gettext support, Apache and some Unix experience.

  1. Create a new branch for l10n (optional if starting a new project).
  2. Create a locale directory in your website (usually something like DOCROOT/locale).
  3. Copy the shell scripts from /addons/trunk/site/app/locale/ to your locale directory:
    1. extract-po.sh will be used to extract all English strings from your application's directories specified in SOURCE_DIRS, merge the resulting template (*.pot) file with the existing (already containing translations) messages.po files for each locale (if they exist) and merge the new messages.po files to messages.mo files. By default the script looks for gettext calls in *thtml or *.php files, so you may need to adjust that to your code.
    2. compile-mo.sh will only compile all locales' messages.po files to message.mo files. This is useful when a localizer submits a new version of the messages.po file. On the staging server you can also choose to set up a cronjob that will run compile-mo.sh every n minutes. This way the localizers will be able to preview their changes almost in real-time.
    3. stats-po.sh will give you a bird's-eye view on the statistics of translated, fuzzy and missing strings for each locale.
  4. Create en-US locale (locale/en-US/LC_MESSAGES/) in the locale folder.
  5. Create an empty filed named messages.po in the locale/en-US/LC_MESSAGES folder.
  6. Create new locales by repeating steps 4 and 5 for each of them.
  7. Review the English content following the web content localizability guidelines.
  8. Review your code following the web applications localizability guidelines.
  9. Run extract-po.sh.
  10. Restart Apache to reload gettext files (necessary for any text changes).
  11. Merge the l10n branch back to main trunk (if the l10n branch was created in step 1).
  12. Copy files over to SVN.
  13. Set up the staging server.
    1. Set up a cronjob to svn up every n minutes.
    2. Set up a cronjob to run compile-mo.sh every m minutes.
  14. QA with new locale.
  15. Fix any layout issues.

Document Tags and Contributors

Contributors to this page: stasm
Last updated by: stasm,