oma-translation
Context-aware translation and localization for UI strings, documentation, marketing copy, and prose. Preserves meaning, register, terminology, placeholders, structure, and natural target-language phrasing.
- License 许可
- MIT
- 最近更新
- 2026-11-10
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- oma-translation
- description
- Context-aware translation and localization for UI strings, documentation, marketing copy, and prose. Preserves meaning, register, terminology, placeholders, structure, and natural target-language phrasing.
02 资源文件 7
- 参考文档resources/anti-ai-patterns.md16.4 KB
- 参考文档resources/lang/_template.md2.8 KB
- 参考文档resources/lang/en.md7.6 KB
- 参考文档resources/lang/ja.md8.8 KB
- 参考文档resources/lang/ko.md13.9 KB
- 参考文档resources/lang/zh.md8.1 KB
- 参考文档resources/translation-rubric.md4.8 KB
03 SKILL.md 正文
Translation - Context-Aware Localization
Scheduling
Goal
Translate, review, or adapt multilingual content faithfully and naturally while preserving the parts that must remain exact: placeholders, code, links, formatting, terminology, and file structure.
Intent signature
- Translate, localize, review a translation, adapt copy, or create a glossary/style guide.
- Update target-language files after the source changed.
When to use
- UI strings, error messages, locale files, documentation, reports, marketing copy, and prose.
- Review of existing translations for accuracy, register, terminology, or naturalness.
When NOT to use
- i18n infrastructure, locale registration, or key extraction -> use the relevant development skill.
- Date/pluralization APIs or other code-level localization -> use the owning code-domain skill.
Expected inputs
- Source text, target language or locale, content type, and requested output mode.
- Existing locale files, glossary, surrounding context, and optional author sample.
- Placeholder and formatting constraints when the source is structured.
Expected outputs
- Natural target-language text or evidence-backed review findings.
- Exact preservation of placeholders, code spans, links, headings, list structure, and locale keys.
- Translator notes only for meaningful ambiguity or necessary cultural explanation.
Dependencies
- Target profile:
resources/lang/{code}.md, if one exists. resources/translation-rubric.mdfor substantive content or review.resources/anti-ai-patterns.mdwhen prose needs style review.- Existing siblings and glossary when translating into a project.
Control-flow features
- Branches by UI batch versus prose, profile availability, locale variant, ambiguity, and review mode.
- Loads only the target profile and references required for the content type.
- Edits files only when the user asked for file changes.
Structural Flow
Entry
- Identify source, target locale, content type, and whether this is translate, review, or diff-sync.
- Preserve exact tokens first: placeholders, code, URLs, keys, and structural markers.
- Load the target profile if available; read sibling translations when the target is in a project.
Scenes
- PREPARE: Resolve locale, output mode, target audience, and protected syntax.
- ACQUIRE: Read the target profile, relevant siblings, glossary, and source context. For prose or review, load the rubric; load anti-AI patterns only when style review is needed.
- REASON: Determine meaning, register, terminology, cultural references, and any ambiguity. Decide whether an idiom should be interpreted, substituted, or retained.
- ACT: Write natural target-language text. Match established project patterns without adding meaning, opinion, or personality.
- VERIFY: Check protected syntax and structure. For substantive text, check meaning, terminology, register, and target-language naturalness against the rubric.
- FINALIZE: Return the requested text, patch, or review with only supported findings.
Transitions
- A profile exists -> load it; its target-language rules take precedence over shared guidance.
- A locale variant is required -> resolve it before drafting.
- No profile exists -> use shared guidance and note that limit once; do not borrow another language's rules.
- A short independent UI string with established siblings -> use protected-syntax and sibling checks; the full prose review is optional.
- Long prose, documentation, marketing copy, mixed tables/code, or review mode -> use the rubric.
- Ambiguous meaning that changes the result -> ask one targeted question or flag the choice.
- Diff-sync -> modify only source-touched equivalents, located by headings and surrounding context, not line number.
Failure and recovery
| Failure | Recovery |
|---|---|
| Missing target context | Use the source register and state the assumption, unless the ambiguity changes meaning |
| Conflicting literal wording and project convention | Follow the established target convention and explain a material difference |
| Placeholder or structure mismatch | Revise before emitting or applying a patch |
| Missing profile | Use shared guidance and identify the coverage limit once |
| Unclear cultural reference | Add a concise note only when the target audience needs it |
Exit
- Success: the text is faithful, natural, structurally safe, and checked in proportion to content risk.
- Partial: unresolved ambiguity or missing context is stated without inventing an answer.
Language profile loading
Resolve the BCP 47 primary subtag and load one matching profile when present:
| Target | Profile |
|---|---|
| Korean | resources/lang/ko.md |
| Japanese | resources/lang/ja.md |
| Chinese | resources/lang/zh.md; resolve the declared variant |
| English | resources/lang/en.md |
| Other | no profile; use shared guidance |
Profiles define typography, register, and target-language checks. Shared guidance explains common
risks. A profile wins if they conflict. Add a new profile from resources/lang/_template.md only
when the task is to extend this skill.
Translation method
- Read for meaning, intended effect, domain terms, and protected syntax. Identify figurative wording as interpret, substitute, or retain. Do not add a new metaphor or remove an intentional one without a reason.
- Choose register from the source, target audience, and sibling translations. Apply
translation_voicefrom.agents/oma-config.yamlonly as a rhythm/formality preference:formal,balanced(default), orinterpreter. It never overrides meaning or target norms. - Reconstruct in the target language. Change word order, split or merge sentences, and omit implied subjects only when the target language calls for it.
- Preserve author style only where it belongs: prose, dialogue, adaptation, or explicitly user-authored documentation. Match observable rhythm and diction, never add facts, stance, jokes, first person, or stronger emotion.
Verification
Always check:
- Every placeholder, code span, identifier, URL, and locale key is unchanged.
- Headings, links, table rows, list nesting, and code blocks retain their structure.
- The target follows its profile's typography and register rules.
- Existing siblings are matched when they establish terminology or UI style.
For substantive content and review mode, also check the rubric: meaning, naturalness, terminology, register, cultural fit, and emotional force. Use anti-AI patterns as a diagnostic, not a demand to make prose decorative or to remove intentional source style.
Review mode
Review from evidence, not from an expectation that every draft is machine-translated. Record zero findings when no material defect is confirmed. Separate:
- Accuracy or safety defects: changed meaning, broken placeholder, incorrect term, or wrong register.
- Supported style findings: a concrete target-language issue with a reason and proposed fix.
- Preferences: optional alternatives that do not make the existing translation wrong.
Do not rewrite a sound translation merely to produce findings.
Batch and diff-sync work
For batches, read the complete set first, translate values only, and maintain one terminology and register decision. Verify placeholders and key structure across the set.
For diff-sync, map each source hunk by heading and surrounding context. Touch only the affected target section; leave unrelated text byte-identical. State updated sections, skipped cosmetic hunks, and material terminology decisions.
Output formats
For a single text, present the translation and brief notes for ambiguities or adaptations. For files, preserve the input format and modify only requested values. For review, show the original, the suggested revision only when warranted, and the evidence for each finding.
Logical Operations
Actions
| Action | SSL primitive | Evidence |
|---|---|---|
| Resolve locale and mode | SELECT |
User request and file context |
| Read profile and siblings conditionally | READ |
Target profile, glossary, nearby translations |
| Protect syntax and structure | VALIDATE |
Source tokens and structural markers |
| Infer meaning and register | INFER |
Source, audience, project convention |
| Translate or revise | WRITE |
Target text or requested file patch |
| Review substantive content | VALIDATE |
Rubric and concrete findings |
| Report result and limits | NOTIFY |
Translation, patch, or review |
Tools and instruments
- Native search/read for local source and sibling translations.
- Configured
code_intelligencecapability when available for code-context navigation; native search/read when it is unavailable or times out. - Target profile, rubric, anti-AI patterns, and language-template resources as selected above.
Canonical workflow path
- Resolve target locale and protect exact syntax.
- Load the one applicable language profile and relevant siblings; load rubric/style resources only for substantive content or review.
- Infer meaning, register, terminology, and figurative-language handling.
- Draft in natural target order and project style.
- Verify exact syntax and structure, then review substantive content against the rubric.
- Emit the requested translation, patch, or evidence-backed review. State a missing-profile or context limitation when material.
Resource scope
| Scope | Resource target |
|---|---|
LOCAL_FS |
Source/target files, glossaries, language profiles |
CODEBASE |
Sibling translations and code context |
PROCESS |
Native search and syntax checks |
MEMORY |
Locale, terminology, register, protected syntax, unresolved ambiguity |
Effects and side effects
- Produces translated text or review findings.
- Changes locale/docs files only when explicitly requested.
- Retains source structure, identifiers, and placeholders.
Guardrails
- Preserve meaning, protected syntax, and file structure before stylistic preference.
- Do not invent facts, opinions, emotional emphasis, examples, citations, or personality.
- Do not use a different language's profile as a substitute.
- Do not change untouched sections during diff-sync.
- Do not claim completion of a check that the available source cannot support.
References
- Translation rubric:
resources/translation-rubric.md(load for substantive content or review) - Style diagnostics:
resources/anti-ai-patterns.md(load when prose style needs review) - Target profiles:
resources/lang/{ko,ja,zh,en}.md(load one matching profile) - Profile template:
resources/lang/_template.md(only when adding a profile) - Shared context loading:
../_shared/core/context-loading.md - Shared quality principles:
../_shared/core/quality-principles.md
04 同仓库更多 Skills
type-strictness
Enforce strict type compliance by eliminating `Any` types and `# type: ignore` comments. Use when: (1) Editing code that contains `Any` as a type annotation (2) Code has `# type: ignore` or `# pyright: ignore` comments (3) User requests type fixes or type strictness enforcement (4) Importing from untyped third-party libraries (5) User asks to "fix types", "remove Any", or "add proper typing" (6) Pyrefly or mypy reports type errors that need resolution (7) Code review reveals weak typing patterns Follows hierarchical resolution: codebase inference → type stubs → library inspection → type guards → casting (last resort).
slopgate-test-extender
Extend Python test suites with parametrization, fixture reuse, and quality enforcement. Use when asked to add tests, extend existing tests, improve test coverage, consolidate duplicate tests, fix test quality issues, or when Slopgate reports untested-production-code, missing test references, or coverage gaps. Triggers on requests like "add tests for X", "extend these tests", "parametrize tests", "consolidate tests", "fix test quality", "improve test coverage", "write tests for this function", "test this module", "behavior tests", "integration tests", "missing tests", "coverage holes", "untested code", or when a hook denies with test-related findings.
slopgate-intelligent-coding-patterns
Pattern-selection playbook for agents editing code with complex branching, stateful parsers/workflows, duplicated skeletons, policy checks, or ordered transforms. Load before refactoring if/elif dispatch chains, boolean-flag state machines, repeated validation predicates, parallel provider/language implementations, or regex/content transformation pipelines. Also load when asked to "apply a design pattern", "which pattern should I use here", "refactor this switch statement", "replace if-elif chain", "state machine pattern", "strategy pattern", "template method", "pipeline pattern", "specification pattern", "dispatch table", "guard clause refactor", "reduce cyclomatic complexity", or when Slopgate fires PY-CODE-014, PY-CODE-017, PY-CODE-018, QUALITY-LINT-001, or PY-QUALITY-010. Use with behavior-locking tests and avoid pattern theater for simple one-off code.
slopgate-hygiene-orchestrator
Orchestrate systematic elimination of linter warnings and errors across Python, TypeScript, and Rust codebases. Use when asked to "clean up lints", "fix all warnings", "run hygiene", "eliminate type errors", "orchestrate code quality fixes", "fix lint errors", "resolve quality gate failures", "pass CI checks", "reduce tech debt", "refactor to pass hooks", or when a Slopgate hook denies with QUALITY-LINT-001, PY-CODE-017, PY-CODE-018, or any collector finding. This skill coordinates multiple code-hygiene-enforcer agents working in parallel on non-conflicting file groupings, tracks progress persistently via JSON exports, and loops until all issues are resolved. CRITICAL: Never run linters directly—always use `slopgate lint check` as the primary gate, discover project-specific tools from config files, and export findings to JSON for tracking.
slopgate-code-smell-utility-locator
Autoactivate when code-smell hooks or reviews mention feature envy, thin wrappers, duplicate helpers, duplicate code, scattered helpers, builders/factories/config/constants/dataclass reuse, PY-CODE-012, PY-CODE-013, QUALITY-LINT-001, or repeated slopgate code-quality denials. Also load when asked to "find existing helpers", "consolidate utilities", "search for duplicate code", "where is this already implemented", "reuse existing logic", "don't duplicate this", "find similar functions", "utility inventory", "code smell radar", or before adding new helpers/wrappers so agents can find existing shared utilities and consolidate instead of duplicating.
slopgate-code-hygiene-refactor
Recovery playbook for Slopgate and project quality failures. Load after hook/lint denials such as PY-CODE-017 flat sibling modules, PY-CODE-018 oversized modules, QUALITY-LINT-001 post-edit quality backstops, PY-QUALITY-010 magic numbers / repeated literals, PY-CODE-012/PY-CODE-013 smell findings, type-suppression bans, duplicate helpers, or repeated hygiene retry loops. Also load when asked to "refactor this module", "split this file", "extract a class", "reduce complexity", "fix god class", "flatten module hierarchy", "move code to a package", "extract helpers", "consolidate duplicates", "replace magic numbers with constants", or when a hook blocks an edit with structural complaints. Focuses on preserving public APIs while refactoring toward packages, cohesive modules, typed seams, and focused tests.