Skip to content

CLI

@openlocale/cli installs an openlocale binary for pushing and pulling translation files — built for CI pipelines and local workflows.

sh
npm install -g @openlocale/cli

Configuration

Flags win over openlocale.config.json (created by init), which wins over environment variables.

sh
openlocale init --endpoint https://locale.example.com --project demo
export OPENLOCALE_TOKEN=olp_…     # keep tokens out of the config file
SourceKeys
flags--endpoint, --project, --token
openlocale.config.jsonendpoint, project, token
environmentOPENLOCALE_ENDPOINT, OPENLOCALE_TOKEN

openlocale pull

Download translation files.

sh
openlocale pull --locale all --format json-nested --out ./locales
openlocale pull --locale de --format po --out ./po
FlagDefault
--localeallone locale or all enabled locales
--formatjson-nestedany format id
--namespacedefault
--out./localesone file per locale, named <locale><ext>

openlocale push

Upload a file (analyze + commit).

sh
openlocale push ./locales/en.json --locale en
openlocale push ./ios/Localizable.strings --locale en   # format guessed from filename
openlocale push ./locales/en.json --locale en --dry-run
FlagDefault
--locale(required)locale the file contains
--formatguessedpass explicitly for ambiguous extensions
--namespacedefault
--dry-runoffanalyze only — see below

Output reports the analysis (N new, N changed, N unchanged), parser warnings, and any duplicate suggestions before committing.

--dry-run as a CI gate

With --dry-run, nothing is committed. The command prints the analysis and exits 2 if duplicate suggestions were found, so you can fail a pull request that introduces already-existing strings:

yaml
# GitHub Actions
- run: npx @openlocale/cli push ./locales/en.json --locale en --dry-run
  env:
    OPENLOCALE_ENDPOINT: https://locale.example.com
    OPENLOCALE_TOKEN: ${{ secrets.OPENLOCALE_TOKEN }}
Exit codeMeaning
0success (dry-run: no duplicates)
1error (auth, network, parse)
2dry-run found duplicate suggestions

MIT licensed core. AI features unlock with a license key.