Internationalization¶
Pulling Translations From Transifex¶
First make sure you have the Transifex command-line client installed by python -m pip install transifex-client
or python -m pip install -r requirements_dev.txt
. For Pipenv users, it can also be installed by pipenv install --dev
.
Then use the pull
command to pull translations:
$ tx pull
Note
To create locale directories for newly created translations you will need to call tx pull
with the --all
flag.
Compiling Message Catalogs¶
This is required for Django to see the translations.
$ python manage.py compilemessages
Note
On Windows, you will need to install GNU’s gettext command. To do that you need to install gettext-iconv. During the installation, make sure to check “Add to PATH”.
Don’t forget to restart your terminal or software after the installation to take the changes into effect.
Extracting Messages to Translate¶
This will update the English language files with messages that appear in your code.
For the backend code and templates:
$ python manage.py makemessages -l en --extension=email,html,mjml,py,txt --ignore="templates/templated_email/compiled/*"
For JavaScript code:
$ python manage.py makemessages -l en -d djangojs --ignore="_build/*" --ignore="node_modules/*" --ignore="saleor/static/assets/*"