Prerequisites
- Your Node.js app must be prepared for localization (see Node.js i18n docs)
- Project in Lokalise (you will need Project ID from project settings)
- Read/write API token (generate one under your Personal profile)
- Installed Lokalise CLI tool
- To run Lokalise CLI tool from NodeJS, you will need to use the child_process.execFile API.
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:
$ lokalise2 \
--token <token> \
--project-id <project_id> \
file upload \
--file "myapp/locales/en.json" \
--lang-iso en
Downloading from Lokalise
As the translators are done you need to download the language files from Lokalise:
$ lokalise2 \
--token <token> \
--project-id <project_id> \
file download \
--format json \
--original-filenames=false \
--bundle-structure "%LANG_ISO%.json" \
--unzip-to "myapp/locales/"