Translate a labeled batch of texts into a target language in one call — one result per item in input order, labels echoed verbatim, with placeholders, HTML, and markdown preserved character-for-character in every translation.
Translate a labeled batch of texts into a target language in one call — the batch counterpart of text-translation. Every item comes back as a {label, translated_text} pair in input order, with the things that break naive machine translation preserved verbatim: template placeholders ({var}, %s, %(count)d), HTML tags, markdown syntax, URLs, emails, and code identifiers.
Built for localizing whole UI string files, resource bundles, and CMS field sets where you want one call per language instead of one call per string — and where a corrupted %(count)d or a mixed-up label is a production bug, not a style issue.
| Entrypoint | Renders | Inputs |
|---|---|---|
system | Batch-translator instructions + embedded output schema | target_language, source_language? |
user | The delimited <items> block + target language | items, target_language, source_language? |
Render system as the system message and user as the user message. Pass the shared variables to both renders.
items (array, required) — the batch to translate. Each item is {label: string, text: string}:
label — an opaque identifier (e.g. "checkout.cta", "error_404_title"), echoed back verbatim in the corresponding output entry. Never translated, trimmed, or re-cased.text — the text to translate. May contain placeholders, HTML, or markdown; may be empty.target_language (string, required) — ISO 639-1 code ("de") or English language name ("German").source_language (string, optional) — ISO 639-1 code of the source language, when you know it. The engine trusts it and echoes it back as detected_source_language; omit to auto-detect.parseOutput() returns:
{
"reasoning": "All three strings are English UI copy. One printf placeholder and one HTML tag preserved in place; labels echoed untouched.",
"detected_source_language": "en",
"translations": [
{ "label": "greeting", "translated_text": "Hallo %s, willkommen zurück!" },
{ "label": "inbox.count", "translated_text": "Sie haben <b>%(count)d</b> neue Nachrichten." },
{ "label": "cta.upgrade", "translated_text": "Jetzt upgraden" }
]
}
reasoning comes before the translations by design — language identification and placeholder decisions are made before committing to output.detected_source_language is a closed enum of 41 ISO 639-1 codes plus "und" — the dominant language across the batch when items mix.translations has exactly one entry per input item, in input order — including empty-text items (empty string) and repeated labels. Empty array only for an empty batch.{var}, %s, %(name)s, :param, $1, tags, attribute values, URLs, backtick code spans.translated_text; an empty batch yields an empty array and "und".additionalProperties: false, closed enum for the detected language.<item label="..."> delimiter within an <items> block, and explicitly treated as data."und".Part of the Translation Essentials collection — use text-translation for single strings with untranslatable-segment auditing, language-detection to route, and translation-qa-grading to grade individual results.