Translate Text
Translate text between languages using LLM-powered translation with domain awareness and glossary support.
Translates text into target_language with the LLM, honoring formality, subject domain, a glossary and the original formatting. Without source_language the model detects it.
Supports formal, neutral, and informal registers across general, legal, medical, technical, business, and academic domains. Enforce term consistency with custom glossaries and preserve original formatting.
Operations:
- Translation: Accurate cross-language translation with tone and domain context.
- Auto-detection: Automatically detect source language when not specified.
- Glossary enforcement: Apply mandatory term mappings for consistency.
- Formality control: Adjust output register (formal, neutral, informal).
How it works
- Resolves the node config: expressions in config keys are evaluated against the run; the incoming item is used as-is.
- Merges the incoming item with the resolved config (config keys win) and reads the inputs from the result.
- Requires
textandtarget_language. - Builds the prompt with
domain(when notgeneral),formality(defaultneutral), the glossary entries that have bothsourceandtarget, and the formatting rule (preserve_formatting, defaulttrue). - Calls the LLM through the backend with the
llm_provider_idrecord.invocation_mode: "sync"(default) waits for the full answer;"stream"reads it over SSE and joins the chunks. - Parses the JSON answer (temperature 0.2);
translated_textmust be non-empty. Addsdetected_source_languagewhen nosource_languagewas given. Routes tosuccess.
In a workflow
The node as it appears in a workflow file (draft_nodes[]), and the envelope of a successful run.
{
"node_id": "node-translate",
"label": "Translate to Spanish",
"operator_slug": "ai.translate",
"operator_version": "1.0.0",
"config": {
"llm_provider_id": "<llm_provider_id>",
"source_language": "",
"target_language": "es",
"formality": "neutral",
"domain": "business",
"glossary": [
{
"source": "order",
"target": "pedido"
}
],
"preserve_formatting": true
}
}{
"ok": true,
"port": "success",
"data": {
"translated_text": "Tu pedido saldrá el 3 de diciembre.",
"source_language": "en",
"target_language": "es",
"detected_source_language": "en"
}
}Configuration
-
llm_provider_idstring Optional -
The `id` of a `LlmProviderModel` record (e.g. `wf-llm-provider-*`). The orchestrator delegates to the backend: `POST /cognitive-infrastructure/cognitive-assets/llm-provider/invoke` for sync mode, or `POST /chat/conversation/execute/stream-ephemeral` (SSE) for stream mode. The backend resolves endpoint + api-key + deployment from the record and routes to the correct adapter.
-
invocation_modestring Optional -
Transport for the LLM call. `sync` blocks until the full response arrives. `stream` consumes tokens via SSE (required for long generations). Default `sync`.
-
timeout_msinteger Optional -
Maximum time to wait for the invocation to complete (or idle timeout between chunks in stream mode). Default 30000 for sync, 600000 for stream.
-
source_languagestring Optional -
Leave empty for auto-detection.
-
target_languagestring Required -
Target language code or name (e.g., "es", "French").
-
formalitystring Optional -
Register level for the translated output.
-
domainstring Optional -
Subject domain for terminology accuracy.
-
glossaryarray<object> Optional -
Term mappings to enforce during translation.
-
preserve_formattingboolean Optional -
Keep original paragraphs, lists, and line breaks.
Its configuration shows the shared execution settings, but this node does not apply retries (retryOnFail, maxTries) yet. continueOnFail is not applied by any node.
Behaviour in the code
What the implementation does with these keys beyond what the schema says.
-
llm_provider_id - Required at runtime although the schema does not mark it as required. It is the id of an LLM provider record; the backend resolves endpoint, deployment and credentials from it.
-
target_language / source_language - Written into the prompt as given: a code (
es) or a name (French) both work. They are not validated. -
glossary - Entries without
sourceortargetare dropped. The glossary is a prompt instruction; the output is not checked against it. -
timeout_ms timeout_msonly takes effect instreammode, as the idle time allowed between chunks (default 600000). Insyncmode it is logged but the backend request has no timeout.
Output ports
success default The model returned a non-empty translated_text. detected_source_language is present only when source_language was empty.
{
"translated_text": "Tu pedido saldrá el 3 de diciembre.",
"source_language": "en",
"target_language": "es",
"detected_source_language": "en"
}error Validation, the LLM call or parsing failed. data is { error } (plus response when the backend returned a body).
{
"error": "Missing target_language configuration."
}In expressions
What a later node can read from this node's output with $("Translate Text").item.json.<path> (write your node's label instead of Translate Text). Editor marks the paths the workflow editor suggests under Previous Nodes (the output contract); Worker marks the paths the worker really returns through success, from the output shown in Ports.
| Expression | Editor | Worker |
|---|---|---|
$("Translate Text").item.json.translated_textThe translated content. | ||
$("Translate Text").item.json.source_languageSource language (provided or detected). | ||
$("Translate Text").item.json.target_languageTarget language. | ||
$("Translate Text").item.json.detected_source_languageDetected source language when auto-detection was used. |
Errors
| Message | Port | Cause and fix |
|---|---|---|
Missing input text for translation. | error | The incoming item has no text. |
Missing target_language configuration. | error | target_language is empty. |
Model did not return valid translation output. | error | The answer had no JSON object with a non-empty translated_text. |
[AiTranslate] Missing 'llm_provider_id' in node config (LlmProviderModel.id, e.g. 'wf-llm-provider-*'). … | error | The node has no llm_provider_id. Pick an LLM provider in the node config; the legacy model_id key is not accepted. |
LLM Invocation Error: <backend message> | error | The backend rejected the call (unknown or inactive provider record, provider error, credentials). Check the provider record. |
LLM Invocation Error: empty response from backend (<reason>). | error | The backend could not be reached or returned nothing in sync mode. |
RemoteApiService.stream: idle timeout after <timeout_ms>ms | error | In stream mode no chunk arrived within timeout_ms. |
Input contract
-
textstring Required -
Text to translate.
Output contract
-
translated_textstring Optional -
The translated content.
-
source_languagestring Optional -
Source language (provided or detected).
-
target_languagestring Optional -
Target language.
-
detected_source_languagestring Optional -
Detected source language when auto-detection was used.
Contracts (JSON Schema)
The definition exactly as the orchestrator declares it. All is the whole *.definition.js; compare it with the sections above to spot differences between the documentation and the schema. Use it to validate a node before you publish.
{
"slug": "ai.translate",
"name": "Translate Text",
"category": "ai",
"version": "1.0.0",
"description": "Translate text between languages using LLM-powered translation with domain awareness and glossary support.\n\n Supports formal, neutral, and informal registers across general, legal, medical, technical, business, and academic domains. Enforce term consistency with custom glossaries and preserve original formatting.\n\n **Operations:**\n - **Translation:** Accurate cross-language translation with tone and domain context.\n - **Auto-detection:** Automatically detect source language when not specified.\n - **Glossary enforcement:** Apply mandatory term mappings for consistency.\n - **Formality control:** Adjust output register (formal, neutral, informal).",
"capabilities": [
"ai",
"translation",
"nlp",
"localization"
],
"config_schema": {
"type": "object",
"required": [
"target_language"
],
"properties": {
"llm_provider_id": {
"type": "string",
"title": "LLM Provider",
"description": "The `id` of a `LlmProviderModel` record (e.g. `wf-llm-provider-*`). The orchestrator delegates to the backend: `POST /cognitive-infrastructure/cognitive-assets/llm-provider/invoke` for sync mode, or `POST /chat/conversation/execute/stream-ephemeral` (SSE) for stream mode. The backend resolves endpoint + api-key + deployment from the record and routes to the correct adapter.",
"x-ui-widget": "llm-provider-picker",
"x-llm-provider-capabilities": [
"chat"
]
},
"invocation_mode": {
"type": "string",
"title": "Invocation Mode",
"description": "Transport for the LLM call. `sync` blocks until the full response arrives. `stream` consumes tokens via SSE (required for long generations). Default `sync`.",
"enum": [
"sync",
"stream"
],
"default": "sync"
},
"timeout_ms": {
"type": "integer",
"title": "Timeout (ms)",
"description": "Maximum time to wait for the invocation to complete (or idle timeout between chunks in stream mode). Default 30000 for sync, 600000 for stream.",
"minimum": 1000
},
"source_language": {
"type": "string",
"title": "Source Language",
"default": "",
"description": "Leave empty for auto-detection."
},
"target_language": {
"type": "string",
"title": "Target Language",
"description": "Target language code or name (e.g., \"es\", \"French\")."
},
"formality": {
"type": "string",
"title": "Formality",
"enum": [
"formal",
"neutral",
"informal"
],
"default": "neutral",
"description": "Register level for the translated output."
},
"domain": {
"type": "string",
"title": "Domain",
"enum": [
"general",
"legal",
"medical",
"technical",
"business",
"academic"
],
"default": "general",
"description": "Subject domain for terminology accuracy."
},
"glossary": {
"type": "array",
"title": "Glossary",
"description": "Term mappings to enforce during translation.",
"items": {
"type": "object",
"properties": {
"source": {
"type": "string",
"description": "Source term"
},
"target": {
"type": "string",
"description": "Required translation"
}
}
}
},
"preserve_formatting": {
"type": "boolean",
"title": "Preserve Formatting",
"default": true,
"description": "Keep original paragraphs, lists, and line breaks."
},
"execution": {
"type": "object",
"title": "Execution Settings",
"properties": {
"alwaysOutputData": {
"type": "boolean",
"title": "Always Output Data",
"description": "Always output data, even on error (if configured).",
"default": false
},
"retryOnFail": {
"type": "boolean",
"title": "Retry On Fail",
"description": "Retry the execution if it fails.",
"default": false
},
"maxTries": {
"type": "integer",
"title": "Max Retries",
"description": "Number of retries.",
"default": 3,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"waitBetweenTries": {
"type": "integer",
"title": "Wait Between Retries (ms)",
"default": 1000,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"continueOnFail": {
"type": "boolean",
"title": "Continue On Fail",
"description": "Do not crash workflow on error.",
"default": false
},
"timeout_ms": {
"type": "integer",
"title": "Timeout (ms)",
"description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
"default": 300000
}
}
}
}
},
"input_contract_schema": {
"type": "object",
"properties": {
"text": {
"type": "string",
"description": "Text to translate."
}
},
"required": [
"text"
]
},
"output_contract_schema": {
"type": "object",
"properties": {
"translated_text": {
"type": "string",
"description": "The translated content."
},
"source_language": {
"type": "string",
"description": "Source language (provided or detected)."
},
"target_language": {
"type": "string",
"description": "Target language."
},
"detected_source_language": {
"type": "string",
"description": "Detected source language when auto-detection was used."
}
}
},
"ports": [
{
"port_id": "success",
"label": "Translated",
"description": "Translation completed successfully.",
"is_default": true,
"supports_condition": true
},
{
"port_id": "error",
"label": "Error",
"description": "Translation failed.",
"is_default": false,
"supports_condition": false
}
],
"execution_mode": "async",
"tags": [
"ai",
"translation",
"nlp",
"localization",
"i18n"
],
"is_stateful": false,
"publisher": {
"identity": "org_sommatic_ai",
"profile": {
"name": "Sommatic AI",
"verified": true,
"url": "https://me.veripass.com/sommatic",
"logo_url": null
}
}
}{
"type": "object",
"required": [
"target_language"
],
"properties": {
"llm_provider_id": {
"type": "string",
"title": "LLM Provider",
"description": "The `id` of a `LlmProviderModel` record (e.g. `wf-llm-provider-*`). The orchestrator delegates to the backend: `POST /cognitive-infrastructure/cognitive-assets/llm-provider/invoke` for sync mode, or `POST /chat/conversation/execute/stream-ephemeral` (SSE) for stream mode. The backend resolves endpoint + api-key + deployment from the record and routes to the correct adapter.",
"x-ui-widget": "llm-provider-picker",
"x-llm-provider-capabilities": [
"chat"
]
},
"invocation_mode": {
"type": "string",
"title": "Invocation Mode",
"description": "Transport for the LLM call. `sync` blocks until the full response arrives. `stream` consumes tokens via SSE (required for long generations). Default `sync`.",
"enum": [
"sync",
"stream"
],
"default": "sync"
},
"timeout_ms": {
"type": "integer",
"title": "Timeout (ms)",
"description": "Maximum time to wait for the invocation to complete (or idle timeout between chunks in stream mode). Default 30000 for sync, 600000 for stream.",
"minimum": 1000
},
"source_language": {
"type": "string",
"title": "Source Language",
"default": "",
"description": "Leave empty for auto-detection."
},
"target_language": {
"type": "string",
"title": "Target Language",
"description": "Target language code or name (e.g., \"es\", \"French\")."
},
"formality": {
"type": "string",
"title": "Formality",
"enum": [
"formal",
"neutral",
"informal"
],
"default": "neutral",
"description": "Register level for the translated output."
},
"domain": {
"type": "string",
"title": "Domain",
"enum": [
"general",
"legal",
"medical",
"technical",
"business",
"academic"
],
"default": "general",
"description": "Subject domain for terminology accuracy."
},
"glossary": {
"type": "array",
"title": "Glossary",
"description": "Term mappings to enforce during translation.",
"items": {
"type": "object",
"properties": {
"source": {
"type": "string",
"description": "Source term"
},
"target": {
"type": "string",
"description": "Required translation"
}
}
}
},
"preserve_formatting": {
"type": "boolean",
"title": "Preserve Formatting",
"default": true,
"description": "Keep original paragraphs, lists, and line breaks."
},
"execution": {
"type": "object",
"title": "Execution Settings",
"properties": {
"alwaysOutputData": {
"type": "boolean",
"title": "Always Output Data",
"description": "Always output data, even on error (if configured).",
"default": false
},
"retryOnFail": {
"type": "boolean",
"title": "Retry On Fail",
"description": "Retry the execution if it fails.",
"default": false
},
"maxTries": {
"type": "integer",
"title": "Max Retries",
"description": "Number of retries.",
"default": 3,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"waitBetweenTries": {
"type": "integer",
"title": "Wait Between Retries (ms)",
"default": 1000,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"continueOnFail": {
"type": "boolean",
"title": "Continue On Fail",
"description": "Do not crash workflow on error.",
"default": false
},
"timeout_ms": {
"type": "integer",
"title": "Timeout (ms)",
"description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
"default": 300000
}
}
}
}
}{
"type": "object",
"properties": {
"text": {
"type": "string",
"description": "Text to translate."
}
},
"required": [
"text"
]
}{
"type": "object",
"properties": {
"translated_text": {
"type": "string",
"description": "The translated content."
},
"source_language": {
"type": "string",
"description": "Source language (provided or detected)."
},
"target_language": {
"type": "string",
"description": "Target language."
},
"detected_source_language": {
"type": "string",
"description": "Detected source language when auto-detection was used."
}
}
}[
{
"port_id": "success",
"label": "Translated",
"description": "Translation completed successfully.",
"is_default": true,
"supports_condition": true
},
{
"port_id": "error",
"label": "Error",
"description": "Translation failed.",
"is_default": false,
"supports_condition": false
}
]Execution
- Execution
async- Stateful
- No
- Retries (
retryOnFail) - No
- Capabilities
aitranslationnlplocalization- Tags
aitranslationnlplocalizationi18n
Notes and limits
- The model answer is parsed as JSON after removing Markdown code fences; if that fails, the text between the first
{and the last}is parsed. - Input fields are read from the incoming item (
$json). A key with the same name in the node config, which may be an expression, takes precedence over the input. - The worker also returns the provider response as
rawoutsidedata; the engine does not keep it. - On success the worker returns
portanddatawithout anokfield; the engine routes onportonly. timeout_msonly takes effect instreammode, as the idle time allowed between chunks (default 600000). Insyncmode it is logged but the backend request has no timeout.- In
streammode the temperature this node sets is not forwarded to the provider, andrawisnull. - The engine does not apply
execution.retryOnFail,maxTries,waitBetweenTriesorcontinueOnFailto this node. Handle failures by wiring theerrorport.
Reviewed against the orchestrator code · 31e874b · 2026-11-26