Translation - Context-Aware Localization
Scheduling
Goal
Translate, review, or adapt multilingual content while preserving meaning, register, placeholders, structure, domain terminology, and natural target-language word order.
Intent signature
- User asks to translate, localize, review translation quality, create a glossary, or adapt UI/docs/marketing copy.
- User needs context-aware translation rather than mechanical word substitution.
When to use
- Translating UI strings, error messages, or microcopy
- Translating documentation, README, or guides
- Translating marketing copy or landing pages
- Reviewing existing translations for naturalness
- Creating glossaries or translation style guides
- Any task involving multilingual content
When NOT to use
- i18n infrastructure setup (key extraction, routing, build) -> use dev-workflow
- Adding new locale to framework config -> use dev-workflow
- Code-level l10n patterns (date formatting, pluralization API) -> use relevant agent
Expected inputs
- Source text, target language, and optional locale or audience
- Existing locale files, glossary, code context, or style constraints
- Optional user/author writing sample for voice matching in prose, marketing, dialogue, or adaptation tasks
- Placeholder syntax, formatting constraints, and output mode
Expected outputs
- Natural target-language translation or review findings
- Preserved placeholders, code spans, links, headings, lists, and file structure
- Translator notes when source concepts need explanation
- Batch-safe output for i18n files when requested
Dependencies
- Existing translations and surrounding code for register and terminology
resources/translation-rubric.md and resources/anti-ai-patterns.md (language-neutral)
resources/lang/{code}.md for the target language (required when a profile exists)
- Project locale files when translating UI strings
- User-provided voice samples when the task asks to preserve or match a specific author's style
Control-flow features
- Branches by content type, target language, batch size, register uncertainty, and placeholder/structure requirements
- Branches by whether a language profile exists for the target, and by locale variant when the profile declares variants
- Branches by whether style-sample calibration is available and appropriate for the content type
- Reads locale files and source context; may write translated content only when explicitly editing files
- Blocks output until mechanical verification passes
Structural Flow
Entry
- Confirm source text, target language, content type, and output mode.
- Load
resources/lang/{code}.md for the target language (see "Language Profile Loading").
- Load existing translations, glossary, file context, or code context when available.
- Identify placeholders, formatting constraints, and ambiguity.
Scenes
- PREPARE: Load the target language profile, then determine register, domain, and structure constraints.
- ACQUIRE: Read existing translations and surrounding context.
- REASON: Analyze source meaning, connotations, figurative language, and terminology.
- ACT: Reconstruct natural target-language output.
- VERIFY: Run mechanical checks and translation rubric.
- FINALIZE: Emit translation, review notes, or file changes.
Transitions
- If context is insufficient, ask one targeted question.
- If the target language has a profile and it was not loaded, stop and load it before drafting.
- If the profile declares locale variants and none was resolved, resolve the variant before translating any string.
- If batch size is greater than 10 strings, verification is mandatory before output.
- If the output violates a typography or sentence-completion rule in the profile, rewrite before final output.
- If placeholders or structure do not match, revise and rerun verification.
Failure and recovery
- If source meaning is ambiguous, flag ambiguity rather than guessing.
- If project conventions conflict with literal translation, follow project conventions and explain if needed.
- If file structure is risky to modify, preserve structure and limit edits to values.
Exit
- Success: target text is natural, faithful, structurally equivalent, and verified.
- Partial success: ambiguous source text or missing context is explicit.
Context Inference
No config file required. Instead, infer translation context from:
- Existing translations in the project: scan sibling locale files to match register, terminology, and style already in use
- File location:
messages/, locales/, .arb files reveal the framework and format
- Surrounding code: component names, comments, and variable names hint at domain and audience
- Source text itself: register, formality, sentence structure reveal intent
If context is insufficient to make a confident decision, ask the user. Prefer one targeted question over a batch of questions.
Language Profile Loading
Translation quality rules split into two layers. Load both; neither is sufficient alone.
| Layer |
File |
Holds |
| Shared |
resources/anti-ai-patterns.md |
AI writing pattern taxonomy, rules 1–25, source-side examples |
| Shared |
resources/translation-rubric.md |
5-criterion scoring |
| Per-language |
resources/lang/{code}.md |
Register system, language-only rules, localizations of shared rules, typography, self-check |
Routing: resolve the target to a BCP 47 primary subtag and read resources/lang/{code}.md.
| Target |
Profile |
Notes |
| Korean |
lang/ko.md |
rules KO-1–KO-12 |
| Japanese |
lang/ja.md |
rules JA-1–JA-9 |
| Chinese |
lang/zh.md |
rules ZH-1–ZH-9; variant resolution is mandatory before translating |
| English |
lang/en.md |
rules EN-1–EN-8; written for CJK → EN direction |
| Anything else |
none yet |
fall back to shared files only |
Fallback rule: when no profile exists for the target, use the shared files, apply shared rules 19–24 by reasoning from the target's actual grammar, and state once in the output notes that no profile was available. Do not silently borrow another language's profile: ko.md rules are wrong for German, and applying them produces confident errors.
Adding a profile: copy resources/lang/_template.md to resources/lang/{code}.md and add the row to the routing table above. An empty profile beats an invented one.
Precedence: the profile wins over the shared file when they appear to conflict, because the shared file describes the pattern and the profile describes the target. A profile may declare that a shared rule does not apply to its language (en.md does this for the em-dash restructuring requirement, which exists only for CJK targets).
Translation Method
Stage 1: Analyze Source
Read the source text and identify:
- Register: Formal, casual, conversational, technical, literary
- Intent: Inform, persuade, instruct, entertain
- Domain terms: Words that need consistent translation (check existing translations first)
- Cultural references: Idioms, metaphors, humor that won't transfer directly
- Sentence rhythm: Short/punchy vs. long/flowing; note parallel structures, intentional repetition, and emphasis patterns
- Comprehension challenges: Terms or references target readers may struggle with, such as domain jargon lacking standard translations, cultural references (pop culture, history, social norms), implicit knowledge the author assumes, wordplay or puns, named concepts (e.g., "Dunning-Kruger effect"). For each, note: the original term, why it may confuse, and a concise plain-language explanation for a potential translator's note
- Figurative language mapping: For each metaphor, simile, idiom, or figurative expression, classify the handling approach:
- Interpret: Discard source image entirely, express the intended meaning directly in natural target language
- Substitute: Replace with a target-language idiom or image that conveys the same idea and emotional effect
- Retain: Keep the original image if it works equally well in the target language
- Emotional connotations: Words carrying subjective feeling beyond dictionary meaning (e.g., "alarming" = urgency, "haunting" = lingering unease); note the emotional effect to preserve in translation
Stage 2: Extract Meaning
Strip away source language structure. Ask yourself:
- What is the author actually trying to say?
- What emotion or tone should the reader feel?
- What action should the reader take?
Do NOT start forming target sentences yet.
Stage 2.5: Persona Assignment
Persona resolution has two layers: content-type (what kind of text) and voice (how punchy or formal the rhythm). Both are needed.
Layer 1: Read translation_voice from .agents/oma-config.yaml
The translation_voice field controls global rhythm/formality. Three values:
| Voice |
Style override applied on top of content-type |
formal |
complete sentences only, no fragments, strict 합니다체/です・ます, no padding cuts |
balanced (default) |
content-type defaults; fragments allowed only in label/cell positions |
interpreter |
interpreter mindset across all content types: punchy, audience-first, spoken cadence, fragments allowed when natural in target, drops formal padding ("을 받았습니다" → "받음" / "을 모두" → drop) |
If the field is missing, default to balanced. If oma-config.yaml is unreadable, also balanced.
Layer 2: Content-type persona table
| Content type |
Persona |
Base style markers |
| UI strings / microcopy |
UX copywriter |
concise, imperative, user-friendly |
| Docs / README / API reference |
technical writer |
data + commentary, expanded explanations |
| Benchmark / report / changelog |
technical reporter |
data + commentary, objective tone |
| Marketing / landing / hero copy |
brand copywriter |
concise impact, audience-first, aggressive transcreation |
| Blog post / essay |
essayist |
preserve cadence and rhythm, retain author voice |
| Literary / prose |
literary translator |
preserve imagery, style consistency, narrative voice |
| Dialogue / subtitle / interview |
interpreter |
immediacy, audience-first, spoken register, cultural context inline |
Classification heuristics:
- File location
messages/, locales/, *.arb → UX copywriter
- Filename
README*, docs/*, or .md with frequent code blocks → technical writer
- Score tables, benchmark stats, changelog rows → technical reporter
- Page/section hero copy → brand copywriter
- Quote marks, em-dashes, speaker labels in source → interpreter
When unclear, default to technical writer for code-adjacent content and essayist for prose. Never use a generic "translator" persona.
Combining layers
Voice is applied on top of the content-type persona. Examples:
- Content-type =
technical reporter + voice = formal → fully expanded sentences, no fragments anywhere, strict 합니다체.
- Content-type =
technical reporter + voice = balanced → complete sentences in body, fragments allowed in table cells (current default).
- Content-type =
technical reporter + voice = interpreter → punchier rhythm, list-item fragments allowed (e.g., "39턴 / 8m 13s / $1.28 (파일당 $0.14)" instead of "39턴, 8m 13s, 총 $1.28을 썼습니다(파일당 약 $0.14)"), drops "을 모두 받았습니다" padding.
The persona is then localized to the target language at execution time. Translating into Korean as a "technical reporter" with interpreter voice means thinking as a Korean technical reporter who values rhythm and audience scan-speed over formal completeness.
Optional Layer 3: Voice sample calibration
If the user provides an author/user writing sample, analyze it before drafting. Use it as a style constraint, not as permission to alter meaning.
Extract:
- Sentence length pattern: short/punchy, long/flowing, or mixed
- Paragraph entry habit: immediate claim, context first, anecdote, question, or contrast
- Word choice level: casual, technical, academic, literary, blunt, or polished
- Punctuation habits: parentheses, colons, commas, semicolons, dashes, sparse punctuation
- Transition style: explicit connectors, abrupt turns, numbered logic, or minimal signposting
- Recurring phrases or verbal tics that are appropriate to preserve
Apply only where style matters:
- ON: blog posts, essays, speeches, interviews, marketing copy, narrative prose, adaptation requests, and user-authored documentation where preserving author voice is requested
- LIMITED: technical documentation and reports; match rhythm and terminology, but do not add personal stance
- OFF: UI strings, locale key batches, legal/official text, exact policy text, or any text where structure and fidelity outrank authorial style
Guardrail: Voice matching may adjust rhythm, diction, and sentence shape. It must not add new opinions, first-person perspective, humor, facts, examples, or emotional color that is absent from the source.
Stage 3: Reconstruct in Target Language
Rebuild from meaning as the assigned persona, following target language norms:
Word order: Follow the target language's natural structure. Quick orientation; the profile is authoritative.
- EN → KO: SVO → SOV, move verb to end, particles replace prepositions
- EN → JA: Similar SOV restructuring, honorific system alignment
- EN → ZH: Maintain SVO but restructure modifiers (pre-nominal in ZH)
- CJK → EN: topic-comment → subject-predicate, supply articles and number marking
Register matching:
- Infer from existing translations in the project, or from source text tone
- Adjust formality markers (honorifics, sentence endings, vocabulary level)
Sentence splitting/merging:
- English compound sentences often split into shorter Korean/Japanese sentences
- English bullet points may merge into flowing paragraphs in some languages
Omission of the obvious:
- Many languages (Korean, Japanese, Chinese, etc.) allow subject or pronoun omission when contextually clear
- Don't force subjects or pronouns that feel unnatural in the target language
Stage 4: Verification Gate (blocking; do not emit output until every item is confirmed)
Run the mechanical checks first, then the rubric.
A. Mechanical checks (run before rubric, must all pass):
- Profile self-check: Run the self-check list at the end of
resources/lang/{code}.md in full. Every unchecked item blocks output. This is the first check, not the last, because it is the one that catches target-language failures the shared list cannot see.
- Em dash scan: Search the draft output for
—. Handling is profile-defined. For targets whose profile forbids it (Korean, Japanese, Chinese), every occurrence must be structurally restructured, never simply substituted with : / ( / ,; zero em dashes AND zero mechanical-substitution survivors in the emitted output. For targets that permit it (English), enforce the shared ceiling of one per paragraph. (See anti-AI rules 14 and 14a.)
- Quote-mark scan: Search for
“, ”, ‘, ’. Replace with straight quotes (", ') unless the profile's typography section requires otherwise (zh-CN uses “”; Japanese uses 「」/『』; French uses «»), the source explicitly uses curly quotes, or the file format mandates them. Check the profile before stripping anything.
- Placeholder integrity: Every
{name}, {{count}}, %s, <tag>, and `code` from the source appears unchanged in the target.
- Structure parity: Headings, list bullets, table rows, code blocks, and links match the source count and nesting.
- Register consistency: One sentence-ending style throughout (don't mix
-ㅂ니다 with -다, formal with casual).
- Sibling-pattern match (when applicable): If the target lives in a context that already contains target-language siblings (markdown table rows, locale file with sibling values, glossary entries, list items in a doc), read at least 3 siblings and identify (a) separator style: comma vs
및/와/과 vs em dash vs colon vs newline, (b) action-verb form: noun-phrase fragments vs full verb phrases vs imperative, (c) loanword density, (d) register and sentence-ending style. Your draft MUST match the dominant pattern. If the draft uses a separator/verb form/register absent from siblings, BLOCK and revise. Example failure: siblings use comma-separated noun phrases without colons; your draft uses X: Y and Z colon syntax. → revise to comma form.
If any mechanical check fails, revise and re-run. Do not proceed to the rubric until all pass.
B. Translation rubric (see resources/translation-rubric.md):
- Does it read like it was originally written in the target language?
- Are domain terms consistent with existing translations in the project?
- Is the register consistent throughout?
- Is the meaning preserved (not just words)?
- Are cultural references adapted appropriately?
- Are emotional connotations preserved (not flattened into neutral descriptions)?
C. Anti-AI patterns (see resources/anti-ai-patterns.md for the shared taxonomy and resources/lang/{code}.md for how each item manifests in the target):
7. No AI vocabulary clustering or inflated significance
8. No promotional tone upgrade beyond the source
9. No synonym cycling; use consistent terminology
10. No source-language word order leaking through
11. No unnecessary bold or formatting artifacts (em dashes already covered in mechanical check A)
12. No Europeanized patterns (unnecessary connectives, passive voice, noun pile-up, over-nominalization, forced pronouns, cleft calques)
13. No humanizer-pattern leftovers: generic positive conclusions, "let's dive in" signposting, persuasive-authority tropes, formulaic "challenges/future prospects" sections, title-restating warmups, emoji decoration, or vague media/notability padding
D. Figurative language handling:
14. Were all metaphors/idioms handled per the classify decision (interpret/substitute/retain)?
15. Do figurative expressions read naturally in the target language, not as literal calques?
Translator's Notes Guidelines
When adding explanatory notes for terms, cultural references, or concepts that target readers may struggle with:
Format: translated term (original term, plain-language gloss), or translated term (original term) for well-known terms that only need the original. Bracket style follows the target's typography section in resources/lang/{code}.md: halfwidth () for Korean and English, fullwidth () for Japanese and Chinese around non-ASCII content
Calibration by audience:
- Technical readers: Skip annotation on common tech terms (API, deploy, refactor). Only annotate domain-specific or coined terms
- General readers: More generous annotation. Explain jargon, cultural references, and domain concepts in plain language
- Short texts (< 5 sentences): Minimize annotations; only annotate terms the target audience is unlikely to know
Rules:
- Annotate on first occurrence only; don't repeat the note
- Keep notes concise (aim for under 10 words)
- Explain what it means, not just provide the English original
- Don't annotate self-explanatory terms or widely recognized loanwords
- If a comprehension challenge was identified in Stage 1, use the pre-planned explanation
When to run Stage 5–7
Default ON for:
- Documentation (README, guides, API reference)
- Reports, benchmarks, changelogs, blog posts
- Marketing copy and landing pages
- Any prose longer than ~3 sentences
- Anything containing tables, bullet lists, or code blocks mixed with prose
- Translation review mode
Default OFF (Stage 4 verification only) for:
- Single short UI string (< 10 words) in a UI locale file (i18n keys,
.arb, .json, messages/) with established glossary
- Batch UI key translations where each value is independent and < 1 sentence
- User explicitly requests "fast translation", "skip reflection", or "직역"
Tie-breaker rule: When a target qualifies for BOTH ON and OFF categories, default ON wins. Common conflict cases:
| Situation |
Why both |
Resolution |
| README table cell (short AND documentation) |
<10 words but lives in README*.md |
ON: README is documentation |
| CHANGELOG line entry |
<10 words but lives in changelog |
ON: changelog is documentation |
| Skill description in registry |
short noun phrase but commits to git-tracked source |
ON: registry descriptions are documentation, not UI locale values |
| Tooltip in i18n file |
<10 words AND in messages/ |
OFF: UI string in locale file |
When in doubt, run reflection: roughly 1.5–2× tokens, against a post-merge revision that costs more. Skipping it on non-trivial content is the most common source of translationese complaints.
Extended workflow
After completing Stage 1–4, continue with:
Stage 5: Critical Review
Re-read the translation against the source with fresh eyes. Produce a diagnostic review (no rewriting yet).
Start the review by explicitly answering this question first: "What makes the draft below still feel obviously machine-translated or AI-generated?" Write 3–7 short bullets naming the remaining tells (e.g., "register suddenly shifts to formal in the final paragraph", "the same connective construction repeats three times", "noun-ending fragments survive in body text outside label/cell positions", "a metaphor was kept literal where the target language would interpret it"). Then continue with the structured checklist:
- Accuracy: Compare paragraph by paragraph. Any facts, numbers, or qualifiers altered?
- Europeanized language: Scan for unnecessary connectives, passive voice, noun pile-up, over-nominalization, forced pronouns (shared rules
19–24), using the worked examples in resources/lang/{code}.md
- Figurative language fidelity: Cross-check metaphor mapping from Stage 1. Were all handled per the classify decision? Any literal calques that sound unnatural?
- Emotional fidelity: Were subjective/emotional word choices flattened into neutral descriptions?
- Tone drift: Does the register stay consistent from start to finish, or does it shift mid-document (e.g., formal intro drifting into casual explanation)?
- Expression & flow: Flag sentences that still read like "translation-ese" (stiff phrasing, unnatural word order, awkward transitions)
- Humanization patterns: For prose, marketing, blog, report, and adaptation tasks, scan for sterile rhythm, evenly shaped paragraphs, signposting, generic conclusions, persuasive-authority tropes, formulaic challenge/future sections, emoji decoration, title-restating warmups, and filler phrases
- Voice sample fit: If a sample was provided, check whether sentence rhythm, paragraph openings, diction, punctuation, and transition style match the sample without adding unsupported meaning
- Translator's notes quality: Too many? Too few? Accurate and concise?
Stage 6: Revision
Apply all findings from Stage 5 to produce a revised translation:
- Fix accuracy issues
- Rewrite Europeanized expressions into native patterns
- Re-interpret literally translated metaphors per the mapping
- Restore flattened emotional connotations
- Restructure stiff sentences for fluency
- Adjust translator's notes per review recommendations
Stage 7: Polish
Final pass for publication quality:
- Read as a standalone piece: does it flow as native content?
- Smooth remaining rough transitions between paragraphs
- Ensure narrative voice is consistent throughout
- Final scan for surviving literal metaphors or translation-ese
- Verify formatting preservation (headings, bold, links, code blocks)
Batch Translation Rules
When translating multiple strings (e.g., UI keys):
- Read all strings first before translating any; context matters
- Scan existing translations in the project to align terminology and style
- Maintain terminology consistency across the batch
- Preserve variables and placeholders exactly as-is (
{name}, {{count}}, %s, <tag>, `code`)
- Keep key structure: only translate values, never keys
- Match length roughly for UI strings (avoid 3x longer translations that break layout)
Diff-Sync Mode (patch existing translation against source diff)
Use when the English source has changed and one or more existing target-language translations need to be brought back in sync. Triggered by oma-docs v2 multilingual sync, manual i18n catch-up after a docs PR, or any "the source moved, the translation didn't" scenario.
Inputs:
- A unified diff of the English source (
/tmp/oma-en-diff.patch or git diff snippet)
- One or more target-language file paths (existing translations of the same source)
- Optional: per-locale glossary or terminology hints
Stages override:
- PREPARE: Read the diff. Identify added, modified, removed sections.
- ACQUIRE: Read each target file. Map source positions to target positions by heading anchors and surrounding context, not by line number (line numbers will not match across translations).
- REASON: For each diff hunk, decide:
- Added section: translate fresh, splice in at the equivalent position
- Modified text: localize the modification, replace target equivalent
- Removed text: delete the target equivalent
- Touched-but-cosmetic (whitespace, formatting): skip; don't churn translation
- ACT: Apply patches via Edit tool. Match the existing translation's register, terminology, and voice (re-read at least 3 sibling sections in the target file before writing).
- VERIFY: Run Stage 4 mechanical checks (profile self-check, em-dash, placeholder integrity, structure parity) AND ensure no untouched sections were modified. Scope the profile self-check to the patched sections only, so pre-existing drift elsewhere is flagged rather than silently rewritten.
Hard rules for diff-sync:
- Touch only what the diff touched. Other sections of the target file must remain byte-identical. If you find drift outside the diff, flag it but do NOT auto-fix in the same patch.
- Preserve structural fidelity. The target file's heading hierarchy, table count, list structure must match the post-patch source.
- No line-number assumptions. Always navigate by heading text and anchor, never by absolute line.
- Code/regex/identifiers in English. Per i18n-guide rules, code blocks, JSON keys, file paths, regex patterns, workflow names, and system markers like
[OMA WORKFLOW: ...] stay verbatim.
Output format (per target file):
Target: <path>
Sections updated: <list of heading paths>
Sections skipped: <list with reason, e.g. "no semantic change">
Ambiguities resolved: <terminology decisions made>
Parallelization: When multiple target locales need the same source diff, dispatch one agent per locale in parallel. Each agent gets the same diff but different target-file path. No coordination needed since target files are disjoint.
Output Format
Single text
Source (EN):
> original text
Translation (KO):
> translated text
Notes:
- [any decisions made about ambiguous terms or cultural adaptation]
Batch (i18n files)
Output in the same format as input (JSON, ARB, YAML, etc.) with only values translated.
Review mode
Original translation:
> existing translation
Suggested revision:
> improved translation
Why:
- [specific issues: unnatural word order, wrong register, inconsistent term, etc.]
Troubleshooting
| Issue |
Solution |
| Ambiguous source meaning |
Flag and ask for context before translating |
| No precedent for a term |
Propose a translation, confirm with user before applying |
| Register conflict in source |
Follow project's existing register, note the inconsistency |
| Placeholder in middle of sentence |
Restructure around it; never break placeholder syntax |
| Translation too long for UI |
Provide a shorter alternative with note |
| Multiple valid translations for a term |
Pick the one most consistent with project's existing translations; note alternatives |
| Target language requires gendered forms |
Follow source text intent; prefer gender-neutral forms when available in target language |
| Tone shifts across a long document |
Re-read end-to-end after translating; normalize register to the dominant tone |
Execution Protocol (CLI Mode)
Vendor-specific execution protocols are injected automatically by oma agent:spawn.
Source files live under ../_shared/runtime/execution-protocols/{vendor}.md.
Logical Operations
Actions
| Action |
SSL primitive |
Evidence |
| Load target language profile |
READ |
resources/lang/{code}.md |
| Read source and context |
READ |
Text, locale files, code context |
| Select register and terminology |
SELECT |
Existing translations and domain terms |
| Infer intended meaning |
INFER |
Meaning extraction stage |
| Write translation |
WRITE |
Target-language reconstruction |
| Validate placeholders/structure |
VALIDATE |
Verification gate |
| Compare against rubric |
COMPARE |
Translation rubric |
| Report translation or notes |
NOTIFY |
Final output |
Tools and instruments
- Existing locale files and surrounding code
- Translation rubric, anti-AI-pattern rules, glossary/style references
- File editing tools only when the user requests file changes
Canonical workflow path
1. Load `resources/lang/{code}.md` for the target language; resolve the locale variant if the profile declares any.
2. Analyze source register, intent, domain terms, placeholders, and structure.
3. Reconstruct meaning in the target language, not word-for-word.
4. Run mechanical checks, the profile self-check, and `resources/translation-rubric.md` before emitting output.
5. For non-trivial prose, run Stage 5 humanization review before final polish; apply voice-sample calibration only when provided and appropriate.
For UI files, scan sibling locale files first:
rg "<source-key-or-term>" .
Resource scope
| Scope |
Resource target |
LOCAL_FS |
Locale files, docs, README, source text files |
CODEBASE |
Components and code context around UI strings |
MEMORY |
Register, glossary, ambiguity, verification notes |
USER_DATA |
User-provided text and target-language requirements |
Preconditions
- Source text and target language are known.
- The target language profile is loaded, or its absence is acknowledged in the output notes.
- Placeholder and structure constraints are identifiable.
- Ambiguities are resolved or explicitly flagged.
Effects and side effects
- Produces translated text or translation review.
- May modify locale/docs files only when requested.
- Preserves source structure and placeholders.
Guardrails
- Scan existing locale files before translating to align with project conventions
- Preserve placeholders and interpolation syntax
- Translate meaning, not words
- Preserve emotional connotations: translate the feeling, not just the dictionary meaning (e.g., "alarming" carries urgency/concern, not merely "surprising")
- Match register consistently throughout a single piece
- Split, merge, or restructure sentences for target language naturalness
- Flag ambiguous source text rather than guessing
- Preserve domain terminology: if a term has established meaning in the field (e.g., harness, scaffold, shim, polyfill, middleware), keep it even if a "simpler" native word exists
- Never produce literal word-for-word translations
- Never mix registers within a single piece (formal + casual)
- Never replace domain-specific terms with generic equivalents (e.g., "harness" → "framework", "shim" → "wrapper")
- Never translate proper nouns unless existing translations do so
- Never change the meaning to "sound better"
- Never skip verification stage for batches > 10 strings
- Never modify source file structure (keys, nesting, comments)
- Never preserve source-language formatting artifacts that are unnatural in the target language. See
resources/anti-ai-patterns.md rules 2 (-ing phrases), 14–15 (em dash, title case), and 25 (typography, which defers entirely to the language profile). For CJK targets, em dashes (—), title case in headings, and trailing "-ing" participle clauses must be restructured even when the source uses them; the exact typography rules are in resources/lang/{code}.md.
- Never "humanize" by inventing personality. Do not add first person, jokes, opinions, examples, facts, citations, stronger emotion, or messiness unless the source or user explicitly calls for adaptation.
- When a voice sample is provided, match observable style traits only: rhythm, diction level, punctuation habits, transitions, and paragraph shape. Preserve source meaning and target-language naturalness above mimicry.
- Never translate into a language whose profile exists without reading it, and never substitute a different language's profile when none exists for the target. Fall back to the shared files and say so once in the output notes.
References
Shared, language-neutral:
- Translation rubric:
resources/translation-rubric.md (5-criterion scoring: naturalness, accuracy, register, terminology, technical integrity)
- Anti-AI patterns:
resources/anti-ai-patterns.md (AI writing pattern taxonomy, rules 1–25)
Per target language (load the one matching the target):
- Korean:
resources/lang/ko.md
- Japanese:
resources/lang/ja.md
- Chinese:
resources/lang/zh.md
- English:
resources/lang/en.md
- New profile skeleton:
resources/lang/_template.md
- Context loading:
../_shared/core/context-loading.md
- Quality principles:
../_shared/core/quality-principles.md
1---2name: oma-translation-33description: Context-aware translation that preserves tone, style, and natural word order. Use when translating UI strings, documentation, marketing copy, or any multilingual content. Infers register, domain, and style from the source text and surrounding codebase context.4---56# Translation - Context-Aware Localization78## Scheduling910### Goal11Translate, review, or adapt multilingual content while preserving meaning, register, placeholders, structure, domain terminology, and natural target-language word order.1213### Intent signature14- User asks to translate, localize, review translation quality, create a glossary, or adapt UI/docs/marketing copy.15- User needs context-aware translation rather than mechanical word substitution.1617### When to use1819- Translating UI strings, error messages, or microcopy20- Translating documentation, README, or guides21- Translating marketing copy or landing pages22- Reviewing existing translations for naturalness23- Creating glossaries or translation style guides24- Any task involving multilingual content2526### When NOT to use2728- i18n infrastructure setup (key extraction, routing, build) -> use dev-workflow29- Adding new locale to framework config -> use dev-workflow30- Code-level l10n patterns (date formatting, pluralization API) -> use relevant agent3132### Expected inputs33- Source text, target language, and optional locale or audience34- Existing locale files, glossary, code context, or style constraints35- Optional user/author writing sample for voice matching in prose, marketing, dialogue, or adaptation tasks36- Placeholder syntax, formatting constraints, and output mode3738### Expected outputs39- Natural target-language translation or review findings40- Preserved placeholders, code spans, links, headings, lists, and file structure41- Translator notes when source concepts need explanation42- Batch-safe output for i18n files when requested4344### Dependencies45- Existing translations and surrounding code for register and terminology46- `resources/translation-rubric.md` and `resources/anti-ai-patterns.md` (language-neutral)47- `resources/lang/{code}.md` for the target language (required when a profile exists)48- Project locale files when translating UI strings49- User-provided voice samples when the task asks to preserve or match a specific author's style5051### Control-flow features52- Branches by content type, target language, batch size, register uncertainty, and placeholder/structure requirements53- Branches by whether a language profile exists for the target, and by locale variant when the profile declares variants54- Branches by whether style-sample calibration is available and appropriate for the content type55- Reads locale files and source context; may write translated content only when explicitly editing files56- Blocks output until mechanical verification passes5758## Structural Flow5960### Entry611. Confirm source text, target language, content type, and output mode.622. Load `resources/lang/{code}.md` for the target language (see "Language Profile Loading").633. Load existing translations, glossary, file context, or code context when available.644. Identify placeholders, formatting constraints, and ambiguity.6566### Scenes671. **PREPARE**: Load the target language profile, then determine register, domain, and structure constraints.682. **ACQUIRE**: Read existing translations and surrounding context.693. **REASON**: Analyze source meaning, connotations, figurative language, and terminology.704. **ACT**: Reconstruct natural target-language output.715. **VERIFY**: Run mechanical checks and translation rubric.726. **FINALIZE**: Emit translation, review notes, or file changes.7374### Transitions75- If context is insufficient, ask one targeted question.76- If the target language has a profile and it was not loaded, stop and load it before drafting.77- If the profile declares locale variants and none was resolved, resolve the variant before translating any string.78- If batch size is greater than 10 strings, verification is mandatory before output.79- If the output violates a typography or sentence-completion rule in the profile, rewrite before final output.80- If placeholders or structure do not match, revise and rerun verification.8182### Failure and recovery83- If source meaning is ambiguous, flag ambiguity rather than guessing.84- If project conventions conflict with literal translation, follow project conventions and explain if needed.85- If file structure is risky to modify, preserve structure and limit edits to values.8687### Exit88- Success: target text is natural, faithful, structurally equivalent, and verified.89- Partial success: ambiguous source text or missing context is explicit.9091### Context Inference9293No config file required. Instead, infer translation context from:94951. **Existing translations in the project**: scan sibling locale files to match register, terminology, and style already in use962. **File location**: `messages/`, `locales/`, `.arb` files reveal the framework and format973. **Surrounding code**: component names, comments, and variable names hint at domain and audience984. **Source text itself**: register, formality, sentence structure reveal intent99100If context is insufficient to make a confident decision, ask the user. Prefer one targeted question over a batch of questions.101102### Language Profile Loading103104Translation quality rules split into two layers. Load both; neither is sufficient alone.105106| Layer | File | Holds |107|---|---|---|108| Shared | `resources/anti-ai-patterns.md` | AI writing pattern taxonomy, rules `1`–`25`, source-side examples |109| Shared | `resources/translation-rubric.md` | 5-criterion scoring |110| Per-language | `resources/lang/{code}.md` | Register system, language-only rules, localizations of shared rules, typography, self-check |111112**Routing**: resolve the target to a BCP 47 primary subtag and read `resources/lang/{code}.md`.113114| Target | Profile | Notes |115|---|---|---|116| Korean | `lang/ko.md` | rules `KO-1`–`KO-12` |117| Japanese | `lang/ja.md` | rules `JA-1`–`JA-9` |118| Chinese | `lang/zh.md` | rules `ZH-1`–`ZH-9`; **variant resolution is mandatory** before translating |119| English | `lang/en.md` | rules `EN-1`–`EN-8`; written for CJK → EN direction |120| Anything else | none yet | fall back to shared files only |121122**Fallback rule**: when no profile exists for the target, use the shared files, apply shared rules `19`–`24` by reasoning from the target's actual grammar, and state once in the output notes that no profile was available. Do not silently borrow another language's profile: `ko.md` rules are wrong for German, and applying them produces confident errors.123124**Adding a profile**: copy `resources/lang/_template.md` to `resources/lang/{code}.md` and add the row to the routing table above. An empty profile beats an invented one.125126**Precedence**: the profile wins over the shared file when they appear to conflict, because the shared file describes the pattern and the profile describes the target. A profile may declare that a shared rule does not apply to its language (`en.md` does this for the em-dash restructuring requirement, which exists only for CJK targets).127128### Translation Method129130#### Stage 1: Analyze Source131132Read the source text and identify:133- **Register**: Formal, casual, conversational, technical, literary134- **Intent**: Inform, persuade, instruct, entertain135- **Domain terms**: Words that need consistent translation (check existing translations first)136- **Cultural references**: Idioms, metaphors, humor that won't transfer directly137- **Sentence rhythm**: Short/punchy vs. long/flowing; note parallel structures, intentional repetition, and emphasis patterns138- **Comprehension challenges**: Terms or references target readers may struggle with, such as domain jargon lacking standard translations, cultural references (pop culture, history, social norms), implicit knowledge the author assumes, wordplay or puns, named concepts (e.g., "Dunning-Kruger effect"). For each, note: the original term, why it may confuse, and a concise plain-language explanation for a potential translator's note139- **Figurative language mapping**: For each metaphor, simile, idiom, or figurative expression, classify the handling approach:140 - **Interpret**: Discard source image entirely, express the intended meaning directly in natural target language141 - **Substitute**: Replace with a target-language idiom or image that conveys the same idea and emotional effect142 - **Retain**: Keep the original image if it works equally well in the target language143- **Emotional connotations**: Words carrying subjective feeling beyond dictionary meaning (e.g., "alarming" = urgency, "haunting" = lingering unease); note the emotional effect to preserve in translation144145#### Stage 2: Extract Meaning146147Strip away source language structure. Ask yourself:148- What is the author actually trying to say?149- What emotion or tone should the reader feel?150- What action should the reader take?151152Do NOT start forming target sentences yet.153154#### Stage 2.5: Persona Assignment155156Persona resolution has two layers: **content-type** (what kind of text) and **voice** (how punchy or formal the rhythm). Both are needed.157158##### Layer 1: Read `translation_voice` from `.agents/oma-config.yaml`159160The `translation_voice` field controls global rhythm/formality. Three values:161162| Voice | Style override applied on top of content-type |163|---|---|164| `formal` | complete sentences only, no fragments, strict 합니다체/です・ます, no padding cuts |165| `balanced` (default) | content-type defaults; fragments allowed only in label/cell positions |166| `interpreter` | interpreter mindset across all content types: punchy, audience-first, spoken cadence, fragments allowed when natural in target, drops formal padding ("을 받았습니다" → "받음" / "을 모두" → drop) |167168If the field is missing, default to `balanced`. If `oma-config.yaml` is unreadable, also `balanced`.169170##### Layer 2: Content-type persona table171172| Content type | Persona | Base style markers |173|---|---|---|174| UI strings / microcopy | UX copywriter | concise, imperative, user-friendly |175| Docs / README / API reference | technical writer | data + commentary, expanded explanations |176| Benchmark / report / changelog | technical reporter | data + commentary, objective tone |177| Marketing / landing / hero copy | brand copywriter | concise impact, audience-first, aggressive transcreation |178| Blog post / essay | essayist | preserve cadence and rhythm, retain author voice |179| Literary / prose | literary translator | preserve imagery, style consistency, narrative voice |180| Dialogue / subtitle / interview | interpreter | immediacy, audience-first, spoken register, cultural context inline |181182Classification heuristics:183- File location `messages/`, `locales/`, `*.arb` → UX copywriter184- Filename `README*`, `docs/*`, or `.md` with frequent code blocks → technical writer185- Score tables, benchmark stats, changelog rows → technical reporter186- Page/section hero copy → brand copywriter187- Quote marks, em-dashes, speaker labels in source → interpreter188189When unclear, default to **technical writer** for code-adjacent content and **essayist** for prose. Never use a generic "translator" persona.190191##### Combining layers192193Voice is applied **on top** of the content-type persona. Examples:194195- Content-type = `technical reporter` + voice = `formal` → fully expanded sentences, no fragments anywhere, strict 합니다체.196- Content-type = `technical reporter` + voice = `balanced` → complete sentences in body, fragments allowed in table cells (current default).197- Content-type = `technical reporter` + voice = `interpreter` → punchier rhythm, list-item fragments allowed (e.g., "39턴 / 8m 13s / $1.28 (파일당 $0.14)" instead of "39턴, 8m 13s, 총 $1.28을 썼습니다(파일당 약 $0.14)"), drops "을 모두 받았습니다" padding.198199The persona is then **localized to the target language** at execution time. Translating into Korean as a "technical reporter" with `interpreter` voice means thinking as a Korean technical reporter who values rhythm and audience scan-speed over formal completeness.200201##### Optional Layer 3: Voice sample calibration202203If the user provides an author/user writing sample, analyze it before drafting. Use it as a style constraint, not as permission to alter meaning.204205Extract:206- Sentence length pattern: short/punchy, long/flowing, or mixed207- Paragraph entry habit: immediate claim, context first, anecdote, question, or contrast208- Word choice level: casual, technical, academic, literary, blunt, or polished209- Punctuation habits: parentheses, colons, commas, semicolons, dashes, sparse punctuation210- Transition style: explicit connectors, abrupt turns, numbered logic, or minimal signposting211- Recurring phrases or verbal tics that are appropriate to preserve212213Apply only where style matters:214- ON: blog posts, essays, speeches, interviews, marketing copy, narrative prose, adaptation requests, and user-authored documentation where preserving author voice is requested215- LIMITED: technical documentation and reports; match rhythm and terminology, but do not add personal stance216- OFF: UI strings, locale key batches, legal/official text, exact policy text, or any text where structure and fidelity outrank authorial style217218Guardrail: Voice matching may adjust rhythm, diction, and sentence shape. It must not add new opinions, first-person perspective, humor, facts, examples, or emotional color that is absent from the source.219220#### Stage 3: Reconstruct in Target Language221222Rebuild from meaning **as the assigned persona**, following target language norms:223224**Word order**: Follow the target language's natural structure. Quick orientation; the profile is authoritative.225- EN → KO: SVO → SOV, move verb to end, particles replace prepositions226- EN → JA: Similar SOV restructuring, honorific system alignment227- EN → ZH: Maintain SVO but restructure modifiers (pre-nominal in ZH)228- CJK → EN: topic-comment → subject-predicate, supply articles and number marking229230**Register matching**:231- Infer from existing translations in the project, or from source text tone232- Adjust formality markers (honorifics, sentence endings, vocabulary level)233234**Sentence splitting/merging**:235- English compound sentences often split into shorter Korean/Japanese sentences236- English bullet points may merge into flowing paragraphs in some languages237238**Omission of the obvious**:239- Many languages (Korean, Japanese, Chinese, etc.) allow subject or pronoun omission when contextually clear240- Don't force subjects or pronouns that feel unnatural in the target language241242#### Stage 4: Verification Gate (blocking; do not emit output until every item is confirmed)243244Run the mechanical checks first, then the rubric.245246**A. Mechanical checks (run before rubric, must all pass):**247248- **Profile self-check**: Run the self-check list at the end of `resources/lang/{code}.md` in full. Every unchecked item blocks output. This is the first check, not the last, because it is the one that catches target-language failures the shared list cannot see.249- **Em dash scan**: Search the draft output for `—`. Handling is profile-defined. For targets whose profile forbids it (Korean, Japanese, Chinese), every occurrence must be **structurally restructured**, never simply substituted with `:` / `(` / `,`; zero em dashes AND zero mechanical-substitution survivors in the emitted output. For targets that permit it (English), enforce the shared ceiling of one per paragraph. (See anti-AI rules `14` and `14a`.)250- **Quote-mark scan**: Search for `“`, `”`, `‘`, `’`. Replace with straight quotes (`"`, `'`) **unless** the profile's typography section requires otherwise (`zh-CN` uses `“”`; Japanese uses 「」/『』; French uses «»), the source explicitly uses curly quotes, or the file format mandates them. Check the profile before stripping anything.251- **Placeholder integrity**: Every `{name}`, `{{count}}`, `%s`, `<tag>`, and `` `code` `` from the source appears unchanged in the target.252- **Structure parity**: Headings, list bullets, table rows, code blocks, and links match the source count and nesting.253- **Register consistency**: One sentence-ending style throughout (don't mix `-ㅂ니다` with `-다`, formal with casual).254- **Sibling-pattern match (when applicable)**: If the target lives in a context that already contains target-language siblings (markdown table rows, locale file with sibling values, glossary entries, list items in a doc), read at least 3 siblings and identify (a) separator style: comma vs `및`/`와`/`과` vs em dash vs colon vs newline, (b) action-verb form: noun-phrase fragments vs full verb phrases vs imperative, (c) loanword density, (d) register and sentence-ending style. Your draft MUST match the dominant pattern. If the draft uses a separator/verb form/register absent from siblings, BLOCK and revise. Example failure: siblings use comma-separated noun phrases without colons; your draft uses `X: Y and Z` colon syntax. → revise to comma form.255256If any mechanical check fails, revise and re-run. Do not proceed to the rubric until all pass.257258**B. Translation rubric (see `resources/translation-rubric.md`):**2591. Does it read like it was originally written in the target language?2602. Are domain terms consistent with existing translations in the project?2613. Is the register consistent throughout?2624. Is the meaning preserved (not just words)?2635. Are cultural references adapted appropriately?2646. Are emotional connotations preserved (not flattened into neutral descriptions)?265266**C. Anti-AI patterns (see `resources/anti-ai-patterns.md` for the shared taxonomy and `resources/lang/{code}.md` for how each item manifests in the target):**2677. No AI vocabulary clustering or inflated significance2688. No promotional tone upgrade beyond the source2699. No synonym cycling; use consistent terminology27010. No source-language word order leaking through27111. No unnecessary bold or formatting artifacts (em dashes already covered in mechanical check A)27212. No Europeanized patterns (unnecessary connectives, passive voice, noun pile-up, over-nominalization, forced pronouns, cleft calques)27313. No humanizer-pattern leftovers: generic positive conclusions, "let's dive in" signposting, persuasive-authority tropes, formulaic "challenges/future prospects" sections, title-restating warmups, emoji decoration, or vague media/notability padding274275**D. Figurative language handling:**27614. Were all metaphors/idioms handled per the classify decision (interpret/substitute/retain)?27715. Do figurative expressions read naturally in the target language, not as literal calques?278279### Translator's Notes Guidelines280281When adding explanatory notes for terms, cultural references, or concepts that target readers may struggle with:282283**Format**: `translated term (original term, plain-language gloss)`, or `translated term (original term)` for well-known terms that only need the original. Bracket style follows the target's typography section in `resources/lang/{code}.md`: halfwidth `()` for Korean and English, fullwidth `()` for Japanese and Chinese around non-ASCII content284285**Calibration by audience**:286- **Technical readers**: Skip annotation on common tech terms (API, deploy, refactor). Only annotate domain-specific or coined terms287- **General readers**: More generous annotation. Explain jargon, cultural references, and domain concepts in plain language288- **Short texts** (< 5 sentences): Minimize annotations; only annotate terms the target audience is unlikely to know289290**Rules**:291- Annotate on first occurrence only; don't repeat the note292- Keep notes concise (aim for under 10 words)293- Explain *what it means*, not just provide the English original294- Don't annotate self-explanatory terms or widely recognized loanwords295- If a comprehension challenge was identified in Stage 1, use the pre-planned explanation296297### When to run Stage 5–7298299Default ON for:300- Documentation (README, guides, API reference)301- Reports, benchmarks, changelogs, blog posts302- Marketing copy and landing pages303- Any prose longer than ~3 sentences304- Anything containing tables, bullet lists, or code blocks mixed with prose305- Translation review mode306307Default OFF (Stage 4 verification only) for:308- Single short UI string (< 10 words) **in a UI locale file** (i18n keys, `.arb`, `.json`, `messages/`) with established glossary309- Batch UI key translations where each value is independent and < 1 sentence310- User explicitly requests "fast translation", "skip reflection", or "직역"311312**Tie-breaker rule**: When a target qualifies for BOTH ON and OFF categories, default ON wins. Common conflict cases:313314| Situation | Why both | Resolution |315|---|---|---|316| README table cell (short AND documentation) | <10 words but lives in `README*.md` | ON: README is documentation |317| CHANGELOG line entry | <10 words but lives in changelog | ON: changelog is documentation |318| Skill description in registry | short noun phrase but commits to git-tracked source | ON: registry descriptions are documentation, not UI locale values |319| Tooltip in i18n file | <10 words AND in `messages/` | OFF: UI string in locale file |320321When in doubt, run reflection: roughly 1.5–2× tokens, against a post-merge revision that costs more. Skipping it on non-trivial content is the most common source of translationese complaints.322323### Extended workflow324325After completing Stage 1–4, continue with:326327**Stage 5: Critical Review**328329Re-read the translation against the source with fresh eyes. Produce a diagnostic review (no rewriting yet).330331Start the review by explicitly answering this question first: **"What makes the draft below still feel obviously machine-translated or AI-generated?"** Write 3–7 short bullets naming the remaining tells (e.g., "register suddenly shifts to formal in the final paragraph", "the same connective construction repeats three times", "noun-ending fragments survive in body text outside label/cell positions", "a metaphor was kept literal where the target language would interpret it"). Then continue with the structured checklist:332333- **Accuracy**: Compare paragraph by paragraph. Any facts, numbers, or qualifiers altered?334- **Europeanized language**: Scan for unnecessary connectives, passive voice, noun pile-up, over-nominalization, forced pronouns (shared rules `19`–`24`), using the worked examples in `resources/lang/{code}.md`335- **Figurative language fidelity**: Cross-check metaphor mapping from Stage 1. Were all handled per the classify decision? Any literal calques that sound unnatural?336- **Emotional fidelity**: Were subjective/emotional word choices flattened into neutral descriptions?337- **Tone drift**: Does the register stay consistent from start to finish, or does it shift mid-document (e.g., formal intro drifting into casual explanation)?338- **Expression & flow**: Flag sentences that still read like "translation-ese" (stiff phrasing, unnatural word order, awkward transitions)339- **Humanization patterns**: For prose, marketing, blog, report, and adaptation tasks, scan for sterile rhythm, evenly shaped paragraphs, signposting, generic conclusions, persuasive-authority tropes, formulaic challenge/future sections, emoji decoration, title-restating warmups, and filler phrases340- **Voice sample fit**: If a sample was provided, check whether sentence rhythm, paragraph openings, diction, punctuation, and transition style match the sample without adding unsupported meaning341- **Translator's notes quality**: Too many? Too few? Accurate and concise?342343**Stage 6: Revision**344345Apply all findings from Stage 5 to produce a revised translation:346- Fix accuracy issues347- Rewrite Europeanized expressions into native patterns348- Re-interpret literally translated metaphors per the mapping349- Restore flattened emotional connotations350- Restructure stiff sentences for fluency351- Adjust translator's notes per review recommendations352353**Stage 7: Polish**354355Final pass for publication quality:356- Read as a standalone piece: does it flow as native content?357- Smooth remaining rough transitions between paragraphs358- Ensure narrative voice is consistent throughout359- Final scan for surviving literal metaphors or translation-ese360- Verify formatting preservation (headings, bold, links, code blocks)361362### Batch Translation Rules363364When translating multiple strings (e.g., UI keys):3653661. **Read all strings first** before translating any; context matters3672. **Scan existing translations** in the project to align terminology and style3683. **Maintain terminology consistency** across the batch3694. **Preserve variables and placeholders** exactly as-is (`{name}`, `{{count}}`, `%s`, `<tag>`, `` `code` ``)3705. **Keep key structure**: only translate values, never keys3716. **Match length roughly** for UI strings (avoid 3x longer translations that break layout)372373### Diff-Sync Mode (patch existing translation against source diff)374375Use when the English source has changed and one or more existing target-language translations need to be brought back in sync. Triggered by `oma-docs` v2 multilingual sync, manual i18n catch-up after a docs PR, or any "the source moved, the translation didn't" scenario.376377**Inputs**:378- A unified diff of the English source (`/tmp/oma-en-diff.patch` or git diff snippet)379- One or more target-language file paths (existing translations of the same source)380- Optional: per-locale glossary or terminology hints381382**Stages override**:3831. **PREPARE**: Read the diff. Identify added, modified, removed sections.3842. **ACQUIRE**: Read each target file. Map source positions to target positions by **heading anchors and surrounding context**, not by line number (line numbers will not match across translations).3853. **REASON**: For each diff hunk, decide:386 - *Added section*: translate fresh, splice in at the equivalent position387 - *Modified text*: localize the modification, replace target equivalent388 - *Removed text*: delete the target equivalent389 - *Touched-but-cosmetic* (whitespace, formatting): skip; don't churn translation3904. **ACT**: Apply patches via Edit tool. Match the existing translation's register, terminology, and voice (re-read at least 3 sibling sections in the target file before writing).3915. **VERIFY**: Run Stage 4 mechanical checks (profile self-check, em-dash, placeholder integrity, structure parity) AND ensure no untouched sections were modified. Scope the profile self-check to the patched sections only, so pre-existing drift elsewhere is flagged rather than silently rewritten.392393**Hard rules for diff-sync**:394- **Touch only what the diff touched.** Other sections of the target file must remain byte-identical. If you find drift outside the diff, flag it but do NOT auto-fix in the same patch.395- **Preserve structural fidelity.** The target file's heading hierarchy, table count, list structure must match the post-patch source.396- **No line-number assumptions.** Always navigate by heading text and anchor, never by absolute line.397- **Code/regex/identifiers in English.** Per i18n-guide rules, code blocks, JSON keys, file paths, regex patterns, workflow names, and system markers like `[OMA WORKFLOW: ...]` stay verbatim.398399**Output format (per target file)**:400```401Target: <path>402Sections updated: <list of heading paths>403Sections skipped: <list with reason, e.g. "no semantic change">404Ambiguities resolved: <terminology decisions made>405```406407**Parallelization**: When multiple target locales need the same source diff, dispatch one agent per locale in parallel. Each agent gets the same diff but different target-file path. No coordination needed since target files are disjoint.408409### Output Format410411#### Single text412```413Source (EN):414> original text415416Translation (KO):417> translated text418419Notes:420- [any decisions made about ambiguous terms or cultural adaptation]421```422423#### Batch (i18n files)424Output in the same format as input (JSON, ARB, YAML, etc.) with only values translated.425426#### Review mode427```428Original translation:429> existing translation430431Suggested revision:432> improved translation433434Why:435- [specific issues: unnatural word order, wrong register, inconsistent term, etc.]436```437438### Troubleshooting439440| Issue | Solution |441|-------|----------|442| Ambiguous source meaning | Flag and ask for context before translating |443| No precedent for a term | Propose a translation, confirm with user before applying |444| Register conflict in source | Follow project's existing register, note the inconsistency |445| Placeholder in middle of sentence | Restructure around it; never break placeholder syntax |446| Translation too long for UI | Provide a shorter alternative with note |447| Multiple valid translations for a term | Pick the one most consistent with project's existing translations; note alternatives |448| Target language requires gendered forms | Follow source text intent; prefer gender-neutral forms when available in target language |449| Tone shifts across a long document | Re-read end-to-end after translating; normalize register to the dominant tone |450451### Execution Protocol (CLI Mode)452453Vendor-specific execution protocols are injected automatically by `oma agent:spawn`.454Source files live under `../_shared/runtime/execution-protocols/{vendor}.md`.455456## Logical Operations457458### Actions459| Action | SSL primitive | Evidence |460|--------|---------------|----------|461| Load target language profile | `READ` | `resources/lang/{code}.md` |462| Read source and context | `READ` | Text, locale files, code context |463| Select register and terminology | `SELECT` | Existing translations and domain terms |464| Infer intended meaning | `INFER` | Meaning extraction stage |465| Write translation | `WRITE` | Target-language reconstruction |466| Validate placeholders/structure | `VALIDATE` | Verification gate |467| Compare against rubric | `COMPARE` | Translation rubric |468| Report translation or notes | `NOTIFY` | Final output |469470### Tools and instruments471- Existing locale files and surrounding code472- Translation rubric, anti-AI-pattern rules, glossary/style references473- File editing tools only when the user requests file changes474475### Canonical workflow path476```text4771. Load `resources/lang/{code}.md` for the target language; resolve the locale variant if the profile declares any.4782. Analyze source register, intent, domain terms, placeholders, and structure.4793. Reconstruct meaning in the target language, not word-for-word.4804. Run mechanical checks, the profile self-check, and `resources/translation-rubric.md` before emitting output.4815. For non-trivial prose, run Stage 5 humanization review before final polish; apply voice-sample calibration only when provided and appropriate.482```483484For UI files, scan sibling locale files first:485```bash486rg "<source-key-or-term>" .487```488489### Resource scope490| Scope | Resource target |491|-------|-----------------|492| `LOCAL_FS` | Locale files, docs, README, source text files |493| `CODEBASE` | Components and code context around UI strings |494| `MEMORY` | Register, glossary, ambiguity, verification notes |495| `USER_DATA` | User-provided text and target-language requirements |496497### Preconditions498- Source text and target language are known.499- The target language profile is loaded, or its absence is acknowledged in the output notes.500- Placeholder and structure constraints are identifiable.501- Ambiguities are resolved or explicitly flagged.502503### Effects and side effects504- Produces translated text or translation review.505- May modify locale/docs files only when requested.506- Preserves source structure and placeholders.507508### Guardrails5095101. Scan existing locale files before translating to align with project conventions5112. Preserve placeholders and interpolation syntax5123. Translate meaning, not words5134. Preserve emotional connotations: translate the feeling, not just the dictionary meaning (e.g., "alarming" carries urgency/concern, not merely "surprising")5145. Match register consistently throughout a single piece5156. Split, merge, or restructure sentences for target language naturalness5167. Flag ambiguous source text rather than guessing5178. Preserve domain terminology: if a term has established meaning in the field (e.g., harness, scaffold, shim, polyfill, middleware), keep it even if a "simpler" native word exists5189. Never produce literal word-for-word translations51910. Never mix registers within a single piece (formal + casual)52011. Never replace domain-specific terms with generic equivalents (e.g., "harness" → "framework", "shim" → "wrapper")52112. Never translate proper nouns unless existing translations do so52213. Never change the meaning to "sound better"52314. Never skip verification stage for batches > 10 strings52415. Never modify source file structure (keys, nesting, comments)52516. Never preserve source-language formatting artifacts that are unnatural in the target language. See `resources/anti-ai-patterns.md` rules `2` (-ing phrases), `14`–`15` (em dash, title case), and `25` (typography, which defers entirely to the language profile). For CJK targets, em dashes (`—`), title case in headings, and trailing "-ing" participle clauses must be restructured even when the source uses them; the exact typography rules are in `resources/lang/{code}.md`.52617. Never "humanize" by inventing personality. Do not add first person, jokes, opinions, examples, facts, citations, stronger emotion, or messiness unless the source or user explicitly calls for adaptation.52718. When a voice sample is provided, match observable style traits only: rhythm, diction level, punctuation habits, transitions, and paragraph shape. Preserve source meaning and target-language naturalness above mimicry.52819. Never translate into a language whose profile exists without reading it, and never substitute a different language's profile when none exists for the target. Fall back to the shared files and say so once in the output notes.529530## References531532Shared, language-neutral:533534- Translation rubric: `resources/translation-rubric.md` (5-criterion scoring: naturalness, accuracy, register, terminology, technical integrity)535- Anti-AI patterns: `resources/anti-ai-patterns.md` (AI writing pattern taxonomy, rules `1`–`25`)536537Per target language (load the one matching the target):538539- Korean: `resources/lang/ko.md`540- Japanese: `resources/lang/ja.md`541- Chinese: `resources/lang/zh.md`542- English: `resources/lang/en.md`543- New profile skeleton: `resources/lang/_template.md`544- Context loading: `../_shared/core/context-loading.md`545- Quality principles: `../_shared/core/quality-principles.md`