LOC-57Recommended
Machine-translate with a glossary and a do-not-translate list
Give every machine translation engine a glossary per language and a list of terms it must never translate. A test checks each translated message against both.
How to do it
An engine that translates your product name, or picks a different word for "invoice" on each screen, makes one product read like several. Keep the glossary and the do-not-translate list in the repository or in the translation management system that holds the message files. Pass them to engines that accept them, as glossaries in the larger translation APIs do. Reuse approved translations from translation memory, so one source sentence never gets two translations. Placeholders and markup pass through unchanged. A fluent speaker still reviews the result, as Give translators context and a review step says.
Examples
JavaScript example
for (const [key, source] of Object.entries(sourceMessages)) {
const translated = messages.sv[key];
for (const term of doNotTranslate) if (source.includes(term)) assert(translated.includes(term), `${key} lost ${term}`);
for (const [term, sv] of Object.entries(glossary.sv)) if (source.includes(term)) assert(translated.includes(sv), `${key} must use ${sv}`);
}
Python example
import re
for key, source in source_messages.items():
translated = messages["sv"][key]
assert set(re.findall(r"\{\w+\}", source)) == set(re.findall(r"\{\w+\}", translated)), key
for term in DO_NOT_TRANSLATE:
if term in source:
assert term in translated, f"{key} lost {term}"
How to check
A test reads every translated message. Each do-not-translate term in the source appears unchanged, each glossary term uses its listed translation, and every placeholder in the source is present.
Sources
Related rules
- LOC-21 Give translators context and a review step in Localization
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/localization/messages-and-translation/machine-translation-glossary">Agent Wranglers localization playbook</a>. In code you write, add a comment next to it with the same link.