From a61e0c211e054a3431c8384f3bc79b0bb9f9788d Mon Sep 17 00:00:00 2001 From: "W. H. Wang" Date: Wed, 30 Sep 2026 01:51:45 +0800 Subject: [PATCH 1/2] fix: align cross-reference roles with the English source 13 translated messages use a different role from their msgid, for example `:data:`typing.Union`` where the source says `:class:`typing.Union``. Five of them render with no link at all, because the role points at the wrong domain: * library/asyncio-eventloop.po (x3): `socket-unix-constants` is a label, but the translation used `:py:const:`, which looks for a Python object of that name and finds none. The `~` prefix is dropped too, since `:ref:` does not strip a module path. * whatsnew/3.12.po (x2): `Py_TPFLAGS_ITEMS_AT_END` and `Py_TPFLAGS_IMMUTABLETYPE` are C macros, but the translation used `:const:`, which only searches the Python domain. The other eight still resolve, because the Python domain's `find_obj()` ignores the object type when the target has no leading dot, so only the rendered CSS class differs. They are corrected for consistency. Only the role token changed in each message; the translated text is otherwise untouched. Co-Authored-By: Claude Opus 5 --- library/asyncio-eventloop.po | 11 +++++------ library/asyncio-future.po | 4 ++-- library/functools.po | 2 +- library/stdtypes.po | 6 +++--- library/sys.po | 2 +- library/typing.po | 7 +++---- tutorial/errors.po | 4 ++-- whatsnew/3.12.po | 15 ++++++++------- 8 files changed, 25 insertions(+), 26 deletions(-) diff --git a/library/asyncio-eventloop.po b/library/asyncio-eventloop.po index 63235b98fec..ddde165b4e6 100644 --- a/library/asyncio-eventloop.po +++ b/library/asyncio-eventloop.po @@ -1065,8 +1065,8 @@ msgid "" "is not defined then this capability is unsupported." msgstr "" "*reuse_port* 告訴核心允許將此端點綁定到與其他現有端點相同的埠,只要它們在建立" -"時都設定了此旗標。此選項不受 Windows 和某些 Unix 系統支援。如果未定義 :py:" -"const:`socket.SO_REUSEPORT ` 常數,則不支援此功能。" +"時都設定了此旗標。此選項不受 Windows 和某些 Unix 系統支援。如果未定義 " +":ref:`socket.SO_REUSEPORT ` 常數,則不支援此功能。" #: ../../library/asyncio-eventloop.rst:648 msgid "" @@ -1111,7 +1111,7 @@ msgid "" "SO_REUSEADDR ` poses a significant security concern " "for UDP. Explicitly passing ``reuse_address=True`` will raise an exception." msgstr "" -"不再支援 *reuse_address* 參數,因為使用 :py:const:`~socket.SO_REUSEADDR " +"不再支援 *reuse_address* 參數,因為使用 :ref:`socket.SO_REUSEADDR " "` 對於 UDP 存有重大的安全疑慮。明確傳遞 " "``reuse_address=True`` 將引發例外。" @@ -1132,9 +1132,8 @@ msgid "" "differing UIDs from assigning sockets to the same socket address." msgstr "" "對於有支援的平台,*reuse_port* 可以用作類似功能的替代方案。使用 " -"*reuse_port*,將改為使用 :py:const:`~socket.SO_REUSEPORT `,該選項明確禁止具有不同 UID 的行程將 socket 分配給相同的 socket " -"地址。" +"*reuse_port*,將改為使用 :ref:`socket.SO_REUSEPORT `," +"該選項明確禁止具有不同 UID 的行程將 socket 分配給相同的 socket 地址。" #: ../../library/asyncio-eventloop.rst:689 msgid "" diff --git a/library/asyncio-future.po b/library/asyncio-future.po index c7002a37691..e6c3cd4cc22 100644 --- a/library/asyncio-future.po +++ b/library/asyncio-future.po @@ -460,5 +460,5 @@ msgid "" ":meth:`asyncio.Future.cancel` accepts an optional ``msg`` argument, but :" "meth:`concurrent.futures.Future.cancel` does not." msgstr "" -":meth:`asyncio.Future.cancel` 接受一個可選的 ``msg`` 引數,但 :func:" -"`concurrent.futures.Future.cancel` 無此引數。" +":meth:`asyncio.Future.cancel` 接受一個可選的 ``msg`` 引數,但 " +":meth:`concurrent.futures.Future.cancel` 無此引數。" diff --git a/library/functools.po b/library/functools.po index a7acc277aa6..bd71a355518 100644 --- a/library/functools.po +++ b/library/functools.po @@ -952,7 +952,7 @@ msgstr "" #: ../../library/functools.rst:529 msgid ":class:`typing.Union` can also be used::" -msgstr "也可以使用 :data:`typing.Union`: ::" +msgstr "也可以使用 :class:`typing.Union`: ::" #: ../../library/functools.rst:531 msgid "" diff --git a/library/stdtypes.po b/library/stdtypes.po index d3e442205e3..ed87e449457 100644 --- a/library/stdtypes.po +++ b/library/stdtypes.po @@ -8962,7 +8962,7 @@ msgid "" msgstr "" "一個聯合物件可以保存多個\\ :ref:`型別物件 (type object) `\\ 之 ``|``\\ (位元 or)運算的值。這些型別主要用於\\ :term:`型別註" -"釋 (type annotation) `。與下標 :data:`typing.Union` 相比,聯合型" +"釋 (type annotation) `。與下標 :class:`typing.Union` 相比,聯合型" "別運算式可以讓型別提示語法更清晰簡潔。" #: ../../library/stdtypes.rst:6031 @@ -9082,8 +9082,8 @@ msgid "" "The user-exposed type for the union object can be accessed from :class:" "`typing.Union` and used for :func:`isinstance` checks::" msgstr "" -"構成聯合物件的對使用者公開型別 (user-exposed type) 可以透過 :data:`typing." -"Union` 存取並用於 :func:`isinstance` 檢查: ::" +"構成聯合物件的對使用者公開型別 (user-exposed type) 可以透過 " +":class:`typing.Union` 存取並用於 :func:`isinstance` 檢查: ::" #: ../../library/stdtypes.rst:6094 msgid "" diff --git a/library/sys.po b/library/sys.po index 375bf47f2b6..101acd9e2da 100644 --- a/library/sys.po +++ b/library/sys.po @@ -2693,7 +2693,7 @@ msgstr "" #: ../../library/sys.rst:2101 msgid "See also the :data:`sys.builtin_module_names` list." -msgstr "另請參閱 :attr:`sys.builtin_module_names` 清單。" +msgstr "另請參閱 :data:`sys.builtin_module_names` 清單。" #: ../../library/sys.rst:2108 msgid "" diff --git a/library/typing.po b/library/typing.po index 26cb0365d16..60f10e12018 100644 --- a/library/typing.po +++ b/library/typing.po @@ -467,10 +467,9 @@ msgid "" "be expressed by defining a :class:`Protocol` class with a :meth:`~object." "__call__` method:" msgstr "" -"``Callable`` 不如有可變數量引數的函式、:func:`overloaded functions " -"`、或是僅限關鍵字參數的函式,可以表示複雜簽名。然而,這些簽名可以透" -"過定義一個具有 :meth:`~object.__call__` 方法的 :class:`Protocol` 類別進行表" -"示:" +"``Callable`` 不如有可變數量引數的函式、:ref:`overloaded functions `" +"、或是僅限關鍵字參數的函式,可以表示複雜簽名。然而,這些簽名可以透過定義一個" +"具有 :meth:`~object.__call__` 方法的 :class:`Protocol` 類別進行表示:" #: ../../library/typing.rst:258 msgid "" diff --git a/tutorial/errors.po b/tutorial/errors.po index 87449cc42b6..6303329a38b 100644 --- a/tutorial/errors.po +++ b/tutorial/errors.po @@ -575,8 +575,8 @@ msgid "" "instantiated by calling its constructor with no arguments::" msgstr "" ":keyword:`raise` 唯一的引數就是要引發的例外。該引數必須是一個例外實例或例外 " -"class(衍生自 :class:`BaseException` 的 class,例如 :class:`Exception` 與它" -"的 subclass)。如果一個例外 class 被傳遞,它會不含引數地呼叫它的建構函式 " +"class(衍生自 :class:`BaseException` 的 class,例如 :exc:`Exception` 與它的 " +"subclass)。如果一個例外 class 被傳遞,它會不含引數地呼叫它的建構函式 " "(constructor) ,使它被自動建立實例 (implicitly instantiated): ::" #: ../../tutorial/errors.rst:271 diff --git a/whatsnew/3.12.po b/whatsnew/3.12.po index 6409501b38d..85ae76cf50c 100644 --- a/whatsnew/3.12.po +++ b/whatsnew/3.12.po @@ -1368,7 +1368,7 @@ msgid "" "func:`os.pidfd_open` in non-blocking mode. (Contributed by Kumar Aditya in :" "gh:`93312`.)" msgstr "" -"新增 :data:`os.PIDFD_NONBLOCK` 以便在非阻塞模式下使用 :func:`os.pidfd_open` " +"新增 :const:`os.PIDFD_NONBLOCK` 以便在非阻塞模式下使用 :func:`os.pidfd_open` " "為行程打開檔案描述器。(由 Kumar Aditya 在 :gh:`93312` 中貢獻。)" #: ../../whatsnew/3.12.rst:763 @@ -4979,8 +4979,8 @@ msgid "" "to allow safely extending certain variable-sized types, including :c:var:" "`PyType_Type`." msgstr "" -"新增了 :const:`Py_TPFLAGS_ITEMS_AT_END` 和 :c:func:`PyObject_GetItemData` 以" -"允許安全地擴充某些可變大小的型別,包括 :c:var:`PyType_Type`。" +"新增了 :c:macro:`Py_TPFLAGS_ITEMS_AT_END` 和 :c:func:`PyObject_GetItemData` " +"以允許安全地擴充某些可變大小的型別,包括 :c:var:`PyType_Type`。" #: ../../whatsnew/3.12.rst:1892 msgid "" @@ -5041,10 +5041,11 @@ msgid "" msgstr "" "現在,當重新分配類別的 :py:meth:`~object.__call__` 方法時,:c:macro:" "`Py_TPFLAGS_HAVE_VECTORCALL` 旗標將從類中刪除。這使得 vectorcall 可以安全地與" -"可變型別一起使用(即沒有不可變旗標的堆型別,:const:" -"`Py_TPFLAGS_IMMUTABLETYPE`)。不覆蓋 :c:member:`~PyTypeObject.tp_call` 的可變" -"型別現在繼承 ``Py_TPFLAGS_HAVE_VECTORCALL`` 旗標。(由 Petr Viktorin 在 :gh:" -"`93274` 中貢獻。)" +"可變型別一起使用(即沒有不可變旗標的堆型別," +":c:macro:`Py_TPFLAGS_IMMUTABLETYPE`)。不覆蓋 " +":c:member:`~PyTypeObject.tp_call` 的可變型別現在繼承 " +"``Py_TPFLAGS_HAVE_VECTORCALL`` 旗標。(由 Petr Viktorin 在 :gh:`93274` 中貢獻" +"。)" #: ../../whatsnew/3.12.rst:1919 msgid "" From a7a236008f9987d34d18d208d6cc68cc6d84abbc Mon Sep 17 00:00:00 2001 From: "W. H. Wang" Date: Wed, 30 Sep 2026 11:19:29 +0800 Subject: [PATCH 2/2] fix(bugs): use explicit link targets, and fix punctuation and wording MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both link names in this message are translated. When a message contains more than one translated reference name, Sphinx's fix-up has to guess which original target each one means, so it cannot verify the result. Naming the targets explicitly removes the guess; the rendered links are unchanged. While here, fix the last sentence: * Two commas split the sentence in the wrong places: one between the verb 得到 and its object, and one between an attributive and its head noun 答案. * 「Python 修正錯誤」 reverses subject and object. The English is "fixing issues *in* Python", so it is 修正 Python 的問題. * *issues* here are tracker items rather than defects, so 問題 reads better than 錯誤. Co-Authored-By: Claude Opus 5 --- bugs.po | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bugs.po b/bugs.po index a3fadaca759..9a7e8cfa43f 100644 --- a/bugs.po +++ b/bugs.po @@ -261,6 +261,7 @@ msgid "" "any and all questions pertaining to the process of fixing issues in Python." msgstr "" "除了只是回報你所發現的錯誤之外,同樣也歡迎你提交修正它們的修補程式 (patch)。" -"你可以在 `Python 開發者指南`_\\ 中找到如何開始修補 Python 的更多資訊。如果你" -"有任何問題,`核心導師郵寄清單`_\\ 是一個友善的地方,你可以在那裡得到,關於 " -"Python 修正錯誤的過程中,所有問題的答案。" +"你可以在 `Python 開發者指南 `_\\ " +"中找到如何開始修補 Python 的更多資訊。如果你有任何問題," +"`核心導師郵寄清單 `_\\ " +"是個友善的地方,任何關於修正 Python 問題之流程的疑問,都能在那裡得到解答。"