Skip to content

Commit a61e0c2

Browse files
mattwang44claude
andcommitted
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 <noreply@anthropic.com>
1 parent a8df549 commit a61e0c2

8 files changed

Lines changed: 25 additions & 26 deletions

File tree

‎library/asyncio-eventloop.po‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,8 +1065,8 @@ msgid ""
10651065
"is not defined then this capability is unsupported."
10661066
msgstr ""
10671067
"*reuse_port* 告訴核心允許將此端點綁定到與其他現有端點相同的埠,只要它們在建立"
1068-
"時都設定了此旗標。此選項不受 Windows 和某些 Unix 系統支援。如果未定義 :py:"
1069-
"const:`socket.SO_REUSEPORT <socket-unix-constants>` 常數,則不支援此功能。"
1068+
"時都設定了此旗標。此選項不受 Windows 和某些 Unix 系統支援。如果未定義 "
1069+
":ref:`socket.SO_REUSEPORT <socket-unix-constants>` 常數,則不支援此功能。"
10701070

10711071
#: ../../library/asyncio-eventloop.rst:648
10721072
msgid ""
@@ -1111,7 +1111,7 @@ msgid ""
11111111
"SO_REUSEADDR <socket-unix-constants>` poses a significant security concern "
11121112
"for UDP. Explicitly passing ``reuse_address=True`` will raise an exception."
11131113
msgstr ""
1114-
"不再支援 *reuse_address* 參數,因為使用 :py:const:`~socket.SO_REUSEADDR "
1114+
"不再支援 *reuse_address* 參數,因為使用 :ref:`socket.SO_REUSEADDR "
11151115
"<socket-unix-constants>` 對於 UDP 存有重大的安全疑慮。明確傳遞 "
11161116
"``reuse_address=True`` 將引發例外。"
11171117

@@ -1132,9 +1132,8 @@ msgid ""
11321132
"differing UIDs from assigning sockets to the same socket address."
11331133
msgstr ""
11341134
"對於有支援的平台,*reuse_port* 可以用作類似功能的替代方案。使用 "
1135-
"*reuse_port*,將改為使用 :py:const:`~socket.SO_REUSEPORT <socket-unix-"
1136-
"constants>`,該選項明確禁止具有不同 UID 的行程將 socket 分配給相同的 socket "
1137-
"地址。"
1135+
"*reuse_port*,將改為使用 :ref:`socket.SO_REUSEPORT <socket-unix-constants>`,"
1136+
"該選項明確禁止具有不同 UID 的行程將 socket 分配給相同的 socket 地址。"
11381137

11391138
#: ../../library/asyncio-eventloop.rst:689
11401139
msgid ""

‎library/asyncio-future.po‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,5 +460,5 @@ msgid ""
460460
":meth:`asyncio.Future.cancel` accepts an optional ``msg`` argument, but :"
461461
"meth:`concurrent.futures.Future.cancel` does not."
462462
msgstr ""
463-
":meth:`asyncio.Future.cancel` 接受一個可選的 ``msg`` 引數,但 :func:"
464-
"`concurrent.futures.Future.cancel` 無此引數。"
463+
":meth:`asyncio.Future.cancel` 接受一個可選的 ``msg`` 引數,但 "
464+
":meth:`concurrent.futures.Future.cancel` 無此引數。"

‎library/functools.po‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ msgstr ""
952952

953953
#: ../../library/functools.rst:529
954954
msgid ":class:`typing.Union` can also be used::"
955-
msgstr "也可以使用 :data:`typing.Union`: ::"
955+
msgstr "也可以使用 :class:`typing.Union`: ::"
956956

957957
#: ../../library/functools.rst:531
958958
msgid ""

‎library/stdtypes.po‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8962,7 +8962,7 @@ msgid ""
89628962
msgstr ""
89638963
"一個聯合物件可以保存多個\\ :ref:`型別物件 (type object) <bltin-type-"
89648964
"objects>`\\ 之 ``|``\\ (位元 or)運算的值。這些型別主要用於\\ :term:`型別註"
8965-
"釋 (type annotation) <annotation>`。與下標 :data:`typing.Union` 相比,聯合型"
8965+
"釋 (type annotation) <annotation>`。與下標 :class:`typing.Union` 相比,聯合型"
89668966
"別運算式可以讓型別提示語法更清晰簡潔。"
89678967

89688968
#: ../../library/stdtypes.rst:6031
@@ -9082,8 +9082,8 @@ msgid ""
90829082
"The user-exposed type for the union object can be accessed from :class:"
90839083
"`typing.Union` and used for :func:`isinstance` checks::"
90849084
msgstr ""
9085-
"構成聯合物件的對使用者公開型別 (user-exposed type) 可以透過 :data:`typing."
9086-
"Union` 存取並用於 :func:`isinstance` 檢查: ::"
9085+
"構成聯合物件的對使用者公開型別 (user-exposed type) 可以透過 "
9086+
":class:`typing.Union` 存取並用於 :func:`isinstance` 檢查: ::"
90879087

90889088
#: ../../library/stdtypes.rst:6094
90899089
msgid ""

‎library/sys.po‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2693,7 +2693,7 @@ msgstr ""
26932693

26942694
#: ../../library/sys.rst:2101
26952695
msgid "See also the :data:`sys.builtin_module_names` list."
2696-
msgstr "另請參閱 :attr:`sys.builtin_module_names` 清單。"
2696+
msgstr "另請參閱 :data:`sys.builtin_module_names` 清單。"
26972697

26982698
#: ../../library/sys.rst:2108
26992699
msgid ""

‎library/typing.po‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -467,10 +467,9 @@ msgid ""
467467
"be expressed by defining a :class:`Protocol` class with a :meth:`~object."
468468
"__call__` method:"
469469
msgstr ""
470-
"``Callable`` 不如有可變數量引數的函式、:func:`overloaded functions "
471-
"<overload>`、或是僅限關鍵字參數的函式,可以表示複雜簽名。然而,這些簽名可以透"
472-
"過定義一個具有 :meth:`~object.__call__` 方法的 :class:`Protocol` 類別進行表"
473-
"示:"
470+
"``Callable`` 不如有可變數量引數的函式、:ref:`overloaded functions <overload>`"
471+
"、或是僅限關鍵字參數的函式,可以表示複雜簽名。然而,這些簽名可以透過定義一個"
472+
"具有 :meth:`~object.__call__` 方法的 :class:`Protocol` 類別進行表示:"
474473

475474
#: ../../library/typing.rst:258
476475
msgid ""

‎tutorial/errors.po‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,8 +575,8 @@ msgid ""
575575
"instantiated by calling its constructor with no arguments::"
576576
msgstr ""
577577
":keyword:`raise` 唯一的引數就是要引發的例外。該引數必須是一個例外實例或例外 "
578-
"class(衍生自 :class:`BaseException` 的 class,例如 :class:`Exception` 與它"
579-
"的 subclass)。如果一個例外 class 被傳遞,它會不含引數地呼叫它的建構函式 "
578+
"class(衍生自 :class:`BaseException` 的 class,例如 :exc:`Exception` 與它的 "
579+
"subclass)。如果一個例外 class 被傳遞,它會不含引數地呼叫它的建構函式 "
580580
"(constructor) ,使它被自動建立實例 (implicitly instantiated): ::"
581581

582582
#: ../../tutorial/errors.rst:271

‎whatsnew/3.12.po‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,7 +1368,7 @@ msgid ""
13681368
"func:`os.pidfd_open` in non-blocking mode. (Contributed by Kumar Aditya in :"
13691369
"gh:`93312`.)"
13701370
msgstr ""
1371-
"新增 :data:`os.PIDFD_NONBLOCK` 以便在非阻塞模式下使用 :func:`os.pidfd_open` "
1371+
"新增 :const:`os.PIDFD_NONBLOCK` 以便在非阻塞模式下使用 :func:`os.pidfd_open` "
13721372
"為行程打開檔案描述器。(由 Kumar Aditya 在 :gh:`93312` 中貢獻。)"
13731373

13741374
#: ../../whatsnew/3.12.rst:763
@@ -4979,8 +4979,8 @@ msgid ""
49794979
"to allow safely extending certain variable-sized types, including :c:var:"
49804980
"`PyType_Type`."
49814981
msgstr ""
4982-
"新增了 :const:`Py_TPFLAGS_ITEMS_AT_END` 和 :c:func:`PyObject_GetItemData` 以"
4983-
"允許安全地擴充某些可變大小的型別,包括 :c:var:`PyType_Type`。"
4982+
"新增了 :c:macro:`Py_TPFLAGS_ITEMS_AT_END` 和 :c:func:`PyObject_GetItemData` "
4983+
"以允許安全地擴充某些可變大小的型別,包括 :c:var:`PyType_Type`。"
49844984

49854985
#: ../../whatsnew/3.12.rst:1892
49864986
msgid ""
@@ -5041,10 +5041,11 @@ msgid ""
50415041
msgstr ""
50425042
"現在,當重新分配類別的 :py:meth:`~object.__call__` 方法時,:c:macro:"
50435043
"`Py_TPFLAGS_HAVE_VECTORCALL` 旗標將從類中刪除。這使得 vectorcall 可以安全地與"
5044-
"可變型別一起使用(即沒有不可變旗標的堆型別,:const:"
5045-
"`Py_TPFLAGS_IMMUTABLETYPE`)。不覆蓋 :c:member:`~PyTypeObject.tp_call` 的可變"
5046-
"型別現在繼承 ``Py_TPFLAGS_HAVE_VECTORCALL`` 旗標。(由 Petr Viktorin 在 :gh:"
5047-
"`93274` 中貢獻。)"
5044+
"可變型別一起使用(即沒有不可變旗標的堆型別,"
5045+
":c:macro:`Py_TPFLAGS_IMMUTABLETYPE`)。不覆蓋 "
5046+
":c:member:`~PyTypeObject.tp_call` 的可變型別現在繼承 "
5047+
"``Py_TPFLAGS_HAVE_VECTORCALL`` 旗標。(由 Petr Viktorin 在 :gh:`93274` 中貢獻"
5048+
"。)"
50485049

50495050
#: ../../whatsnew/3.12.rst:1919
50505051
msgid ""

0 commit comments

Comments
 (0)