Translate text into a target language with placeholders, HTML, and markdown preserved verbatim — plus the detected source language and an auditable list of segments left untranslated.
Translate text into a target language — 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. Returns the detected source language and an auditable list of segments intentionally left untranslated.
Built for localizing UI strings, help-center content, and user-generated text where a corrupted %(count)d is a production bug, not a style issue.
| Entrypoint | Renders | Inputs |
|---|---|---|
system | Translator instructions + embedded output schema | target_language, source_language? |
user | The delimited text block + target language | text, target_language, source_language? |
Render system as the system message and user as the user message. Pass the shared variables to both renders.
text (string, required) — 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": "The text is English (detected from vocabulary and syntax). Two printf placeholders and one HTML tag preserved in place.",
"detected_source_language": "en",
"translation": "Hallo %s, Sie haben <b>%(count)d</b> neue Nachrichten.",
"untranslatable_segments": []
}
reasoning comes before the translation 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" (empty or unidentifiable text only).translation preserves placeholders/markup character-for-character. Empty input → empty string, never invented content.untranslatable_segments lists kept proper nouns, technical terms, or unrenderable wordplay — each with a reason. Placeholders and tags are not listed; preserving those is the contract.{var}, %s, %(name)s, :param, $1, tags, attribute values, URLs, backtick code spans."und".additionalProperties: false, closed enum for the detected language.<text> delimiter and explicitly treated as data."und".Part of the Translation Essentials collection — pair with language-detection to route, locale-adaptation to go beyond literal translation, and translation-qa-grading to grade the result.