Glossary
A glossary file enforces consistent terminology across translations. Define how specific terms should be translated — or kept untranslated — and yaku injects these rules into the LLM prompt.
Quick start
Section titled “Quick start”Create a file called .yaku-glossary.yaml in your working directory:
en: déploiement: deployment # always translate to this conteneur: container Kubernetes: ~ # keep as-is Docker: ~ # keep as-isNow translate as usual. yaku auto-loads the glossary:
yaku --to en -f docs.fr.mdThe LLM receives instructions like:
- “Use these specific translations: déploiement → deployment, conteneur → container”
- “Keep these terms in their original language (do NOT translate them): Kubernetes, Docker”
File format
Section titled “File format”Glossary files use YAML. Terms are grouped by target language code:
<target-language>: <term>: <translation> # translate to this value <term>: ~ # keep in original language (YAML null)You can include sections for multiple languages in one file:
en: conteneur: container Kubernetes: ~
es: container: contenedor Kubernetes: ~yaku only loads the section matching your --to target language (case-insensitive match). For example, --to en matches en:, EN:, or En:. If no section matches, yaku uses an empty glossary.
Translation entries
Section titled “Translation entries”Provide a string value to define how a term should be translated:
en: logiciel: software base de données: database apprentissage automatique: machine learningWhen yaku translates to en, it injects these terms into the LLM prompt as required translations.
Keep-original entries
Section titled “Keep-original entries”Use ~ (YAML null) to tell yaku to keep a term in its original language:
en: Kubernetes: ~ Docker: ~ API: ~ GitHub: ~This is useful for brand names, proper nouns, and technical terms that should not be changed during translation.
File lookup
Section titled “File lookup”When you use --glossary <path>, yaku loads only that file. Otherwise, yaku checks both default locations and merges them (terms from later files override earlier ones):
~/.config/yaku/glossary.yaml— global terms shared across all projects (loaded first).yaku-glossary.yamlin the current working directory — per-project terms (loaded last, takes priority)
Both files are loaded if they exist. When the same term appears in both, the per-project file takes priority.
To skip glossary loading entirely:
yaku --to en --no-glossary -f docs.fr.mdExample: per-project + global glossary
Section titled “Example: per-project + global glossary”Set up a global glossary for brand names you never want changed:
en: GitHub: ~ Docker: ~ Kubernetes: ~
es: GitHub: ~ Docker: ~ Kubernetes: ~Then add project-specific terms in each project:
en: conteneur: container déploiement: deployment service: serviceWhen you run yaku --to en from /path/to/my-project/, both files are loaded. The global glossary keeps brand names unchanged; the project glossary enforces domain terms.
Explicit glossary path
Section titled “Explicit glossary path”yaku --to en --glossary ~/work/shared-terms.yaml -f docs.fr.mdWhen --glossary is used, only that file is loaded — the default paths are skipped.
How it works
Section titled “How it works”- Load — yaku reads the glossary file(s) and looks up the
--tolanguage section. - Inject — Translation entries become
"Use these specific translations: logiciel → software". Keep-original entries become"Keep these terms in their original language: Kubernetes, Docker". - Translate — The LLM sees the glossary instructions alongside the text.
- Verify — After translation, yaku runs a safety check (
EnforceKeepOriginal) to verify that terms marked with~are still present in the output. This is a safety net — the primary enforcement happens via the prompt.
The prompt injection approach means the glossary works with all backends (Gemini, OpenAI, Anthropic, hosted) and all formats (text, Markdown, JSON, YAML).
Full example: translating a cooking blog
Section titled “Full example: translating a cooking blog”en: # Keep dish names in their original language ratatouille: ~ croissant: ~ miso: ~ dashi: ~
# Standardize cooking terms sauté: sauté julienne: julienne mise en place: mise en place
es: ratatouille: ~ croissant: ~ sauté: saltear julienne: cortar en julianayaku --to en -f recipe.fr.md -o recipe.en.mdWhen to use a glossary
Section titled “When to use a glossary”- Open-source projects — keep brand names and technical terms consistent across translations.
- Documentation sites — enforce standard terminology (e.g., always use “container” for “conteneur”).
- Regulated industries — lock down translations of legal or medical terms.
- Multi-translator workflows — ensure everyone uses the same vocabulary.
- Start small. Add terms only as you notice inconsistencies. A glossary with 10–20 terms covers most projects.
- Use
~for brand names. Terms like “GitHub”, “Kubernetes”, and “Docker” should almost always stay unchanged. - Use the global glossary for universal terms. Put brand names and common technical terms in
~/.config/yaku/glossary.yamlso they apply everywhere. - Place per-project glossary in the working directory. yaku looks for
.yaku-glossary.yamlin the directory where you run the command. - Combine with
--context. The glossary handles specific terms;--contextsets the overall tone and domain.