Prerequisities

  • Your Django app must be prepared for localization (see Django documentation)
  • The project must be in Lokalise (you will need the Project ID from project settings)
  • It must have a read/write API token (generate one under your Personal profile)
  • The Lokalise CLI tool must be installed

Uploading to Lokalise

Once your app is prepared for localization, it should contain source language (we assume it's English) locale directory. e.g. myapp/locale/en/LC_MESSAGES/default.po . Upload this file to Lokalise using CLI tool:

$ cd myapp
$ ./manage.py makemessages -l en
$ lokalise2 \
  --token <token> \
  --project-id <project_id> \
  file upload \
  --file "locale/en/LC_MESSAGES/default.po" \
  --lang-iso en

Downloading from Lokalise

When the translators are done you need to download the language files from Lokalise:

$ lokalise2 \
  --token <token> \
  --project-id <project_id> \
  file download \
  --format po \
  --filter-langs en \
  --original-filenames=true \
  --directory-prefix "" \
  --unzip-to "locale/en/LC_MESSAGES/"

You need to repeat the download for all project languages.

Did this answer your question?