> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nt3.io/llms.txt
> Use this file to discover all available pages before exploring further.

# nt3 translate

> Trigger AI translation for pending keys.

Translate untranslated keys using AI. The command processes keys in batches with real-time progress streaming and skips keys that already have translations.

## Usage

```bash theme={null}
nt3 translate [lang] [options]
# alias: nt3 tr
```

## Examples

```bash theme={null}
# Translate to a single language (positional argument)
nt3 translate fr

# Translate using the flag form
nt3 translate -l nl

# Translate all target languages
nt3 translate --all

# Use a specific AI provider
nt3 translate --all --provider anthropic

# JSON output for CI/CD
nt3 translate --all --json
```

## Options

| Flag                    | Description                                                   |
| ----------------------- | ------------------------------------------------------------- |
| `-a, --all`             | Translate all target languages configured in the project      |
| `-l, --language <lang>` | Target language code (alternative to the positional argument) |
| `--provider <provider>` | AI provider override: `anthropic` or `openai`                 |
| `--json`                | Output results as JSON                                        |

## How it works

`nt3 translate` calls the Entri batch translation API, which uses AI to translate untranslated keys in your project. The process:

1. Fetches the list of untranslated keys for the target language
2. Groups them into batches (up to 200 keys per batch)
3. Streams progress back to the terminal in real time
4. Repeats until all untranslated keys are processed

Already-translated keys are skipped automatically — running the command multiple times is safe.

## AI settings

The AI translator uses your project's configured settings from the Entri dashboard:

* **Tone instruction** — e.g., "Use formal language" or "Keep it conversational"
* **Style instruction** — e.g., "Match the iOS Human Interface Guidelines tone"
* **Additional context** — Any product-specific context that helps the AI translate accurately

Configure these in the Entri dashboard under **Project Settings > AI Translation**.

## Provider selection

Entri supports two AI providers out of the box:

* **Anthropic** (Claude Sonnet) — default if configured in your project
* **OpenAI** (GPT-4o)

Use `--provider` to override the project default for a single run:

```bash theme={null}
nt3 translate --all --provider openai
```

## Cancelling a translation

Press `Ctrl+C` during an active translation to cancel gracefully. The CLI sends a cancel request to the API to stop the in-progress batch, then exits cleanly.

## JSON output

With `--json`, the command outputs a structured result after all languages are processed:

```json theme={null}
{
  "success": true,
  "languages": {
    "fr": { "translated": 42, "skipped": 8, "failed": 0 },
    "nl": { "translated": 40, "skipped": 10, "failed": 0 }
  },
  "totals": {
    "translated": 82,
    "skipped": 18,
    "failed": 0
  }
}
```

The process exits with code `1` if any keys failed to translate.

## Terminal output

In interactive mode (TTY), the command shows a live progress bar per batch. In non-interactive mode (e.g., piped output), it shows a spinner instead.

After completion, a summary table is printed:

```
  Language    Translated  Skipped   Failed
  fr          42          8         0
  nl          40          10        0

  Total: 82 translated, 18 skipped, 0 failed
```

<Tip>
  Run `nt3 push` before `nt3 translate` to ensure Entri has your latest source strings, then run `nt3 pull` afterwards to write the translations to your local files.
</Tip>
