Docs and UI string localization
When English docs or UI strings change, the agent translates the diff into your target languages using a glossary, and opens a PR for native-speaker review.
Who it's for and the problem it solves
For product and engineering teams that ship in more than one language and keep falling behind on translations. Re-translating whole files is slow and expensive, and inconsistent terminology confuses users. This agent translates only what changed, uses your glossary, and leaves the final say to a native speaker in a pull request.
Tools
- GitHub
- DeepL
How to set it up
- 1Keep source strings in a predictable place in GitHub, such as locale files (en.json, messages.po) and a docs folder in Markdown, with one file per language.
- 2Create a DeepL glossary for each target language with product names, feature names and terms that must never be translated. Keep the source of truth in the repo.
- 3Add a GitHub Action (or agent trigger) that runs when English strings or docs change on the main branch and computes the diff of new and changed keys or paragraphs.
- 4Send only the changed text to the DeepL API with the glossary, preserving placeholders like {name}, %s and HTML or Markdown formatting.
- 5Validate the output: placeholders unchanged, valid JSON or PO syntax, no empty strings, and length warnings for UI strings that might overflow buttons.
- 6Open one pull request per language with the translated diff, labeled for review and assigned to that language's reviewer.
- 7Merge only after a native or fluent speaker approves, and add their recurring corrections to the glossary.
Example agent instructions
Copy, paste and adapt. Replace anything in {braces} with your own details.
You maintain translations for {Product}.
When English source files change:
1. Diff against the last translated commit. Collect only new or modified keys and paragraphs. Never re-translate unchanged text.
2. Translate each item into {languages} with DeepL and the language's glossary.
3. Preserve exactly: placeholders ({var}, %s, %d), HTML tags, Markdown links, code blocks and product names on the do-not-translate list.
4. Validate file syntax, and flag any UI string whose translation is more than 40% longer than the English.
5. Open one PR per language titled "i18n({lang}): {N} updated strings", listing each key with its English source and the translation, and noting any validation warnings.
6. Never merge. Request review from the reviewer for that language.Guardrails and human checkpoints
- Machine translations are never merged without a human reviewer for that language.
- Glossary and do-not-translate terms are enforced, and the reviewer's corrections go back into the glossary.
- Automated checks block PRs with broken placeholders or invalid syntax.
- Have legal, pricing, safety and medical text translated or reviewed by a qualified professional.
- Use a DeepL API key scoped to this repo's automation and stored as a CI secret, never committed.
Example input and output
Illustrative example only, not real customer data.
Example input
Example diff: en.json adds "export.button": "Export {count} files" and changes the docs paragraph about workspace limits.
Example output
Example PR for German (illustrative): Title: i18n(de): 2 updated strings - export.button: "Export {count} files" → "{count} Dateien exportieren" (placeholder preserved) - docs/workspaces.md, paragraph 3: translated with glossary term "Workspace" kept as-is Warnings: none
What to measure
- Track time from an English change merging to the translated version merging.
- Track the share of machine-translated strings the reviewer edits.
- Track validation failures caught before review (broken placeholders, syntax).
- Track untranslated keys per language over time.
FAQ
Why DeepL instead of a general chatbot?
DeepL has a translation API with glossary support, which keeps terminology consistent. You can swap in another model, but keep the glossary and validation steps.
Do we still need translators?
Yes, as reviewers. The agent removes the blank-page work, and fluent people make sure it reads naturally and correctly.
How do we handle plurals and gender?
Use your i18n library's plural and select formats (for example ICU MessageFormat) in the source, and validate that the translation keeps that structure.
Related use cases
- EngineeringRelease notes from merged PRs
- CodingPR review & bug-fix agent
- CodingCodebase onboarding guide generator
Get new agent playbooks by email