CLI Commands
translate-key
Add or update one source translation key and translate it into the target locales.
Synopsis
the-i18n-cli translate-key --layer <layer> --key <key> --sourceLocale <sourceLocale>
Flags
| Flag | Type | Required | Default | Description |
|---|---|---|---|---|
--layer | string | yes | — | Layer holding the key, from discover (e.g., "root", "app-admin"). |
--key | string | yes | — | Dot-separated key path to translate. Example: "bookingCreator.options.removeSubResource". |
--sourceLocale | string | yes | — | Source locale ref. May be a code ("en-us"), a language ("en-US") or a file ("en-US.json"). |
--sourceValue | string | no | — | Source value to write before translating. If omitted, the existing source value is read. |
--targetLocales, --targets | string | no | — | Locales to translate into. Pass "all", or omit, for every locale except the source. Comma-separated, or "all". |
--overwrite | boolean | no | true | Overwrite existing target translations. When false, only missing targets are filled. Default: true. |
--dryRun | boolean | no | false | Report the source and target locales without writing files or calling the translation backend. Default: false. |
--includePreview | boolean | no | false | Include the translated values in the result. Default: false, which keeps the response compact. |
--provider=<openai|anthropic|google> | string | no | — | LLM provider to translate through. Without one nothing is translated automatically — the result carries the contexts to translate by hand instead. |
--model | string | no | — | Model name. Required whenever a provider is set. |
--apiKey | string | no | — | API key. Falls back to the OPENAI_API_KEY / ANTHROPIC_API_KEY / GEMINI_API_KEY environment variables. |
--baseUrl | string | no | — | Provider base URL for gateways, self-hosted models and proxies speaking the provider's protocol. Falls back to I18N_BASE_URL, then to providerBaseUrl in .i18n-mcp.json. |