CLI Reference
The Lokalio CLI (lokalio) is the client-side tool that parses translation files, sends strings to the API, and merges returned translations back into target files.
Commands
lokalio init
Scaffolds configuration files interactively:
npx lokalio initCreates:
.lokalio.yaml— translation configuration.github/workflows/lokalio.yml— GitHub Actions workflow (or.gitlab-ci.ymlfor GitLab)
lokalio generate
Runs translation generation:
npx lokalio generateDetects the commit range automatically in CI, applies the configured mode, and writes translations to target files.
Options:
| Flag | Description |
|---|---|
--mode <diff|add-remove> | Override the mode from .lokalio.yaml |
--base <branch> | Explicit diff base branch for diff mode |
How it Works
- Parse — reads source files matching the configured glob patterns
- Extract — pulls translatable strings, preserving placeholders
- Batch — chunks strings into batches of ~100 for the API
- Send — sends structured key-value pairs to the API with context
- Receive — gets translations back from the API
- Merge — writes translations into target files, preserving original formatting, comments, and key ordering
- Commit & PR — commits changes as
lokalio[bot]with[skip ci], force-pushes to the translation branch, and opens or updates a pull request (CI only)