From 80351acf54ba74be1a3a9d0450885588abc285c8 Mon Sep 17 00:00:00 2001 From: Matt Wang Date: Tue, 24 Jan 2023 21:09:42 +0800 Subject: [PATCH] feat: translate c-api/stable.po --- c-api/stable.po | 92 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 81 insertions(+), 11 deletions(-) diff --git a/c-api/stable.po b/c-api/stable.po index 23a92c8ab7..7f3ce71770 100644 --- a/c-api/stable.po +++ b/c-api/stable.po @@ -1,15 +1,15 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2023, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: +# Matt Wang , 2023 msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-10-26 16:47+0000\n" -"PO-Revision-Date: 2016-11-19 00:26+0000\n" -"Last-Translator: Liang-Bo Wang \n" +"PO-Revision-Date: 2023-01-24 21:07+0800\n" +"Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" @@ -17,10 +17,11 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Poedit 3.2.2\n" #: ../../c-api/stable.rst:7 msgid "C API Stability" -msgstr "" +msgstr "C API 穩定性" #: ../../c-api/stable.rst:9 msgid "" @@ -30,6 +31,9 @@ msgid "" "API. Changing existing API or removing API is only done after a deprecation " "period or to fix serious issues." msgstr "" +"Python 的 C API 被包含在向後相容性策略 :pep:`387` 中。雖然 C API 會隨著每個次" +"要版本(例如從 3.9 到 3.10)而變化,但大多數變化都是與原始碼相容的,通常只是" +"加入新的 API。更改現有 API 或刪除 API 僅在棄用期後或修復嚴重問題時進行。" #: ../../c-api/stable.rst:15 msgid "" @@ -39,16 +43,22 @@ msgid "" "work on 3.10.8 and vice versa, but will need to be compiled separately for " "3.9.x and 3.10.x." msgstr "" +"CPython 的應用程式二進位介面 (Application Binary Interface, ABI) 在次要版本中" +"是向前和向後相容的(如果它們以相同的方式編譯;請參閱下面的\\ :ref:`stable-" +"abi-platform`\\)。因此,為 Python 3.10.0 編譯的程式碼將能夠在 3.10.8 上運" +"行,反之亦然,但 3.9.x 和 3.10.x 就需要分別編譯。" #: ../../c-api/stable.rst:21 msgid "" "Names prefixed by an underscore, such as ``_Py_InternalState``, are private " "API that can change without notice even in patch releases." msgstr "" +"帶有底線前綴的名稱是私有 API (private API),像是 ``_Py_InternalState``,即使" +"在補丁版本 (patch release) 中也可能被更改,不會另行通知。" #: ../../c-api/stable.rst:26 msgid "Stable Application Binary Interface" -msgstr "" +msgstr "穩定的應用程式二進位介面" #: ../../c-api/stable.rst:28 msgid "" @@ -57,6 +67,9 @@ msgid "" "multiple versions of Python. Contents of the Limited API are :ref:`listed " "below `." msgstr "" +"Python 3.2 引入了\\ *受限 API (Limited API)*,它是 Python C API 的一個子集。" +"僅使用受限 API 的擴充可以只編譯一次就使用於多個版本的 Python。受限 API 的內容" +"\\ :ref:`列在下方 `。" #: ../../c-api/stable.rst:33 msgid "" @@ -65,6 +78,9 @@ msgid "" "symbols exposed in the Limited API, but also other ones – for example, " "functions necessary to support older versions of the Limited API." msgstr "" +"為了實現它,Python 提供了一個\\ *穩定 ABI (Stable ABI)*:一組將在各個 Python " +"3.x 版本之間保持相容的符號。穩定 ABI 被包含在受限 API 中開放的符號,但也包含" +"其他符號 - 例如,支援舊版受限 API 所必需的函式。" #: ../../c-api/stable.rst:38 msgid "" @@ -72,12 +88,16 @@ msgid "" "and Stable ABI work the same way for all uses of the API – for example, " "embedding Python.)" msgstr "" +"(為簡單起見,本文件討論\\ *擴充 (extension)*,但受限 API 和穩定 ABI 在所有 " +"API 使用方式中都以相同的方式運作 -- 例如在嵌入式 Python (embedding Python) " +"中。)" #: ../../c-api/stable.rst:44 msgid "" "Define this macro before including ``Python.h`` to opt in to only use the " "Limited API, and to select the Limited API version." msgstr "" +"在包含 ``Python.h`` 之前定義此巨集以選擇只使用受限 API,並挑選受限 API 版本。" #: ../../c-api/stable.rst:47 msgid "" @@ -87,6 +107,9 @@ msgid "" "the specified one onward, and can use Limited API introduced up to that " "version." msgstr "" +"將 ``Py_LIMITED_API`` 定義為對應於你的擴充有支援的最低 Python 版本的 :c:data:" +"`PY_VERSION_HEX` 值。該擴充無需重新編譯即可與從指定版本開始的所有 Python 3 版" +"本一起使用,並且可以使用過去版本有引入的受限 API。" #: ../../c-api/stable.rst:53 msgid "" @@ -94,12 +117,17 @@ msgid "" "minor version (e.g. ``0x030A0000`` for Python 3.10) for stability when " "compiling with future Python versions." msgstr "" +"與其直接使用 ``PY_VERSION_HEX`` 巨集,不如寫死 (hardcode) 最小次要版本(例如" +"代表 Python 3.10 的 ``0x030A0000``\\ ),以便在使用未來的 Python 版本進行編譯" +"時仍保持穩定性。" #: ../../c-api/stable.rst:57 msgid "" "You can also define ``Py_LIMITED_API`` to ``3``. This works the same as " "``0x03020000`` (Python 3.2, the version that introduced Limited API)." msgstr "" +"你還可以將 ``Py_LIMITED_API`` 定義為 ``3``,這與 ``0x03020000``\\ (Python " +"3.2,引入了受限 API 的版本)相同。" #: ../../c-api/stable.rst:60 msgid "" @@ -107,6 +135,8 @@ msgid "" "``python3.dll`` rather than a version-specific library such as ``python39." "dll``." msgstr "" +"在 Windows 上,使用穩定 ABI 的擴充應該連接到 ``python3.dll`` 而不是特定版本的" +"函式庫,例如 ``python39.dll``。" #: ../../c-api/stable.rst:64 msgid "" @@ -116,6 +146,10 @@ msgid "" "to ensure that, for example, extensions built with the 3.10+ Limited API are " "not installed for lower versions of Python." msgstr "" +"在某些平台上,Python 將查找並加載以 ``abi3`` 標籤命名的共享函式庫檔案(例如 " +"``mymodule.abi3.so``\\ )。它不檢查此類擴充是否符合穩定的 ABI。確保的責任在使" +"用者(或者打包工具)身上,例如使用 3.10+ 受限 API 建置的擴充不會為較低版本的 " +"Python 所安裝。" #: ../../c-api/stable.rst:71 msgid "" @@ -123,16 +157,19 @@ msgid "" "library, not solely as macros. This makes them usable from languages that " "don't use the C preprocessor." msgstr "" +"穩定 ABI 中的所有函式都作為函式存在於 Python 的共享函式庫中,而不僅是作為巨" +"集。這使得它們可被用於不使用 C 預處理器 (preprocessor) 的語言。" #: ../../c-api/stable.rst:77 msgid "Limited API Scope and Performance" -msgstr "" +msgstr "受限 API 範圍和性能" #: ../../c-api/stable.rst:79 msgid "" "The goal for the Limited API is to allow everything that is possible with " "the full C API, but possibly with a performance penalty." msgstr "" +"受限 API 的目標是允許使用完整的 C API 進行所有可能的操作,但可能會降低性能。" #: ../../c-api/stable.rst:82 msgid "" @@ -140,6 +177,9 @@ msgid "" "variant :c:func:`PyList_GET_ITEM` is not. The macro can be faster because it " "can rely on version-specific implementation details of the list object." msgstr "" +"例如,雖然 :c:func:`PyList_GetItem` 可用,但它的「不安全」巨集變體 :c:func:" +"`PyList_GET_ITEM` 為不可用。巨集運行可以更快,因為它可以依賴 list 物件的特定" +"版本實作細節。" #: ../../c-api/stable.rst:87 msgid "" @@ -148,6 +188,9 @@ msgid "" "allowing stability as Python's data structures are improved, but possibly " "reducing performance." msgstr "" +"如果沒有定義 ``Py_LIMITED_API``,一些 C API 函式將被嵌入或被替換為巨集。定義 " +"``Py_LIMITED_API`` 會禁用嵌入,從而隨著 Python 資料結構的改進而提高穩定性,但" +"可能會降低性能。" #: ../../c-api/stable.rst:92 msgid "" @@ -158,10 +201,14 @@ msgid "" "where a version-specific one is not available – for example, for prereleases " "of an upcoming Python version." msgstr "" +"通過省略 ``Py_LIMITED_API`` 定義,可以使用特定版本的 ABI 編譯受限 API 擴充。" +"這可以提高該 Python 版本的性能,但會限制相容性。使用 ``Py_LIMITED_API`` 編譯" +"將產生一個擴充,可以在特定版本的擴充不可用的地方發布 — 例如,用於即將發布的 " +"Python 版本的預發布版本 (prerelease)。" #: ../../c-api/stable.rst:101 msgid "Limited API Caveats" -msgstr "" +msgstr "受限 API 注意事項" #: ../../c-api/stable.rst:103 msgid "" @@ -170,6 +217,9 @@ msgid "" "only covers definitions, but an API also includes other issues, such as " "expected semantics." msgstr "" +"請注意,使用 ``Py_LIMITED_API`` 進行編譯\\ *不*\\ 完全保證程式碼符合受限 API " +"或穩定 ABI。``Py_LIMITED_API`` 僅涵蓋定義,但 API 還包括其他問題,例如預期的" +"語義 (semantic)。" #: ../../c-api/stable.rst:108 msgid "" @@ -180,18 +230,26 @@ msgid "" "the argument will be used directly, causing a ``NULL`` dereference and " "crash. A similar argument works for fields of structs." msgstr "" +"``Py_LIMITED_API`` 無法防範的一個問題是使用在較低 Python 版本中無效的引數來呼" +"叫函式。例如一個開始接受 ``NULL`` 作為引數的函式。在 Python 3.9 中,``NULL`` " +"現在代表選擇預設行為,但在 Python 3.8 中,引數將被直接使用,導致 ``NULL`` 取" +"消參照 (dereference) 且崩潰 (crash)。類似的引數適用於結構 (struct) 的欄位。" #: ../../c-api/stable.rst:115 msgid "" "Another issue is that some struct fields are currently not hidden when " "``Py_LIMITED_API`` is defined, even though they're part of the Limited API." msgstr "" +"另一個問題是,當有定義 ``Py_LIMITED_API`` 時,一些結構欄位目前不會被隱藏,即" +"使它們是受限 API 的一部分。" #: ../../c-api/stable.rst:118 msgid "" "For these reasons, we recommend testing an extension with *all* minor Python " "versions it supports, and preferably to build with the *lowest* such version." msgstr "" +"出於這些原因,我們建議要以它支援的\\ *所有*\\ 次要 Python 版本來測試擴充,並" +"且最好使用\\ *最低*\\ 版本進行建置。" #: ../../c-api/stable.rst:121 msgid "" @@ -200,6 +258,9 @@ msgid "" "few private declarations are exposed for technical reasons (or even " "unintentionally, as bugs)." msgstr "" +"我們也建議要查看所有使用過的 API 的文件,檢查它是否明確屬於受限 API。即使有定" +"義 ``Py_LIMITED_API``,一些私有聲明也會因為技術原因(或者甚至是無意地,例如臭" +"蟲)而被公開出來。" #: ../../c-api/stable.rst:126 msgid "" @@ -209,10 +270,13 @@ msgid "" "particular, parts of the Limited API may be deprecated and removed, provided " "that the Stable ABI stays stable." msgstr "" +"另請注意,受限 API 不一定是穩定的:在 Python 3.8 中使用 ``Py_LIMITED_API`` 進" +"行編譯意味著擴充將能以 Python 3.12 運行,但不一定能以 Python 3.12 *編譯*。特" +"別是如果穩定 ABI 保持穩定,部分受限 API 可能會被棄用和刪除。" #: ../../c-api/stable.rst:136 msgid "Platform Considerations" -msgstr "" +msgstr "平台注意事項" #: ../../c-api/stable.rst:138 msgid "" @@ -221,6 +285,9 @@ msgid "" "ABI, these details define a “platform”. They usually depend on the OS type " "and processor architecture" msgstr "" +"ABI 穩定性不僅取決於 Python,還取決於使用的編譯器、低階函式庫和編譯器選項。出" +"於穩定 ABI 的目的,這些細節定義了一個「平台」。它們通常取決於作業系統種類和處" +"理器架構" #: ../../c-api/stable.rst:143 msgid "" @@ -229,11 +296,14 @@ msgid "" "does not break the Stable ABI. This is the case with Windows and macOS " "releases from ``python.org`` and many third-party distributors." msgstr "" +"每個特定的 Python 發布者都有責任確保特定平台上的所有 Python 版本都以不破壞穩" +"定 ABI 的方式建置。``python.org`` 和許多第三方發布者發布的 Windows 和 macOS " +"版本就是這種情況。" #: ../../c-api/stable.rst:153 msgid "Contents of Limited API" -msgstr "" +msgstr "受限 API 的內容" #: ../../c-api/stable.rst:156 msgid "Currently, the Limited API includes the following items:" -msgstr "" +msgstr "目前,受限 API 包括以下項目:"