Skip to content

CLI

The locize-cli and i18next-cli are open source command-line tools for managing translations in your projects and integrating with locize.

Note:

  • If you use i18next in your project, the i18next-cli offers a modern toolchain for extraction, linting, type generation, and direct Locize integration.
  • If you do not use i18next, you can use locize-cli directly. The locize-cli supports a wide range of translation file formats (such as JSON, YAML, XLIFF, CSV, PO, RESX, Fluent, Properties, and more), configurable via command line arguments. This makes it suitable for many frameworks and localization setups beyond i18next.

Main Features

locize-cli

  • Synchronize local translation files with Locize
  • Download translations from Locize
  • Migrate existing translation files to Locize
  • Add, remove, and get individual translation keys
  • Manage branches, versions, and namespaces
  • Supports many translation file formats (configurable via CLI)

i18next-cli (for i18next users)

  • One command from hardcoded strings to a fully localized app (localize): detect, instrument, extract, connect to Locize, AI-auto-translate, deliver — also available as a copy-paste prompt for AI coding agents (localize --print-agent-prompt)
  • Instrument hardcoded strings with t() calls (instrument)
  • Extract translation keys from your codebase
  • Generate TypeScript types for translation keys
  • Lint for hardcoded strings and i18n issues
  • Sync and check translation status
  • Plugin system for custom extraction (e.g., Svelte, Vue)
  • Direct integration with Locize (requires locize-cli installed)

Typical Usage

Install locize-cli globally:

npm install -g locize-cli

Sync translations:

locize sync --api-key <your-api-key> --project-id <your-project-id>

Missing languages are created automatically (locize-cli ≥ 12.3): a freshly created project needs no language setup in the UI — sync creates the languages found in your local files. Admin keys can always create languages; any write-capable key can while the project has no content yet.

Sync with automatic translation:

locize sync --api-key <your-api-key> --project-id <your-project-id> --auto-translate true

Sync with automatic translation arriving as review proposals:

locize sync --api-key <your-api-key> --project-id <your-project-id> --auto-translate true --auto-translate-review true

Sync target languages that go live right away but are marked as needing review (locize-cli 12.8.0 or newer):

locize sync --api-key <your-api-key> --project-id <your-project-id> --reference-language-only false --needs-review true

Sync only the keys changed on your git branch (e.g. a pull request's diff):

locize sync --api-key <your-api-key> --project-id <your-project-id> --auto-translate true --changed-only true

Diffs your local source-language files against the merge-base with the base branch (auto-detected via origin/HEAD, main, master, or set with --base <ref>) and restricts key additions, value updates and auto-translation to those keys; deletions are skipped. Keys are scoped per namespace file, and plural families travel together. Requires git and locize-cli ≥ 12.7; on shallow CI clones fetch the base branch (e.g. actions/checkout with fetch-depth: 0).

Work on a branch and merge it back (create, sync, merge):

locize create-branch featureXYZ --api-key <your-api-key> --project-id <your-project-id> --ver latest
locize sync --branch featureXYZ --api-key <your-api-key> --project-id <your-project-id> --update-values true
locize merge-branch featureXYZ --api-key <your-api-key> --project-id <your-project-id> --delete true

--project-id is always the main project; the branch is addressed by its name (or id). sync compares your files with the published content of the branch. A new branch takes over the publish settings of the main project version it is created from; if that version is in manual publish mode, publish the branch once (or enable auto publish for it) or add --unpublished true. Against an unpublished branch every local key looks new and deletions cannot be detected. Keys deleted locally are stored as delete markers in the branch, and merge-branch applies added, changed and deleted keys to the main project. The "Merge back" button in the UI copies the branch content into the editor instead and only deletes keys when its expert mode option is enabled; see versions or branches.

Download translations:

locize download --project-id <your-project-id> --language en --namespace common --path ./locales

Migrate existing files:

locize migrate --api-key <your-api-key> --project-id <your-project-id> --path ./en --language en

Localize an app in one command (i18next-cli ≥ 1.62):

npx i18next-cli localize

Detect → instrument → extract → connect Locize → AI auto-translate → deliver, in a single run. The launch post walks through the full flow, including --print-agent-prompt for AI coding agents.

Not sure what localize would find? The free i18n readiness check shows a public GitHub repository's hardcoded strings, framework, locale files and untranslated keys in the browser, before you run anything.

Extract keys with i18next-cli:

npx i18next-cli extract

Sync with Locize via i18next-cli:

npx i18next-cli locize-sync

Sync only your branch's changed keys via i18next-cli (i18next-cli ≥ 1.72):

npx i18next-cli locize-sync --changed-only

Learn More

For full details, advanced configuration, and all available commands, see the locize-cli README and i18next-cli README.


Video Demo

CLI instrument and migrate command example (with i18next-cli):

smart_display
YouTube Video
This video is hosted on YouTube. Accept YouTube cookies to watch it here.
Watch on YouTube

Watch the video | Read the guide

CLI migrate command example (with locize-cli):

smart_display
YouTube Video
This video is hosted on YouTube. Accept YouTube cookies to watch it here.
Watch on YouTube

Watch upload content demo | Showcase/demo