inlang
inlang CLI

inlang CLI

工具
打开

Find missing translations, wrong variables and unused messages, and fill missing translations with machine translation. Fail your CI when a translation is broken.

npx @inlang/cli check --project ./project.inlang

Machine translate missing messages with General Translation, the recommended provider. The first run signs you in; signing up is free:

npx @inlang/cli machine translate --project ./project.inlang

Coding agents run the same command. If the project hasn't chosen a provider, it stops and lists the options for the agent to ask the user about. For CI, see machine translate.

Read the announcement: inlang check: find missing translations and unused keys in CI.

inlang CLI terminal showing machine translate and check commands

Features

  • Machine Translation — Translate missing messages with General Translation, the recommended provider, or bring your own key
  • Checks — Find missing translations, missing variables and unused messages before they ship. Exits with 1 on findings, so CI fails. See check
  • CI/CD Ready — Run non-interactively in pipelines
  • Plugin System — Supports JSON, i18next, next-intl, ICU message format, and more

Getting Started

The CLI requires an inlang project — a folder containing a settings.json that defines your locales and translation file paths.

my-app/
├── project.inlang/
│   └── settings.json      # CLI reads this config
├── messages/
│   ├── en.json            # Source language
│   └── de.json            # Translations
└── src/

Setup in 2 minutes

1. Create the project folder and settings file

mkdir project.inlang

Create project.inlang/settings.json:

{
  "$schema": "https://inlang.com/schema/project-settings",
  "baseLocale": "en",
  "locales": ["en", "de", "fr"],
  "modules": [
    "https://cdn.jsdelivr.net/npm/@inlang/plugin-json@latest/dist/index.js"
  ],
  "plugin.inlang.json": {
    "pathPattern": "./messages/{locale}.json"
  }
}

2. Create your base translation file

Create messages/en.json:

{
  "greeting": "Hello {name}!",
  "welcome": "Welcome to our app"
}

3. Machine translate to other languages

npx @inlang/cli machine translate --project ./project.inlang

In a terminal, the first run asks which translation provider the project should use: General Translation (recommended; signing up is free), the community translation service, or Other. For CI, coding agents and your own translation API key, see machine translate.

This creates messages/de.json and messages/fr.json with translations.

4. Check your translations

npx @inlang/cli check --project ./project.inlang

Installation

Install with package manager

You can install the @inlang/cli with this command:

npm install -D @inlang/cli

or

yarn add --dev @inlang/cli

best

npx @inlang/cli [command]

Minimum requirements

Minimum node version: v20.3.0

If one of the commands can't be found, you probably use an outdated CLI version. You can always get the latest version by running npx @inlang/cli@latest [command].

Commands

NameCommandDescription
CLI Versionnpx @inlang/cli@latest [command]Get the latest version of the inlang CLI.
Checknpx @inlang/cli check [options]Check translations for missing, empty or inconsistent messages, and source code for unused messages. Exits with 1 on findings, for CI.
Machinenpx @inlang/cli machine translate [options]Automate translation processes. Options include --project <path> and --targetLocales <targets...>
Cloudnpx @inlang/cli cloudSee what's coming in inlang Cloud and tell us what your team needs.
Pluginnpx @inlang/cli plugin [command]Interact with Inlang plugins, including initialization and building. build [options] build an inlang module. Options include --type, --entry, and --outdir.

Usage

We recommend using the CLI with npx to avoid installing the CLI globally. Not installing the CLI globally has the following advantages:

  • the installed CLI version is scoped to the project, ensuring it always works.
  • the CLI gets installed for team members, avoiding "why is this command not working for me" questions.

npx is auto-installed with Node and NPM.

If one of the commands can't be found, you probably use an outdated CLI version. You can always get the latest version by running npx @inlang/cli@latest [command].

Usage: inlang [options] [command]

CLI for inlang.

Options:
  -V, --version      output the version number
  -h, --help         display help for command

Commands:
  check [options]    Check translations for missing, empty or inconsistent
                     messages, and source code for unused messages.
  machine [command]  Commands for automating translations.
  plugin [command]   Commands for inlang plugins.
  cloud [options]    See what's coming in inlang Cloud and tell us what you
                     need.
  help [command]     display help for command

Coming soon: hosted AI translation and handoff between design, translation and code. Run `inlang cloud`.

The following commands are available with the inlang CLI:

machine

The machine command is used to automate localization processes.

machine translate

The translate command machine translates all resources.

For many projects, coding agents can produce better translation drafts than generic machine translation because they can use surrounding product and code context. Consider using an agent-driven workflow when translation quality matters more than fully automated CI output.

To initiate machine translation, run the following command:

npx @inlang/cli machine translate --project ./project.inlang

Options

The translate command has the following options:

  • --project <path>: Path to the inlang project (required).
  • --locale <source>: Has no effect. The source locale is always the project's baseLocale in settings.json.
  • --targetLocales <targets...>: Specifies the target locales as comma seperated list (e.g. sk,zh,pt-BR).
  • --no-browser: Signs in to General Translation with a code you enter in any browser, instead of opening a browser on this machine. Works outside a terminal too, as for coding agents.
  • --no-update-changed: Only adds missing translations, and doesn't translate again the translations whose source message changed. See "Changed source messages" below.

General Translation

General Translation is the recommended provider. The first time you run the command in a terminal, it asks which translation provider the project should use: General Translation (recommended), the community translation service, or Other. A project that already chose General Translation (see below) skips the question and signs you in. If you choose General Translation, it signs you in, opening General Translation in your browser if you aren't signed in yet; signing up is free. A sign-in to the gt CLI on the same machine counts too. Where no browser can be shown, as over SSH, in a container or on Linux without a display, it shows a sign-in code to enter in any browser instead; --no-browser does the same anywhere. Unless the project names one, it asks which of your General Translation projects to use, or creates a new one, asking which organization should own it if you have several. The CLI saves a development API key, which can only translate, to .env.local next to project.inlang and adds .env.local to .gitignore unless git already ignores it. It also saves the project ID to gt.config.json; commit that file so teammates who sign in use the same project instead of creating their own.

If you choose the community translation service, the command uses the community-operated translation service at translate.demosjarco.dev (not affiliated with inlang), the previous default. It saves that choice as INLANG_MACHINE_TRANSLATE_PROVIDER=demosjarco in .env.local, so later runs don't ask; remove that line to be asked again. In CI, set the same variable to choose that service explicitly.

If you choose Other, the command links to the BYOK setup guide and saves nothing: once another provider is set up, later runs use it without asking.

Later runs read the key from the environment, or else from .env.local (or .env) next to project.inlang. Sign-in saves GT_DEV_API_KEY and GT_PROJECT_ID. GT_API_KEY works too, and so do framework-prefixed names such as VITE_GT_DEV_API_KEY and VITE_GT_PROJECT_ID.

SSH and other terminals without a display show the same provider choices, and sign in with a code. Without a terminal, as in CI, or through a task runner that captures the output, the command doesn't ask. Without a key, it uses the community-operated service, as before, and links to GT setup. Under a coding agent (Claude Code, Cursor, Codex or Gemini CLI), it fails instead, also in a terminal or with --no-browser, and prints the choices for the agent to put to the user: General Translation, by running again with --provider gt --no-browser; the community service, by adding INLANG_MACHINE_TRANSLATE_PROVIDER=demosjarco to .env.local; or your own key. A project that chose General Translation, with a project ID in gt.config.json or GT_PROJECT_ID, with --provider gt, or with INLANG_MACHINE_TRANSLATE_PROVIDER=gt, fails instead and prints the steps to get a key, so a missing CI secret doesn't send its text to another service. If you are signed in to General Translation on that machine, it saves a development key instead, without asking. Without a project ID, it creates a project only if your account has none yet and one organization. Otherwise it lists your projects with their IDs, or, without projects, your organizations to create one in, and asks you to run it again with GT_PROJECT_ID set to the project's ID, or in a terminal to choose. In CI, set GT_API_KEY and GT_PROJECT_ID from your project at dash.generaltranslation.com. Once the project chose General Translation, coding agents can run the command with --no-browser: it prints a sign-in URL and code for a person to open, waits until they sign in, then saves a development key and translates.

To commit the project's provider choice, pass --provider in the script that runs the command, for example in package.json:

{
  "scripts": {
    "machine-translate": "inlang machine translate --provider gt --project ./project.inlang"
  }
}

--provider takes the same values as INLANG_MACHINE_TRANSLATE_PROVIDER (gt, google, deepl, openai or demosjarco) and works the same in every shell, including Windows. INLANG_MACHINE_TRANSLATE_PROVIDER in the shell overrides it for one machine, and it overrides the setting in .env.local and .env. With --provider gt, a run in CI without a General Translation key fails instead of using the community service.

Bring your own key

To use your own translation API key instead, see the BYOK setup guide.

What gets translated

When a bundle has a description, providers that support context, including General Translation, receive it as translation context. Descriptions are preserved in the project and are never included in translated strings.

With a provider that supports context, a plural gets every form the target language needs: an English message with one and other gets one, few, many and other in Russian. With a provider without context, such a plural gets the source's forms, as before, and the forms it lacks stay missing until they are added. Whether those numbers fall back to another form depends on the message format: i18next, for example, shows the message key. The command lists these plurals by locale when it finishes, even if it fails, leaving out messages it didn't create, so you can add the forms by hand, or translate them with a provider that supports context. A translation whose selectors differ from the source's is listed and left as it is. A translation with a select value the source lacks, such as a hand-written neuter, gets the source's forms and is listed: no form can be translated for that value, and added forms would take its numbers.

The requests of all locales share the provider's request slots, and the command writes the translation files as each locale finishes, so a run that is stopped or times out keeps the locales it finished. If one translation fails, the command continues with unrelated messages and other locales. A rate-limited request (HTTP 429, or Google's per-minute quota error) is sent again up to 3 times, after the provider's Retry-After or 2, 4 and 8 seconds, waiting at most a minute in total; other failures aren't retried. If the provider is unavailable, rejects the key or keeps throttling requests, the command starts no more requests. In either case, it saves successful translations and exits with code 1; run it again to translate the rest. Ctrl+C or SIGTERM also stops new requests: the command waits for the requests in flight, saves what came back and exits with code 1. Press Ctrl+C again to quit at once without saving them. A new message, or one without forms, gets a language only when all its forms succeed, and then gets the source's selectors.

A translation that comes back empty, drops, adds or changes a variable or markup tag, or breaks markup nesting isn't saved. Fixed-count plural forms can spell out the count instead of repeating its variable, as in “one item” or “two items”; other variables and formatting still have to match. The command lists rejected translations, saves the other messages and exits with code 1. General Translation requests time out after 5 minutes.

Changed source messages

When a source message changes, the command translates it again in every locale. To tell which translations are outdated, it records what each translation was made from in project.translations.lock.json next to project.inlang: a hash of the source message and of the translation. Commit that file. The first run records the existing translations as they are, so an existing project needs no setup step, and translations that were already outdated then aren't detected: delete them to have them translated again.

A translation edited by hand after it was translated is never overwritten. When its source message changes, the command lists it once and keeps it; delete it to have it translated again. Translations that existed before the first run count as translated, so they are translated again when their source changes. To only add missing translations, run with --no-update-changed. If the lock file can't be read, for example after a merge conflict, the command says so, leaves it as it is and translates nothing again.

check

Checks the project's translations and, for Paraglide JS, i18next and next-intl projects, finds messages the source code no longer uses.

npx @inlang/cli check --project ./project.inlang
Checked project.inlang · 7 messages · locales en-US, pt-BR · 2 source files in ./

missing-translation (1)
  welcome_back  pt-BR  no translation

missing-variable (2)
  cart_items  pt-BR  missing {count} (countPlural=other)
  greeting    pt-BR  missing {name}

unused-message incomplete: unused messages can't be determined because:
  src/Field.tsx:14:8  m[`${fieldName}_label`]  Dynamic message access cannot be resolved.
  Unused messages are only reported when every usage can be resolved, e.g. m.some_key() or t("some.key").

3 findings
  missing-translation  1
  missing-variable     2

Checks

All checks run by default. Pass one or more check flags to run only those:

FlagReports
--missing-translationsmessages without a translation for a locale
--empty-translationstranslations whose every form is empty
--empty-variantsempty forms in an otherwise non-empty translation
--missing-variablesvariables of the base locale a translation lacks
--unknown-variablesvariables the base locale doesn't use, e.g. typos
--missing-markupmarkup of the base locale a translation lacks
--missing-variantsplural or select forms a locale needs but lacks
--missing-selectorstranslations that can't choose by an input the base locale chooses by
--unused-messagesmessages the source code doesn't use (needs a usage-analysis plugin)

The project's settings and plugin errors are always reported.

What works with which library

Checki18nextnext-intlParaglide JSJSON, ICU and other plugins
Missing and empty translations, variables, plural formsyesyesyesyes
Unused messages (--unused-messages)yesyesyesno

Unused messages need a plugin that can read your source code. See Unused messages.

Coming from validate or lint?

inlang validate and inlang lint are deprecated and hidden from --help. Use inlang check instead.

  • validate only reported settings and plugin errors. check reports those too, plus translation problems and unused messages.
  • lint has done nothing since CLI v3, because the v1 lint rules were removed in the v2 rewrite. It still exits with 0, so old scripts do not break. check replaces it.

Replace the command in your CI:

- npx @inlang/cli lint --project ./project.inlang
+ npx @inlang/cli check --project ./project.inlang

check exits with 1 on findings. Add --no-fail to keep the old behavior while you fix them.

Check options

  • --project <path>: Path to the inlang project.
  • --locales <locales...>: Only report findings for these locales, comma or space separated, e.g. --locales de,fr. Findings that don't belong to a locale, such as unused messages, are always reported.
  • --source <paths...>: Files or directories to search for message usages. Defaults to the project's parent directory. In a git repository, directories are read without git-ignored files; outside of one, without dot directories and a top-level dist, build and coverage. node_modules, *.inlang projects, Paraglide's compiled output, dotfiles and known build tool configs (vite.config.ts, tailwind.config.cjs, …) are always skipped; symlinked directories are followed. Files passed explicitly are always read.
  • --format <text|json>: json prints the full report for CI and editors: every finding, the status of each check and the location of each usage that couldn't be analyzed (1-based lines, 0-based columns). The report has a version; findings are identified by bundleId, locale and, for a form, matches.
  • --no-fail: Exit with 0 even if there are findings.

Check examples

Fail CI on findings in the locales you ship:

npx @inlang/cli check --project ./project.inlang --locales de,fr
# .github/workflows/i18n.yml
name: i18n
on: pull_request
jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 22
      - run: npx @inlang/cli check --project ./project.inlang --locales de,fr

Find unused messages in src only:

npx @inlang/cli check --project ./project.inlang --unused-messages --source ./src
Checked project.inlang · 7 messages · locales en-US, pt-BR · 12 source files in src

unused-message (2)
  legacy_banner
  password_label

2 findings
  unused-message  2

Run only some checks without failing, for a report:

npx @inlang/cli check --project ./project.inlang --missing-translations --missing-variables --no-fail

Write a JSON report for other tools, e.g. the number of missing translations per locale with jq:

npx @inlang/cli check --project ./project.inlang --format json > inlang-check.json
jq '[.diagnostics[] | select(.checkId == "missing-translation") | .locale] | group_by(.) | map({(.[0]): length}) | add' inlang-check.json

Exit codes

Exit codeWhen
0No findings and no project errors, or --no-fail was passed.
1Findings or project errors; an invalid option such as an unknown locale; the project can't be opened.

check exits with 1 when it reports findings or project errors, and with 0 otherwise. A check that couldn't run or couldn't complete, such as unused messages with dynamic keys, is reported but doesn't fail the command.

Unused messages

Unused messages need the source code and a plugin that analyzes message usages:

  • @inlang/plugin-m-function-matcher 2.3.0 or later for Paraglide's m.message_key().
  • @inlang/plugin-i18next 6.5.0 or later for i18next's t("key") from useTranslation, getFixedT and i18next.t, and <Trans i18nKey="key">, in .ts, .tsx, .js, .jsx and .mjs files. Namespaces, plurals, context and keys written as constants (t(KEYS.title)) are resolved. Dynamic keys, keyPrefix, returnObjects, fallbackNS, custom separators, translation files read directly and Vue, Svelte, Astro and CommonJS files that use i18next make the analysis incomplete.
  • @inlang/plugin-next-intl 2.4.0 or later for next-intl's useTranslations("Home") and getTranslations("Home") with t("title"), t.rich() and t.markup(), in .ts, .tsx, .js, .jsx and .mdx files.

With an older version, check asks you to update the module URL in settings.json.

A message is only reported as unused when every usage in the analyzed source could be resolved. Dynamic keys such as m[`${fieldName}_label`](), m[key](), t(`items.${id}`) or t(key), a translator passed to another function or component, useMessages() read directly, t.raw() of a namespace or keyof typeof m make the analysis incomplete; check then lists where they are instead of reporting unused messages. "Unused" means not used in the analyzed source: messages used by other repositories or code outside --source can still be reported.

JSON output

--format json prints only the report on stdout:

{
  "version": 1,
  "project": "project.inlang",
  "locales": ["pt-BR"],
  "baseLocale": "en-US",
  "messages": 7,
  "source": { "roots": ["./"], "files": 1 },
  "errors": [],
  "checks": [
    { "id": "missing-variable", "status": "complete" },
    { "id": "unused-message", "status": "complete" }
  ],
  "diagnostics": [
    {
      "checkId": "missing-variable",
      "bundleId": "cart_items",
      "locale": "pt-BR",
      "name": "count",
      "matches": [
        { "key": "countPlural", "type": "literal-match", "value": "other" }
      ],
      "message": "Message \"cart_items\" is missing {count} in \"pt-BR\"."
    },
    {
      "checkId": "unused-message",
      "bundleId": "legacy_banner",
      "message": "Message \"legacy_banner\" has no detected usage in the supplied source snapshot."
    }
  ],
  "summary": {
    "findings": 2,
    "errors": 0,
    "byCheck": { "missing-variable": 1, "unused-message": 1 }
  }
}
  • version: the version of the report's shape.
  • errors: the project's settings and plugin errors (name, message).
  • checks: the status of each check that ran: complete, incomplete or unavailable, with a reason. An incomplete unused-message check lists issues with path, start, end and the code there (1-based lines, 0-based columns).
  • diagnostics: findings, identified by checkId, bundleId, locale and, for a form, matches; the other fields depend on the check (name of a variable or markup, suggestion, values).
  • summary: the number of findings, project errors and findings per check.

cloud

inlang Cloud is coming: hosted services on top of your inlang project, as Parrot and Fink show them.

  • Automatic handoff between designers, developers, and translators through a CLI, REST API, or your CI.
  • AI translation that fills in every missing language at once.
  • Your terminology and tone: product names stay as they are and your style guide is followed.
  • Translations that fit the design: knows buttons from headings and keeps text within its space.
  • Smart message keys like checkout.continue_button, generated for you.
npx @inlang/cli cloud

cloud lists these features and opens a short form where you can tell us what your team needs. For Paraglide JS projects, the form has Paraglide JS pre-selected.

Cloud options

  • --project <path>: Path to the inlang project, used to tell which product you use (default ./project.inlang).
  • --no-open: Print the form's URL instead of opening the browser. The browser is never opened in CI, when the output is piped, or on Linux without a display.
  • --json: Print the features and the form's URL as JSON.

Deprecated commands

validate

inlang validate --project ./project.inlang is deprecated: use inlang check. It still works, is hidden from --help, prints a deprecation warning and, as before, only reports the project's settings and plugin errors, exiting with 1 if there are any.

lint

inlang lint is deprecated: use inlang check. It is hidden from --help, prints a deprecation warning and does nothing else; it exits with 0.

plugin

The plugin command is used to interact with the Inlang module. It allows to initialize a new module or run the modules build commands.

plugin build

If you are developing an inlang module, the plugin build command builds your Inlang module for development & in production.

To build a plugin, run the following command:

npx @inlang/cli plugin build --entry ./path/to/index.ts --outdir ./path/to/dist

Options

--entry <entry>: Specifies the path to the module's entry point, typically src/index.js or src/index.ts. --outdir <path>: Specifies the output directory for the build files. The default output directory is "./dist." --watch: An optional flag that, when provided, enables a watch mode to monitor for changes and automatically rebuild the module when changes are detected.

See how there is also a --watch flag, which enables a watch mode to monitor for changes and automatically rebuild the module when changes are detected. This command runs with esbuild under the hood. -->

Telemetry

The CLI collects no telemetry or error reports.

Troubleshoot

If something isn't working as expected or you are getting errors, make sure to run on the latest version of the CLI. You can always get the latest version by executing npx @inlang/cli@latest.

If the error persists, please create an issue – we're happy to help.