Skip to content

Commit a938e22

Browse files
author
ken
committed
fix: improve translation consistency and clarity in import documentation, also update skill
1 parent d3b2ff1 commit a938e22

File tree

3 files changed

+45
-13
lines changed

3 files changed

+45
-13
lines changed

.claude/skills/terminology-check.md

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,28 @@ These Simplified Chinese terms MUST be converted:
8080
| 轉義 | 跳脫 | escape |
8181
| 基類 | 基底類別 | base class |
8282

83+
## Context Decision Log (Rule)
84+
When a reviewer decides a translation depends on nearby context (above/below),
85+
record the decision here for future reference. Keep entries short and specific.
86+
87+
Format:
88+
- **Term/pattern:** ...
89+
- **Decision:** ...
90+
- **Context cue:** ...
91+
- **Example:** `source` -> `translation`
92+
93+
Example:
94+
- **Term/pattern:** 類型 / 型別
95+
- **Decision:** 用語依上下文;Python 型別物件用「型別」,一般分類用「類型」
96+
- **Context cue:** 出現 `int/str/dict/type` 或 "type object"
97+
- **Example:** "two types of packages" -> "兩種類型的套件"
98+
99+
Decision Log:
100+
- **Term/pattern:** 類型 / 型別
101+
- **Decision:** 用語依上下文;Python 型別物件用「型別」,一般分類用「類型」
102+
- **Context cue:** 出現 `int/str/dict/type` 或 "type object"
103+
- **Example:** "two types of packages" -> "兩種類型的套件"
104+
83105
## High-Frequency Terms (Keep in English)
84106

85107
These terms should NOT be translated, even if glossary has translations:
@@ -143,9 +165,10 @@ Core Python terms with required zh_TW translations:
143165

144166
1. **Extract terms** - Parse msgstr for Chinese phrases and English words
145167
2. **Check forbidden** - Flag any zh_CN variants from the forbidden list
146-
3. **Check consistency** - Compare with other translations of same term
147-
4. **Check glossary** - Verify against official glossary.po
148-
5. **Report issues** - List violations with suggestions
168+
3. **Consult context log** - Check the Context Decision Log for any applicable rules
169+
4. **Check consistency** - Compare with other translations of same term
170+
5. **Check glossary** - Verify against official glossary.po
171+
6. **Report issues** - List violations with suggestions
149172

150173
## Output Format
151174

@@ -157,6 +180,9 @@ FORBIDDEN TERMS (must fix):
157180
Line 78: "返回" -> "回傳" (return)
158181
Line 156: "對象" -> "物件" (object)
159182
183+
REVIEW (context-dependent):
184+
Line 88: "類型" (see Context Decision Log)
185+
160186
INCONSISTENT TERMS (review):
161187
"iterator" translated as:
162188
- "疊代器" (45 occurrences) <- standard

.claude/skills/validate-translation.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ metadata:
5757
| Inconsistent term | WARNING | Same term translated differently |
5858
| High-freq term translated | INFO | Terms like `int`, `list` should stay English |
5959

60+
### 7. Context-Dependent Decisions
61+
| Check | Severity | Description |
62+
|-------|----------|-------------|
63+
| Reviewer context rule | INFO | If a reviewer decides a term/pattern depends on nearby context, record it in the Context Decision Log in `terminology-check` for future reference. |
64+
6065
## Validation Process
6166

6267
1. **Read the PO entry** - Parse msgid, msgstr, comments, and flags
@@ -65,7 +70,8 @@ metadata:
6570
4. **Check spacing** - Verify CJK-Latin spacing
6671
5. **Check line length** - Ensure <= 79 characters
6772
6. **Check reST** - Validate roles, links, escaping
68-
7. **Check terminology** - Cross-reference with glossary
73+
7. **Check terminology** - Cross-reference with glossary and Context Decision Log
74+
8. **Record context rules** - If a decision depends on nearby context, add it to the Context Decision Log
6975

7076
## Output Format
7177

reference/import.po

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ msgstr ""
252252
"命名空間套件是由不同的\\ :term:`部分 <portion>` 組成的,每個部分都為父套件提"
253253
"供一個子套件。這些部分可以位於檔案系統上的不同位置。部分可能也存在於壓縮檔案"
254254
"中、網路上,或 Python 在引入時搜尋的任何其他地方。命名空間套件不一定直接對應"
255-
"於檔案系統中的對象;它們可能是沒有具體表示的虛擬模組。"
255+
"於檔案系統中的物件;它們可能是沒有具體表示的虛擬模組。"
256256

257257
#: ../../reference/import.rst:143
258258
msgid ""
@@ -406,14 +406,14 @@ msgstr ""
406406
"Python 包含多個預設的尋檢器和引入器。第一個尋檢器知道如何定位內建模組,第二個"
407407
"尋檢器知道如何定位凍結模組。第三個預設尋檢器會在 :term:`import path` 中搜尋模"
408408
"組。:term:`import path` 是一個位置的列表,這些位置可能是檔案系統路徑或壓縮檔"
409-
"案,也可以擴展以搜尋任何可定位的資源,例如由 URL 識別的資源。"
409+
"案,也可以擴充以搜尋任何可定位的資源,例如由 URL 識別的資源。"
410410

411411
#: ../../reference/import.rst:232
412412
msgid ""
413413
"The import machinery is extensible, so new finders can be added to extend "
414414
"the range and scope of module searching."
415415
msgstr ""
416-
"引入機制是可擴展的,因此可以增加新的尋檢器來擴展模組搜尋的範圍和作用域。"
416+
"引入機制是可擴充的,因此可以增加新的尋檢器來擴充模組搜尋的範圍和作用域。"
417417

418418
#: ../../reference/import.rst:235
419419
msgid ""
@@ -433,7 +433,7 @@ msgid ""
433433
"import machinery."
434434
msgstr ""
435435
"以下各節將更詳細地描述尋檢器和載入器的協定,包括如何建立和註冊新的尋檢器和載"
436-
"入器來擴展引入機制。"
436+
"入器來擴充引入機制。"
437437

438438
#: ../../reference/import.rst:243
439439
msgid ""
@@ -455,7 +455,7 @@ msgid ""
455455
"this are the *import hooks*. There are two types of import hooks: *meta "
456456
"hooks* and *import path hooks*."
457457
msgstr ""
458-
"引入機制的設計是可擴展的;其主要機制是\\ *引入掛鉤*。引入掛鉤有兩種類型:*元"
458+
"引入機制的設計是可擴充的;其主要機制是\\ *引入掛鉤*。引入掛鉤有兩種類型:*元"
459459
"掛鉤 (meta hooks)* 和\\ *引入路徑掛鉤*。"
460460

461461
#: ../../reference/import.rst:263
@@ -468,7 +468,7 @@ msgid ""
468468
msgstr ""
469469
"元掛鉤會在引入處理的開始階段被呼叫,除了查找 :data:`sys.modules` 快取外,其他"
470470
"引入處理還未發生時就會呼叫。這允許元掛鉤覆蓋 :data:`sys.path` 的處理、凍結模"
471-
"組,甚至是內建模組。元掛鉤透過將新的尋檢器物件添加到 :data:`sys.meta_path` 中"
471+
"組,甚至是內建模組。元掛鉤透過將新的尋檢器物件新增到 :data:`sys.meta_path` 中"
472472
"來註冊,具體描述請參閱以下段落。"
473473

474474
#: ../../reference/import.rst:269
@@ -480,7 +480,7 @@ msgid ""
480480
msgstr ""
481481
"引入路徑掛鉤被視為 :data:`sys.path`\\ (或 ``package.__path__``)處理過程的一"
482482
"部分來呼叫,當遇到與其相關聯的路徑項目時就會被觸發。引入路徑掛鉤透過將新的可"
483-
"呼叫對象增加到 :data:`sys.path_hooks` 中來註冊,具體描述請參閱以下段落。"
483+
"呼叫物件增加到 :data:`sys.path_hooks` 中來註冊,具體描述請參閱以下段落。"
484484

485485
#: ../../reference/import.rst:276
486486
msgid "The meta path"
@@ -719,7 +719,7 @@ msgid ""
719719
"code example above), as summarized in a :ref:`later section <import-mod-"
720720
"attrs>`."
721721
msgstr ""
722-
"模組建立後、在執行之前,引入機制會設置與引入相關的模組屬性(在上面的偽程式碼"
722+
"模組建立後、在執行之前,引入機制會設定與引入相關的模組屬性(在上面的偽程式碼"
723723
"範例中為 \"_init_module_attrs\"),具體內容在\\ :ref:`之後的段落<import-mod-"
724724
"attrs>`\\ 會總結。"
725725

@@ -1241,7 +1241,7 @@ msgid ""
12411241
"protocol described below, which was then used to get a loader for the module "
12421242
"from the web."
12431243
msgstr ""
1244-
"基於路徑的尋檢器提供了額外的掛鉤和協定,讓你可以擴展和自訂可搜尋的路徑條目類"
1244+
"基於路徑的尋檢器提供了額外的掛鉤和協定,讓你可以擴充和自訂可搜尋的路徑條目類"
12451245
"型。例如,如果你希望支援將路徑條目作為網路 URLs,你可以撰寫一個實作 HTTP 語意"
12461246
"的掛鉤,用於在網路上尋找模組。這個掛鉤(一個可呼叫物件)會回傳一個支援下述協"
12471247
"定的 :term:`path entry finder` ,該尋檢器隨後用於從網路中取得模組的載入器。"

0 commit comments

Comments
 (0)