System prompt · Writing
Translation system prompt that keeps your glossary and code intact
Use this to localise interface strings, help articles or docs. Models translate fluently, but software text has traps a general translator walks into: {count} placeholders translated or reordered into broken syntax, HTML tags lost, product names translated, and the same English word rendered three ways across a product. This prompt locks the things that must not change, makes your glossary binding, and asks for a short note when the source is ambiguous rather than a silent guess.
Prompt
The system prompt
337 tokens with OpenAI o200k_base (gpt-tokenizer 4.0.0), placeholders unfilled. Original writing, free to copy and adapt.
You translate {{content_type}} for {{product}} from {{source_language}} into {{target_language}}. Translate the meaning naturally, as a native speaker would write it for {{audience}}, while keeping every technical element exactly intact.
<never_change>
- Placeholders and variables: {name}, {count, plural, ...}, %s, %1$d, :id, $VAR. Keep them exactly; move them only if the target grammar requires it.
- Code, commands, file paths, URLs, email addresses, and anything in backticks or code blocks.
- HTML, XML and Markdown markup: keep every tag and attribute; translate only the text between tags.
- Product names and trademarks: {{do_not_translate}}
</never_change>
<glossary>
Use these translations every time, even if another word seems more natural:
{{glossary}}
</glossary>
<style>
- Tone: {{tone}}.
- Match the length of UI strings closely; buttons and labels have limited space.
- Use the target locale's conventions for dates, numbers and quotation marks in prose, but never inside code or placeholders.
</style>
<ambiguity>
If a source string is ambiguous (for example "Close" as verb or adjective, or a string with no context), translate the most likely meaning and add a note.
</ambiguity>
<output>
Return the translation in the same structure as the input (same keys for JSON, same lines for lists). Put any notes after the translation, under "Translator notes:", one per line with the key or line they refer to. If there are no notes, write nothing after the translation.
</output>Variables
What to fill in
Fill these once per deployment. Anything that changes per request, such as the user’s name or today’s date, belongs in the user message so the system prompt stays identical and cacheable.
- {{content_type}}
- What is being translated.
- e.g. app interface strings
- {{product}}
- Product name.
- e.g. Taskly
- {{source_language}}
- Source language.
- e.g. English
- {{target_language}}
- Target language and locale.
- e.g. German (Germany)
- {{audience}}
- Who reads it.
- e.g. small-business users
- {{do_not_translate}}
- Names that stay as they are.
- e.g. Taskly, Taskly Pro, Slack, Google Drive
- {{glossary}}
- Source term = required translation, one per line.
- e.g. task = Aufgabe workspace = Arbeitsbereich sign in = anmelden
- {{tone}}
- Formality and voice.
- e.g. friendly but formal (use Sie)
Design notes
Why each part is there
Role line
Pins source, target, audience and the balance between natural phrasing and technical exactness. Google’s guide recommends giving the model the context it needs, and audience and locale are the context that matters most in translation.
Follows: Google: Prompt design strategies · Anthropic: Prompting best practices
<never_change>
Lists concrete patterns rather than “preserve formatting”. Showing the actual placeholder syntaxes (
{name},%1$d) is far more reliable than describing them.Follows: Google: Prompt design strategies · OpenAI: Prompt engineering
<glossary>
A binding glossary with the reason it overrides natural choices (consistency across the product). Anthropic notes that explaining the reason behind an instruction helps the model apply it.
Follows: Anthropic: Prompting best practices
<style> and <ambiguity>
Length matching for UI strings and locale conventions in prose only. The ambiguity note gives the model a place for uncertainty instead of a silent guess.
Follows: Anthropic: Reduce hallucinations · Google: Prompt design strategies
<output>
Same structure in and out, so your localisation pipeline can parse it, with notes after the translation where they can be split off.
Follows: OpenAI: Prompt engineering · OpenAI: Structured Outputs
Try it
A message to test it with
{
"tasks.empty": "No tasks yet. <b>Create one</b> to get started.",
"tasks.count": "{count} tasks in {workspace}",
"menu.close": "Close"
}Adapt
How to adapt it
- Generate
{{glossary}}from your translation memory. If it is long, keep only the core terms in the system prompt and send the other terms that appear in each batch in the user turn, so the system prompt stays identical. - For JSON resource files, use structured outputs with the same keys as the input so a missing key is impossible.
- Add screenshots or a “context” field per string where you have them; ambiguous strings are mostly a context problem.
- Check output in code: the same placeholders and tags must appear in source and target.
Failure modes
Common failure modes
- Placeholders get translated.
- Validate in code that every placeholder in the source appears in the target, and retry failures with the error.
- Glossary ignored in longer texts.
- Send the relevant glossary terms again in the user turn, next to the text, so the important ones aren’t diluted.
- Wrong formality level.
- State the form explicitly in
{{tone}}(for German, Sie or du; for French, vous or tu).
Cost
What it costs to send with every request
| Model | Without caching | With caching |
|---|---|---|
| Claude Sonnet 5.5estimate: this model’s tokenizer isn’t public, so its count may differ | $205.01 | Not cached: under the 512-token minimum |
| Claude Haiku 5.5estimate: this model’s tokenizer isn’t public, so its count may differ | $10.25 | Not cached: under the 512-token minimum |
| GPT-6.1 Solo200k_base count; OpenAI hasn’t published this model’s tokenizer | $205.01 | Not cached: under the 1,024-token minimum |
| Gemini 3.8 Flashestimate: this model’s tokenizer isn’t public, so its count may differ | $76.88 | Not cached: under the 4,096-token minimum |
A prompt under a provider’s minimum is still billed in full on every call. Tool definitions sit before the system prompt in the cached prefix, so together they may cross it. Price it at your own traffic.
Placement
Where it goes in each API
Batch strings into one request per file or screen rather than one per string: the system prompt and glossary are then sent once per batch instead of once per string. Localisation can usually wait, which makes it a good fit for batch pricing.
| API | Where the system prompt goes | Worth knowing |
|---|---|---|
| OpenAI Responses API | instructions | Applies to that request only: with previous_response_id, send it again every turn. |
| OpenAI Chat Completions | a developer message first in messages | Replaces the system role for o1 and newer models; developer messages take priority over user messages. |
| Anthropic Messages API | top-level system | No system role inside messages. Pass it as a text block with cache_control to cache it. |
| Gemini generateContent | systemInstruction | Text only. Still supported; Google recommends the Interactions API for new work. |
| Gemini Interactions API | top-level system_instruction | Sent beside model and input. Applies to that interaction only: with previous_interaction_id, send it again every turn. |
Related
Related system prompts and tools
- Technical writer for developer docsWriting
- JSON-only extraction serviceData and extraction
- Customer support agent with escalationAssistants
Tokens to words converterBatch API calculatorWhat is a token?All system prompts