Lokalise can be used with CakePHP.
Prerequisites
Your CakePHP app must be prepared for localization (see CakePHP documentation).
You'll need an existing Lokalise project. Specifically, you'll require the project ID that can be found in the project settings.
A read/write Lokalise API token is required. Learn how to work with the API tokens in the corresponding article.
The Lokalise CLI tool must be installed.
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.