AI: Translate text
The "AI: Translate text" service task translates any text into a desired target language. The source language is automatically detected and returned as an ISO code. Translation is performed via AI (OpenAI) and is especially well-suited for context-aware, domain-specific translations.
Input parameters
Provide the following fields as task input:
{
"text": "Sehr geehrte Damen und Herren, anbei erhalten Sie unsere Rechnung Nr. 2024-001 über 1.500,00 EUR.",
"targetLanguage": "en"
}
Explanation:
text: The text to translate. It can originate from a document, an email, or a previous process step.targetLanguage: The target language — as an ISO code (e.g.en,fr,es,ja) or as plain text (e.g.English,French).
Output
The task returns the translated text and the detected source language:
{
"translatedText": "Dear Sir or Madam, please find attached our invoice no. 2024-001 for EUR 1,500.00.",
"detectedLanguage": "de"
}
Explanation:
translatedText: The fully translated text. Formatting (line breaks, paragraphs) is preserved.detectedLanguage: ISO 639-1 code of the detected source language (e.g.de,en,fr).
JSONata examples
// Example: translate email body to English
{
"text": emailResult.body,
"targetLanguage": "en"
}
// Example: only translate if source language is not German (gateway condition)
result.detectedLanguage != "de"
Notes
- The source language does not need to be specified — it is detected automatically.
- Longer texts generally produce better results, as the AI has more context available.
- The translation is particularly well-suited for domain-specific texts, as the AI takes context and terminology into account.
- Line breaks and paragraph formatting in the original text are preserved.
Tip
In combination with the "AI: Classify document" service task, multilingual documents can be automatically detected and translated as needed — for example, classify incoming requests first, then translate them into the target language for further processing.