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 init

Creates:

  • .lokalio.yaml — translation configuration
  • .github/workflows/lokalio.yml — GitHub Actions workflow (or .gitlab-ci.yml for GitLab)

lokalio generate

Runs translation generation:

npx lokalio generate

Detects the commit range automatically in CI, applies the configured mode, and writes translations to target files.

Options:

FlagDescription
--mode <diff|add-remove>Override the mode from .lokalio.yaml
--base <branch>Explicit diff base branch for diff mode

How it Works

  1. Parse — reads source files matching the configured glob patterns
  2. Extract — pulls translatable strings, preserving placeholders
  3. Batch — chunks strings into batches of ~100 for the API
  4. Send — sends structured key-value pairs to the API with context
  5. Receive — gets translations back from the API
  6. Merge — writes translations into target files, preserving original formatting, comments, and key ordering
  7. 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)