Skip to main content
CakePHP

Localizing with CakePHP's built-in i18n support.

Nick Ustinov avatar
Written by Nick Ustinov
Updated over 8 months ago

Lokalise can be used with CakePHP.

Prerequisites

Uploading to Lokalise

Once your app is prepared for localization, it should contain the source language (here we assume it's English) in the locale directory, for example myapp/locale/en/LC_MESSAGES/default.po.

Upload the default.po file to Lokalise using the 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 translations are done, you'll 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/"

Run a similar command for all other project languages.

Did this answer your question?