|
| 1 | +--- |
| 2 | +name: translate-po |
| 3 | +description: Core skill for translating PO file entries from English to Traditional Chinese. Orchestrates doc-translate, rst-translate, and terminology-check. |
| 4 | +metadata: |
| 5 | + short-description: Translate PO entries EN->zh_TW |
| 6 | +--- |
| 7 | + |
| 8 | +# translate-po |
| 9 | + |
| 10 | +## Scope |
| 11 | +- Translate English PO msgid entries to Traditional Chinese msgstr |
| 12 | +- Apply all formatting, punctuation, and spacing rules |
| 13 | +- Preserve reStructuredText syntax exactly |
| 14 | +- Maintain terminology consistency with glossary |
| 15 | +- Mark uncertain translations with fuzzy flag |
| 16 | + |
| 17 | +## Prerequisites |
| 18 | + |
| 19 | +Before translating, always: |
| 20 | +1. Read the full msgid to understand context |
| 21 | +2. Check msgctxt for additional context if present |
| 22 | +3. Review translator comments (#. and #:) |
| 23 | +4. Look up unfamiliar terms in glossary references |
| 24 | + |
| 25 | +## Translation Workflow |
| 26 | + |
| 27 | +### Step 1: Analyze Content Type |
| 28 | + |
| 29 | +Identify what you're translating: |
| 30 | +- **Pure prose** - No markup, straightforward translation |
| 31 | +- **Code-only** - Preserve exactly, do not translate |
| 32 | +- **Mixed** - Prose with inline code/roles (most common) |
| 33 | +- **reST structural** - Directives, links, complex markup |
| 34 | + |
| 35 | +### Step 2: Apply Translation Rules |
| 36 | + |
| 37 | +#### Punctuation |
| 38 | +``` |
| 39 | +Chinese sentences -> Full-width: 「」()、,。:;!? |
| 40 | +English sentences -> Half-width: (),.;:!? |
| 41 | +``` |
| 42 | + |
| 43 | +#### Spacing |
| 44 | +``` |
| 45 | +Add space between CJK and Latin: 使用 CPU 運算 |
| 46 | +No space with symbols: 使用「CPU」運算 |
| 47 | +``` |
| 48 | + |
| 49 | +#### Terminology |
| 50 | +- Use `terminology-check` skill for reference |
| 51 | +- High-frequency terms stay English: int, float, str, list, tuple, dict, iterator, generator |
| 52 | +- Follow glossary for standard terms |
| 53 | + |
| 54 | +### Step 3: Handle reST Syntax |
| 55 | + |
| 56 | +Use `rst-translate` skill rules: |
| 57 | + |
| 58 | +#### Roles - Keep syntax, translate display text if needed |
| 59 | +``` |
| 60 | +:mod:`os` -> :mod:`os` (unchanged) |
| 61 | +:term:`iterator` -> :term:`疊代器 <iterator>` |
| 62 | +:ref:`section-name` -> :ref:`章節名稱 <section-name>` |
| 63 | +``` |
| 64 | + |
| 65 | +#### Backslash Escaping |
| 66 | +``` |
| 67 | +CJK before role: 參閱\\ :mod:`os` |
| 68 | +CJK after link: `連結 <url>`_\\ 中 |
| 69 | +Full-width after: :term:`object`\\( |
| 70 | +``` |
| 71 | + |
| 72 | +#### Literal Blocks |
| 73 | +``` |
| 74 | +msgid "Example::" |
| 75 | +msgstr "範例: ::" |
| 76 | +``` |
| 77 | + |
| 78 | +### Step 4: Format Output |
| 79 | + |
| 80 | +#### Line Wrapping (max 79 chars) |
| 81 | +``` |
| 82 | +msgstr "" |
| 83 | +"第一行翻譯內容" |
| 84 | +"第二行繼續翻譯。" |
| 85 | +``` |
| 86 | + |
| 87 | +#### Fuzzy Flag |
| 88 | +Add `#, fuzzy` when: |
| 89 | +- Translation is uncertain |
| 90 | +- Machine-translated content |
| 91 | +- Needs human review |
| 92 | + |
| 93 | +``` |
| 94 | +#, fuzzy |
| 95 | +msgid "Original text" |
| 96 | +msgstr "可能需要審核的翻譯" |
| 97 | +``` |
| 98 | + |
| 99 | +## Quality Checklist |
| 100 | + |
| 101 | +Before finalizing, verify: |
| 102 | +- [ ] Line length <= 79 characters |
| 103 | +- [ ] Punctuation rules followed (full-width for Chinese) |
| 104 | +- [ ] Spacing rules followed (space between CJK/Latin) |
| 105 | +- [ ] reST syntax preserved exactly |
| 106 | +- [ ] Terminology consistent with glossary |
| 107 | +- [ ] No empty msgstr (unless intentionally skipping) |
| 108 | + |
| 109 | +## Examples |
| 110 | + |
| 111 | +### Simple Prose |
| 112 | +``` |
| 113 | +msgid "Python is a programming language." |
| 114 | +msgstr "Python 是一種程式語言。" |
| 115 | +``` |
| 116 | + |
| 117 | +### With Terminology |
| 118 | +``` |
| 119 | +msgid "This function returns an iterator." |
| 120 | +msgstr "此函式回傳一個疊代器。" |
| 121 | +``` |
| 122 | + |
| 123 | +### With reST Role |
| 124 | +``` |
| 125 | +msgid "See :func:`len` for details." |
| 126 | +msgstr "詳情請參閱\\ :func:`len`。" |
| 127 | +``` |
| 128 | + |
| 129 | +### With Link |
| 130 | +``` |
| 131 | +msgid "Visit the `Python website <https://python.org>`_." |
| 132 | +msgstr "請造訪 `Python 網站 <https://python.org>`_。" |
| 133 | +``` |
| 134 | + |
| 135 | +### With Term Reference |
| 136 | +``` |
| 137 | +msgid "Returns a :term:`context manager`." |
| 138 | +msgstr "回傳一個\\ :term:`情境管理器 <context manager>`。" |
| 139 | +``` |
| 140 | + |
| 141 | +### Mixed Content |
| 142 | +``` |
| 143 | +msgid "The :class:`list` type is a :term:`mutable` sequence." |
| 144 | +msgstr ":class:`list` 型別是一個\\ :term:`可變物件 <mutable>` 序列。" |
| 145 | +``` |
| 146 | + |
| 147 | +## Related Skills |
| 148 | +- `doc-translate` - General translation rules |
| 149 | +- `rst-translate` - reST-specific rules |
| 150 | +- `terminology-check` - Terminology validation |
| 151 | +- `validate-translation` - Post-translation validation |
| 152 | + |
| 153 | +## References |
| 154 | +- Terminology: `doc-translate/references/terminology.md` |
| 155 | +- Glossary: `glossary.po` |
| 156 | +- Wiki: https://github.com/python/python-docs-zh-tw/wiki/術語列表 |
0 commit comments