oma-translator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTranslator - Context-Aware Translation
翻译工具 - 上下文感知翻译
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
- 翻译UI strings、错误提示信息或微文案
- 翻译文档、README或指南
- 翻译营销文案或着陆页
- 审核现有翻译的自然度
- 创建术语表或翻译风格指南
- 任何涉及多语言内容的任务
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
- i18n基础设施搭建(键提取、路由、构建)→ 使用dev-workflow
- 为框架配置添加新语言区域 → 使用dev-workflow
- 代码级L10n模式(日期格式化、复数API)→ 使用相关Agent
Core Rules
核心规则
- Scan existing locale files before translating to align with project conventions
- Preserve placeholders and interpolation syntax
- Translate meaning, not words
- Match register consistently throughout a single piece
- Split/restructure sentences for target language naturalness
- Flag ambiguous source text rather than guessing
- Preserve domain terminology as-is — 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)
- 翻译前扫描现有locale文件,确保符合项目约定
- 保留placeholders和interpolation syntax
- 翻译含义,而非字面单词
- 单篇内容中保持register一致
- 调整句子拆分/结构以符合目标语言的自然表达
- 标记含义模糊的源文本,而非主观猜测
- 保留领域术语原样——若术语在该领域有既定含义(如harness、scaffold、shim、polyfill、middleware),即使存在更“简单”的本土词汇也需保留
- 绝对不能进行逐字直译
- 单篇内容中绝对不能混合不同register(正式+非正式)
- 绝对不能用通用词汇替换领域特定术语(如将"harness"替换为"framework","shim"替换为"wrapper")
- 专有名词绝对不翻译,除非已有通用译法
- 绝对不能为了“听起来更好”而改变原意
- 批量翻译超过10条字符串时,绝对不能跳过验证环节
- 绝对不能修改源文件结构(键、嵌套、注释)
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/files reveal the framework and format.arb - 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.
无需配置文件。可从以下来源推断翻译上下文:
- 项目中的现有翻译 —— 扫描同目录locale文件,匹配已在使用的register、术语和风格
- 文件位置 —— 、
messages/、locales/文件可揭示框架和格式.arb - 周边代码 —— 组件名称、注释和变量名可暗示领域和受众
- 源文本本身 —— register、正式程度、句子结构可揭示意图
若上下文不足以做出确定判断,请询问用户。优先提出针对性问题,而非批量提问。
Translation Method
翻译方法
Stage 1: Analyze Source
阶段1:分析源文本
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
阅读源文本并识别:
- Register:正式、非正式、口语化、技术性、文学性
- 意图:告知、说服、指导、娱乐
- 领域术语:需要统一翻译的词汇(先检查现有翻译)
- 文化引用:无法直接转换的习语、隐喻、幽默内容
- 句子节奏:简短有力 vs 冗长流畅
Stage 2: Extract Meaning
阶段2:提取含义
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 3: Reconstruct in Target Language
阶段3:目标语言重构
Rebuild from meaning, following target language norms:
Word order: Follow target language's natural structure.
- 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)
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:
- Korean/Japanese allow subject omission when contextually clear
- Don't force subjects that feel unnatural
基于含义重新组织内容,遵循目标语言规范:
语序:遵循目标语言的自然结构。
- 英→韩:SVO→SOV,将动词移至句末,用助词替代介词
- 英→日:类似SOV结构调整,适配敬语体系
- 英→中:保持SVO但调整修饰语位置(中文修饰语前置)
Register匹配:
- 从项目现有翻译或源文本语气推断
- 调整正式程度标记(敬语、句末用词、词汇等级)
句子拆分/合并:
- 英语复合句通常拆分为更短的韩语/日语句子
- 英语项目符号列表在某些语言中可能合并为流畅段落
省略冗余内容:
- 韩语/日语在上下文明确时可省略主语
- 不要强行添加不符合自然表达的主语
Stage 4: Verify
阶段4:验证
Check against 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?
Check against anti-AI patterns (see ):
6. No AI vocabulary clustering or inflated significance
7. No promotional tone upgrade beyond the source
8. No synonym cycling — consistent terminology
9. No source-language word order leaking through
10. No unnecessary bold, em dashes, or formatting artifacts
resources/anti-ai-patterns.md对照评分标准(见)检查:
resources/translation-rubric.md- 读起来是否像目标语言原生内容?
- 领域术语是否与项目现有翻译一致?
- 单篇内容中register是否一致?
- 含义是否完整保留(而非仅字面单词)?
- 文化引用是否适配得当?
对照反AI模式(见)检查:
6. 无AI词汇堆砌或过度夸大表述
7. 语气升级未超出源文本的营销属性
8. 无同义词重复使用——术语保持一致
9. 无源语言语序残留
10. 无多余的粗体、破折号或格式瑕疵
resources/anti-ai-patterns.mdBatch 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)
翻译多条字符串(如UI键)时:
- 先通读所有字符串再开始翻译——上下文至关重要
- 扫描项目现有翻译以对齐术语和风格
- 批量内容中保持术语一致
- 完全保留变量和占位符(、
{name}、{{count}}、%s、<tag>)`code` - 保留键结构——仅翻译值,绝不修改键
- UI字符串大致匹配长度(避免翻译后长度超过3倍导致布局错乱)
Output Format
输出格式
Single text
单文本
Source (EN):
> original text
Translation (KO):
> translated text
Notes:
- [any decisions made about ambiguous terms or cultural adaptation]Source (EN):
> original text
Translation (KO):
> translated text
Notes:
- [any decisions made about ambiguous terms or cultural adaptation]Batch (i18n files)
批量(i18n文件)
Output in the same format as input (JSON, ARB, YAML, etc.) with only values translated.
输出格式与输入一致(JSON、ARB、YAML等),仅翻译值部分。
Review mode
审核模式
Original translation:
> existing translation
Suggested revision:
> improved translation
Why:
- [specific issues: unnatural word order, wrong register, inconsistent term, etc.]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 |
| 问题 | 解决方案 |
|---|---|
| 源文本含义模糊 | 标记并在翻译前询问上下文 |
| 术语无先例参考 | 提出翻译方案,经用户确认后再应用 |
| 源文本存在register冲突 | 遵循项目现有register,同时标注不一致之处 |
| 占位符位于句中 | 围绕占位符调整结构;绝不破坏占位符语法 |
| 翻译内容过长导致UI布局错乱 | 提供更简短的替代版本并标注说明 |
How to Execute
执行步骤
Follow the translation method (Stage 1-4) step by step.
Before submitting, verify against and .
resources/translation-rubric.mdresources/anti-ai-patterns.md逐步遵循翻译方法(阶段1-4)。提交前,对照和进行验证。
resources/translation-rubric.mdresources/anti-ai-patterns.mdExecution Protocol (CLI Mode)
执行协议(CLI模式)
Vendor-specific execution protocols are injected automatically by .
Source files live under .
oh-my-ag agent:spawn../_shared/runtime/execution-protocols/{vendor}.md厂商特定执行协议由自动注入。源文件位于。
oh-my-ag agent:spawn../_shared/runtime/execution-protocols/{vendor}.mdReferences
参考资料
- Translation rubric:
resources/translation-rubric.md - Anti-AI patterns:
resources/anti-ai-patterns.md - Context loading:
../_shared/core/context-loading.md - Quality principles:
../_shared/core/quality-principles.md
- 翻译评分标准:
resources/translation-rubric.md - 反AI模式:
resources/anti-ai-patterns.md - 上下文加载:
../_shared/core/context-loading.md - 质量原则:
../_shared/core/quality-principles.md