Skip to content
7 changes: 7 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ make progress # Check translation progress
### reST Syntax
- Preserve `:mod:`, `:func:`, `:class:`, `:term:`, `:ref:`, `:pep:` roles
- Use `\\ ` as zero-width separator when Chinese precedes reST syntax
- `\\ ` is also required when a role/literal/emphasis close is immediately followed by an
**opening** full-width punctuation mark (`(`, `「`, `『`) — confirmed by corpus-wide grep:
~1 unescaped vs ~473 escaped occurrences. Example: `` :class:`Widget`\\ ( ``.
- `\\ ` is **not** needed before **closing/medial** full-width punctuation (`。`, `,`, `:`,
`;`, `!`, `?`, `」`, `』`, `)`) — this is the dominant, unescaped, CI-passing convention
throughout the corpus (thousands of unescaped examples vs. a handful of escaped outliers).
Do not add `\\ ` there even if it looks visually similar to the open-paren case.

## Key Resources

Expand Down
5 changes: 1 addition & 4 deletions c-api/buffer.po
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,8 @@ msgid ""
msgstr ""

#: ../../c-api/buffer.rst:266
#, fuzzy
msgid "This is an alias to :c:macro:`PyBUF_WRITABLE`."
msgstr ""
"這是 :c:macro:`PyBUF_WRITABLE` 的\\ :term:`軟性棄用 <soft deprecated>`\\ 別"
"名。"
msgstr "此為 :c:macro:`PyBUF_WRITABLE` 的別名。"

#: ../../c-api/buffer.rst:272
msgid ""
Expand Down
4 changes: 4 additions & 0 deletions c-api/bytes.po
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,10 @@ msgid ""
"\"stolen\", the value of *\\*bytes* will be set to ``NULL``, and the "
"appropriate exception will be set."
msgstr ""
"在 *\\*bytes* 中建立一個新的 bytes 物件,其內容為 *newpart* 附加到 *bytes* 之"
"後的結果;呼叫者將擁有新的參照。*bytes* 舊值的參照將被「:term:`竊取 "
"<steal>`」。如果無法建立新物件,*bytes* 的舊參照仍將被「竊取」,*\\*bytes* 的"
"值將被設為 ``NULL``,並會設定適當的例外。"

#: ../../c-api/bytes.rst:190 ../../c-api/bytes.rst:200
msgid ""
Expand Down
2 changes: 1 addition & 1 deletion c-api/code.po
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ msgstr ""

#: ../../c-api/code.rst:217
msgid "This is a function that does nothing."
msgstr ""
msgstr "此函式不執行任何操作。"

#: ../../c-api/code.rst:219
msgid ""
Expand Down
49 changes: 47 additions & 2 deletions c-api/descriptor.po
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ msgid ""
"Create a new get-set descriptor for extension type *type* from the :c:type:"
"`PyGetSetDef` structure *getset*."
msgstr ""
"從 :c:type:`PyGetSetDef` 結構 *getset* 為擴充型別 *type* 建立一個新的 get-"
"set 描述器。"

#: ../../c-api/descriptor.rst:21
msgid ""
Expand All @@ -50,6 +52,10 @@ msgid ""
"of descriptor created for entries in :c:member:`~PyTypeObject.tp_getset`, "
"and it appears in Python as a :class:`types.GetSetDescriptorType` object."
msgstr ""
"get-set 描述器所公開的屬性是由 C 取得器 (getter) 和設定器 (setter) 函式實作"
"的,而不是直接儲存在實例中。這與 :c:member:`~PyTypeObject.tp_getset` 中各項目"
"所建立的是同一種描述器,並在 Python 中以 :class:`types.GetSetDescriptorType` "
"物件的形式呈現。"

#: ../../c-api/descriptor.rst:26 ../../c-api/descriptor.rst:39
#: ../../c-api/descriptor.rst:70 ../../c-api/descriptor.rst:101
Expand All @@ -58,12 +64,16 @@ msgid ""
"On success, return a :term:`strong reference` to the descriptor. Return "
"``NULL`` with an exception set on failure."
msgstr ""
"成功時,回傳一個對描述器的 :term:`strong reference`\\ 。失敗時,回傳 "
"``NULL`` 並設定例外。"

#: ../../c-api/descriptor.rst:31
msgid ""
"Create a new member descriptor for extension type *type* from the :c:type:"
"`PyMemberDef` structure *member*."
msgstr ""
"從 :c:type:`PyMemberDef` 結構 *member* 為擴充型別 *type* 建立一個新的 member "
"描述器。"

#: ../../c-api/descriptor.rst:34
msgid ""
Expand All @@ -72,6 +82,9 @@ msgid ""
"member:`~PyTypeObject.tp_members`, and it appears in Python as a :class:"
"`types.MemberDescriptorType` object."
msgstr ""
"member 描述器將型別的 C 結構欄位公開為 Python 屬性。這與 :c:member:"
"`~PyTypeObject.tp_members` 中各項目所建立的是同一種描述器,並在 Python 中以 :"
"class:`types.MemberDescriptorType` 物件的形式呈現。"

#: ../../c-api/descriptor.rst:44
msgid ""
Expand All @@ -89,12 +102,17 @@ msgid ""
"type attributes. They correspond to :class:`types.GetSetDescriptorType` "
"objects in Python."
msgstr ""
"此為由 :c:type:`PyGetSetDef` 結構所建立的 get-set 描述器物件的型別物件。這些"
"描述器實作了值由 C 取得器和設定器函式計算得出的屬性,並用於許多內建型別屬性。"
"它們對應於 Python 中的 :class:`types.GetSetDescriptorType` 物件。"

#: ../../c-api/descriptor.rst:62
msgid ""
"Create a new method descriptor for extension type *type* from the :c:type:"
"`PyMethodDef` structure *meth*."
msgstr ""
"從 :c:type:`PyMethodDef` 結構 *meth* 為擴充型別 *type* 建立一個新的 method 描"
"述器。"

#: ../../c-api/descriptor.rst:65
msgid ""
Expand All @@ -103,6 +121,9 @@ msgid ""
"tp_methods`, and it appears in Python as a :class:`types."
"MethodDescriptorType` object."
msgstr ""
"method 描述器將 C 函式公開為型別上的方法。這與 :c:member:`~PyTypeObject."
"tp_methods` 中各項目所建立的是同一種描述器,並在 Python 中以 :class:`types."
"MethodDescriptorType` 物件的形式呈現。"

#: ../../c-api/descriptor.rst:75
msgid ""
Expand All @@ -111,24 +132,31 @@ msgid ""
"a type, and correspond to :class:`types.MethodDescriptorType` objects in "
"Python."
msgstr ""
"此為由 :c:type:`PyMethodDef` 結構所建立的 method 描述器物件的型別物件。這些描"
"述器將 C 函式公開為型別上的方法,並對應於 Python 中的 :class:`types."
"MethodDescriptorType` 物件。"

#: ../../c-api/descriptor.rst:83
msgid "Describes a slot wrapper used by :c:func:`PyDescr_NewWrapper`."
msgstr ""
msgstr "描述由 :c:func:`PyDescr_NewWrapper` 所使用的 slot wrapper。"

#: ../../c-api/descriptor.rst:85
msgid ""
"Each ``wrapperbase`` record stores the Python-visible name and metadata for "
"a special method implemented by a type slot, together with the wrapper "
"function used to adapt that slot to Python's calling convention."
msgstr ""
"每筆 ``wrapperbase`` 紀錄都儲存了由某個型別 slot 所實作的特殊方法之 Python 可"
"見名稱與中繼資料,以及用來將該 slot 轉接為 Python 呼叫慣例的 wrapper 函式。"

#: ../../c-api/descriptor.rst:91
msgid ""
"Create a new wrapper descriptor for extension type *type* from the :c:struct:"
"`wrapperbase` structure *base* and the wrapped slot function pointer "
"*wrapped*."
msgstr ""
"從 :c:struct:`wrapperbase` 結構 *base* 和被包裝的 slot 函式指標 *wrapped* 為"
"擴充型別 *type* 建立一個新的 wrapper 描述器。"

#: ../../c-api/descriptor.rst:96
msgid ""
Expand All @@ -137,6 +165,9 @@ msgid ""
"methods such as ``__repr__`` or ``__add__``, and it appears in Python as a :"
"class:`types.WrapperDescriptorType` object."
msgstr ""
"wrapper 描述器將由型別 slot 實作的特殊方法公開出來。這與 CPython 為 "
"``__repr__``\\ 、``__add__`` 等基於 slot 的特殊方法所建立的是同一種描述器,並"
"在 Python 中以 :class:`types.WrapperDescriptorType` 物件的形式呈現。"

#: ../../c-api/descriptor.rst:106
msgid ""
Expand All @@ -152,6 +183,8 @@ msgid ""
"Create a new class method descriptor for extension type *type* from the :c:"
"type:`PyMethodDef` structure *method*."
msgstr ""
"從 :c:type:`PyMethodDef` 結構 *method* 為擴充型別 *type* 建立一個新的 class "
"method 描述器。"

#: ../../c-api/descriptor.rst:118
msgid ""
Expand All @@ -160,6 +193,10 @@ msgid ""
"``METH_CLASS`` entries in :c:member:`~PyTypeObject.tp_methods`, and it "
"appears in Python as a :class:`types.ClassMethodDescriptorType` object."
msgstr ""
"class method 描述器所公開的 C 方法,在被存取時接收的是類別本身而非實例。這"
"與 :c:member:`~PyTypeObject.tp_methods` 中 ``METH_CLASS`` 項目所建立的是同一"
"種描述器,並在 Python 中以 :class:`types.ClassMethodDescriptorType` 物件的形"
"式呈現。"

#: ../../c-api/descriptor.rst:128
msgid ""
Expand All @@ -174,7 +211,7 @@ msgstr ""
msgid ""
"Create a new bound wrapper object from the wrapper descriptor *d* and the "
"instance *self*."
msgstr ""
msgstr "從 wrapper 描述器 *d* 和實例 *self* 建立一個新的已繫結 wrapper 物件。"

#: ../../c-api/descriptor.rst:138
msgid ""
Expand All @@ -183,12 +220,17 @@ msgid ""
"accessed through an instance, and they appear in Python as :class:`types."
"MethodWrapperType` objects."
msgstr ""
"這是由 :c:func:`PyDescr_NewWrapper` 所建立的 wrapper 描述器的已繫結形式。當 "
"slot wrapper 透過實例被存取時,CPython 就會建立這些物件,它們在 Python 中以 :"
"class:`types.MethodWrapperType` 物件的形式出現。"

#: ../../c-api/descriptor.rst:143
msgid ""
"On success, return a :term:`strong reference` to the wrapper object. Return "
"``NULL`` with an exception set on failure."
msgstr ""
"成功時,回傳一個對 wrapper 物件的 :term:`strong reference`\\ 。失敗時,回傳 "
"``NULL`` 並設定例外。"

#: ../../c-api/descriptor.rst:147
msgid "Built-in descriptors"
Expand All @@ -213,6 +255,9 @@ msgid ""
"extension types, and corresponds to :class:`types.ClassMethodDescriptorType` "
"objects in Python."
msgstr ""
"此為 C 層級 class method 描述器物件的型別物件。這是為 C 擴充型別中定義的 :"
"func:`classmethod` 所建立的描述器之型別,並對應於 Python 中的 :class:`types."
"ClassMethodDescriptorType` 物件。"

#: ../../c-api/descriptor.rst:171
msgid ""
Expand Down
3 changes: 3 additions & 0 deletions c-api/dict.po
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ msgid ""
"on success or ``-1`` on failure. This function *does not* \":term:`steal`\" "
"a reference to *val*."
msgstr ""
"以 *key* 為鍵,將 *val* 插入至字典 *p* 中。*key* 必須是\\ :term:`可雜湊的 "
"<hashable>`,否則將引發 :exc:`TypeError`。成功時回傳 ``0``,失敗時回傳 "
"``-1``。此函式\\ *不會*\\ 「:term:`竊取 <steal>`」對 *val* 的參照。"

#: ../../c-api/dict.rst:103
msgid ""
Expand Down
18 changes: 16 additions & 2 deletions c-api/exceptions.po
Original file line number Diff line number Diff line change
Expand Up @@ -539,14 +539,16 @@ msgid ""
"exception if one is set. If *exc* is ``NULL``, just clear the existing "
"exception."
msgstr ""
"將 *exc* 設定為目前正在引發的例外,如果已經設定了現有例外,則將其清除。如果 "
"*exc* 為 ``NULL``,則只清除現有的例外。"

#: ../../c-api/exceptions.rst:505
msgid "*exc* must be a valid exception or ``NULL``."
msgstr ""
msgstr "*exc* 必須是一個有效的例外或 ``NULL``。"

#: ../../c-api/exceptions.rst:507
msgid "This call \":term:`steals <steal>`\" a reference to *exc*."
msgstr ""
msgstr "此呼叫「:term:`竊取 <steal>`」對 *exc* 的參照。"

#: ../../c-api/exceptions.rst:516
msgid "Use :c:func:`PyErr_GetRaisedException` instead."
Expand Down Expand Up @@ -702,6 +704,10 @@ msgid ""
"arguments. This function is kept for backwards compatibility. Prefer using :"
"c:func:`PyErr_SetHandledException`."
msgstr ""
"設定例外資訊,如同從 ``sys.exc_info()`` 得知的資訊一般。這裡指的是一個 *已經"
"被捕捉* 的例外,而不是剛被引發的例外。此函式「:term:`竊取 <steal>`」這些引數"
"的參照。若要清除例外狀態,請為所有三個引數傳入 ``NULL``。此函式是為了向後相容"
"而保留,建議改用 :c:func:`PyErr_SetHandledException`。"

#: ../../c-api/exceptions.rst:653
msgid ""
Expand All @@ -718,6 +724,9 @@ msgid ""
"argument). The function still \":term:`steals <steal>`\" references of all "
"three arguments."
msgstr ""
"引數 ``type`` 和 ``traceback`` 已不再使用,可以為 NULL。直譯器現在會從例外實"
"例(引數 ``value``)中衍生出它們。此函式仍會「:term:`竊取 <steal>`」所有三個"
"引數的參照。"

#: ../../c-api/exceptions.rst:668
msgid "Signal Handling"
Expand Down Expand Up @@ -936,6 +945,8 @@ msgid ""
"clear it. There is no type check to make sure that *ctx* is an exception "
"instance. This \":term:`steals <steal>`\" a reference to *ctx*."
msgstr ""
"將與該例外關聯的情境設定為 *ctx*。使用 ``NULL`` 來清除它。這裡不會檢查型別以"
"確保 *ctx* 是一個例外實例。此函式「:term:`竊取 <steal>`」對 *ctx* 的參照。"

#: ../../c-api/exceptions.rst:861
msgid ""
Expand All @@ -952,6 +963,9 @@ msgid ""
"exception instance or ``None``. This \":term:`steals <steal>`\" a reference "
"to *cause*."
msgstr ""
"將與該例外關聯的成因設定為 *cause*。使用 ``NULL`` 來清除它。這裡不會檢查型別"
"以確保 *cause* 是一個例外實例或 ``None``。此函式「:term:`竊取 <steal>`」對 "
"*cause* 的參照。"

#: ../../c-api/exceptions.rst:874
msgid ""
Expand Down
37 changes: 29 additions & 8 deletions c-api/frame.po
Original file line number Diff line number Diff line change
Expand Up @@ -269,45 +269,48 @@ msgstr ""
msgid ""
"An array of executable kinds (executor types) for frames, used for internal "
"debugging and tracing."
msgstr ""
msgstr "一個 frame 可執行種類(執行器類型)的陣列,用於內部除錯與追蹤。"

#: ../../c-api/frame.rst:253
msgid ""
"Tools like debuggers and profilers can use this to identify the type of "
"execution context associated with a frame (such as to filter out internal "
"frames). The entries are indexed by the following constants:"
msgstr ""
"除錯器和分析器(profiler)等工具可以用這個陣列來識別與某個 frame 相關聯的執行"
"環境類型(例如用來過濾掉內部 frame)。陣列項目由下列常數索引:"

#: ../../c-api/frame.rst:261
msgid "Constant"
msgstr ""
msgstr "常數"

#: ../../c-api/frame.rst:262
msgid "Description"
msgstr ""
msgstr "描述"

#: ../../c-api/frame.rst:264
msgid ""
"The frame is internal (For example: inlined) and should be skipped by tools."
msgstr ""
msgstr "此 frame 是內部的(例如:被行內化),工具應該略過它。"

#: ../../c-api/frame.rst:266
msgid "The frame corresponds to a standard Python function."
msgstr ""
msgstr "此 frame 對應到一個標準的 Python 函式。"

#: ../../c-api/frame.rst:268
msgid "The frame corresponds to a function defined in native code."
msgstr ""
msgstr "此 frame 對應到一個以原生程式碼定義的函式。"

#: ../../c-api/frame.rst:270
msgid "The frame corresponds to a method on a class instance."
msgstr ""
msgstr "此 frame 對應到一個類別實例上的方法。"

#: ../../c-api/frame.rst:272
msgid ""
"However, Python's C API lacks a function to read the executable kind from a "
"frame. Instead, use this recipe:"
msgstr ""
"然而,Python 的 C API 缺少可以從 frame 讀取可執行種類的函式。請改用以下方法:"

#: ../../c-api/frame.rst:275
msgid ""
Expand All @@ -330,7 +333,25 @@ msgid ""
" return PyUnstable_EXECUTABLE_KIND_SKIP;\n"
"}"
msgstr ""
"int\n"
"get_executable_kind(PyFrameObject *frame)\n"
"{\n"
" _PyInterpreterFrame *f = frame->f_frame;\n"
" PyObject *exec = PyStackRef_AsPyObjectBorrow(f->f_executable);\n"
"\n"
" if (PyCode_Check(exec)) {\n"
" return PyUnstable_EXECUTABLE_KIND_PY_FUNCTION;\n"
" }\n"
" if (PyMethod_Check(exec)) {\n"
" return PyUnstable_EXECUTABLE_KIND_BUILTIN_FUNCTION;\n"
" }\n"
" if (Py_IS_TYPE(exec, &PyMethodDescr_Type)) {\n"
" return PyUnstable_EXECUTABLE_KIND_METHOD_DESCRIPTOR;\n"
" }\n"
"\n"
" return PyUnstable_EXECUTABLE_KIND_SKIP;\n"
"}"

#: ../../c-api/frame.rst:301
msgid "The number of entries in :c:data:`PyUnstable_ExecutableKinds`."
msgstr ""
msgstr ":c:data:`PyUnstable_ExecutableKinds` 中的項目數量。"
Loading
Loading