Write Translations
write_translationsWrite translation key-value pairs to a specified layer. Supports upsert, add, or update modes, and dry-run for preview.
Instructions
Write translation key-value pairs to a layer. Mode "upsert" adds new keys and updates existing ones (default, most common). Mode "add" only creates new keys, skipping existing ones. Mode "update" only modifies existing keys, skipping missing ones. Keys are inserted in alphabetical order. Use dryRun to preview without writing.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| layer | Yes | Layer name (e.g., "root", "app-admin"). Discover layers via the discover tool. | |
| translations | Yes | Map of dot-path keys to locale-value pairs. IMPORTANT: values must be locale maps, NOT plain strings. Locale refs may be code ("en-us"), language ("en-US"), or file ("en-US.json"). Wrong: { "auth.failed": "Login failed" }. Correct: { "auth.failed": { "en-US": "Login failed", "de-DE": "Anmeldung fehlgeschlagen" } } | |
| mode | No | Write mode. "upsert": add-or-update (never fails). "add": only new keys. "update": only existing keys. Default: "upsert". | |
| dryRun | No | When true, returns a preview of what would be written without writing any files. Default: false. | |
| projectDir | No | Absolute path to the Nuxt project root. Defaults to server cwd. Example: "/home/user/my-app". |