Localization/internationalization/translation¶
How we organize the translations¶
All translations are added to django_cradmin/locale/
.
We do not add translation per app for the following reasons:
- There are lots of overlapping translation strings.
- Easier to upload and maintain a single translation catalog on Transifex.
Configure Transifex¶
Before you can start pushing and pulling translation files
to/from Transifex, you will need to create a ~/.transifexrc
. It
should look like this:
[https://www.transifex.com]
hostname = https://www.transifex.com
username = myuser
password = supersecret
token =
More information here: http://docs.transifex.com/developer/client/config.
Translation process¶
We translate using Transifex. This means that the workflow is:
- Mark new translations or change existing translations.
- Build the translation files (
.po
files). - Push translation files (
.po
files) to Transifex. - Wait for translators to translate using Transifex.
- Pull translation files (
.po
files) from Transifex. - Compile translations and commit the
.mo
files.
Below we go in detail for each of these steps. All commands assume the following:
$ cd /path/to/reporoot
$ workon django_cradmin
Mark new translations or change existing translations¶
Read the Django internationalization docs.
Build the translation files¶
First, make sure you have the latest po-files from transifex:
$ tx pull
We have a fabric task for that:
$ inv makemessages
Commit the changes to the .po
-files in django_cradmin/locale/
.
Compile translations and commit the .mo files¶
We have a fabric task for compiling the translations:
$ cd /path/to/reporoot
$ workon django_cradmin
$ inv compilemessages
This should change some .mo
-files in django_cradmin/locale/
.
Commit those files.