knoten / builtin / ai / localai
Translate
Translate text between languages on-device
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Translate text between languages with a model that runs in your browser, so the text never leaves your device.
What it does
Section titled “What it does”Translate splits the Text into pieces of about 1,000 characters at sentence ends, translates each piece with the model you pick, and joins the results.
- With NLLB-200 distilled (translate), you choose the languages in From and To. It covers 200 languages.
- With a fixed-pair model whose name ends in
opus-mt-xx-yy(added as a custom model), the model always translates its own pair and ignores From and To.
When From and To are the same, the text is returned unchanged without running the model. There is no cost per run and no API key.
When to use it
Section titled “When to use it”- Translate incoming messages or scraped pages before you process them.
- Translate a reply before you send it.
To translate with a chat model and your own instructions, use Basic LLM Chain.
Inputs and settings
Section titled “Inputs and settings”| Einstellung | Typ | Was es bewirkt |
|---|---|---|
| Text | Long text | The text to translate. |
| From | Choice | Source language. Ignored by fixed-pair opus-mt models. 59 options. Standard: English |
| To | Choice | Target language. Ignored by fixed-pair opus-mt models. 59 options. Standard: French |
| Model | Model picker | Only translation models are listed here. |
From and To list 59 common languages by name. With an expression you can also pass an English language name (Spanish), a two-letter code (es) or any NLLB-200 code (spa_Latn), which reaches all 200 languages. For example, set To to {{ $input.language }}.
Outputs
Section titled “Outputs”-
Output
Each output item has these fields:
| Field | Typ | What it holds |
|---|---|---|
| text | Text | The translated text |
| from | Text | |
| to | Text |
{ "text": "…", "from": "…", "to": "…"}from and to are the language codes actually used: NLLB codes such as eng_Latn and fra_Latn, or the model’s own pair (such as en and de) for an opus-mt model.
Dependencies and credentials
Section titled “Dependencies and credentials”None. This node needs no connection and has no slots for other nodes.
The Model picker lists your installed translation models first, then ones that download on first use. NLLB-200 distilled (translate) is a large download (about 460 MB). To use an opus-mt model, add it on the Local AI page.
Example workflow
Section titled “Example workflow”Translate the text you select into English:
- Context Menu with Menu Contexts set to Selection.
- Translate with Text
{{ $input.selectionText }}, From French, To English and Model NLLB-200 distilled (translate). - Show Notification with Title
Translationand Message{{ $input.text }}.
Common issues
Section titled “Common issues”- “Choose a translation model.” Model is empty. Pick one.
- “Provide some text to translate.” Text is empty after expressions run.
- “Unknown source language “…”.“ or “Unknown target language “…”.“ An expression in From or To returned something that is not a listed name, a two-letter code or an NLLB code.
- The output is in the wrong language. You picked an opus-mt model: it ignores From and To. Use NLLB-200 for other pairs.
- The first run is slow. The model downloads and loads on first use; later runs are fast.
Related nodes
Section titled “Related nodes”- Summarize: condense text on-device.
- Generate Text: other text transforms on-device.
- Transcribe Audio: turn speech into text to translate.
- Basic LLM Chain: translate with a chat model.