Context Hints
The --context flag tells the LLM what you are translating. This helps it resolve ambiguous terms and choose appropriate terminology.
Basic usage
Section titled “Basic usage”yaku --to en --context "Kubernetes documentation" -f guide.ja.mdyaku appends this to the system prompt:
Context: this text is about Kubernetes documentation. Use appropriate domain terminology.When context matters
Section titled “When context matters”Without context, the LLM guesses the domain from the text alone. This works for most translations, but some terms are ambiguous across domains:
| Spanish term | General translation | With --context "networking" | With --context "swimming" |
|---|---|---|---|
| piscina | pool | resource pool | swimming pool |
| puerto | port | network port | seaport |
| tabla | table | routing table | table |
| rama | branch | branch (git) | tree branch |
Examples
Section titled “Examples”Technical documentation
Section titled “Technical documentation”yaku --to en --context "PostgreSQL database administration" -f backup-guide.fr.mdThe LLM uses database-specific terms: “transaction”, “index”, “query” — rather than their general-purpose equivalents.
Formal business writing
Section titled “Formal business writing”yaku --to en --context "formal business email to a client" -f email-draft.ja.txtThe LLM adjusts formality level and tone for professional English communication.
Medical text
Section titled “Medical text”yaku --to en --context "medical research paper, cardiology" -f abstract.zh-TW.mdThe LLM uses standard medical terminology instead of colloquial equivalents.
Combining with other features
Section titled “Combining with other features”Context + glossary
Section titled “Context + glossary”Use --context for overall domain and a glossary for specific terms:
yaku --to en \ --context "Kubernetes documentation" \ --glossary k8s-terms.yaml \ -f guide.ja.mdThe glossary locks down exact terms (e.g., “pod” → “Pod”), while --context guides the LLM on everything else.
Context + polish mode
Section titled “Context + polish mode”In polish mode, --context adjusts tone and formality:
echo "El servidor se cayó otra vez ayer y necesitamos fixearlo" | \ yaku --mode polish --to es --context "incident report for engineering leadership"Output:
El servidor experimentó una interrupción no planificada ayer y es necesario corregirlo.- Keep it short. One phrase is enough:
"Kubernetes docs","legal contract","casual blog post". - Be specific.
"PostgreSQL administration"is better than"database". - Use for tone control. Context like
"formal email"or"casual chat"affects the writing style, not just terminology.