CLI Commands
translate-key
Translate a single key from a source locale into target locales. Supports LLM translation with --provider.
Synopsis
the-i18n-cli translate-key --layer <layer> --key <key> --sourceLocale <sourceLocale>
Flags
| Flag | Type | Required | Default | Description |
|---|---|---|---|---|
--layer | string | yes | — | Layer name |
--key | string | yes | — | Dot-separated translation key |
--sourceLocale | string | yes | — | Source locale code/language/file |
--sourceValue | string | no | — | Optional source value to write before translating |
--targets | string | no | — | Comma-separated target locales, or "all"/omitted for all except source |
--overwrite | boolean | no | true | Overwrite existing target translations (default true) |
--dryRun | boolean | no | false | Preview without writing or translating |
--includePreview | boolean | no | false | Include translated values in output |
--provider=<openai|anthropic|google> | string | no | — | LLM provider: "openai", "anthropic", or "google". Required for automatic translation. |
--model | string | no | — | Model name (required when --provider is set) |
--apiKey | string | no | — | API key (falls back to OPENAI_API_KEY / ANTHROPIC_API_KEY / GEMINI_API_KEY env). |
--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 providerBaseUrl in .i18n-mcp.json. Not supported by "google". |
Every command accepts the shared flags and sets one of the exit codes documented on the overview.