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.
- Create a new branch for l10n (optional if starting a new project).
- Create a locale directory in your website (usually something like
DOCROOT/locale
). - Copy the shell scripts from /addons/trunk/site/app/locale/ to your locale directory:
- 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 newmessages.po
files tomessages.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. - 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. - stats-po.sh will give you a bird's-eye view on the statistics of translated, fuzzy and missing strings for each locale.
- extract-po.sh will be used to extract all English strings from your application's directories specified in
- Create en-US locale (
locale/en-US/LC_MESSAGES/
) in thelocale
folder. - Create an empty filed named
messages.po
in thelocale/en-US/LC_MESSAGES
folder. - Create new locales by repeating steps 4 and 5 for each of them.
- Review the English content following the web content localizability guidelines.
- Review your code following the web applications localizability guidelines.
- Run
extract-po.sh
. - Restart Apache to reload gettext files (necessary for any text changes).
- Merge the l10n branch back to main trunk (if the l10n branch was created in step 1).
- Copy files over to SVN.
- Set up the staging server.
- Set up a cronjob to
svn up
every n minutes. - Set up a cronjob to run
compile-mo.sh
every m minutes.
- Set up a cronjob to
- QA with new locale.
- Fix any layout issues.