diff --git a/c-api/stable.po b/c-api/stable.po index 5aa8323e0c..a69db51911 100644 --- a/c-api/stable.po +++ b/c-api/stable.po @@ -37,10 +37,10 @@ msgstr "" #: ../../c-api/stable.rst:15 msgid "" "CPython's Application Binary Interface (ABI) is forward- and backwards-" -"compatible across a minor release (if these are compiled the same way; see :" -"ref:`stable-abi-platform` below). So, code compiled for Python 3.10.0 will " -"work on 3.10.8 and vice versa, but will need to be compiled separately for " -"3.9.x and 3.11.x." +"compatible across a minor release (if these are compiled the same way; " +"see :ref:`stable-abi-platform` below). So, code compiled for Python 3.10.0 " +"will work on 3.10.8 and vice versa, but will need to be compiled separately " +"for 3.9.x and 3.11.x." msgstr "" "CPython 的應用程式二進位介面 (Application Binary Interface, ABI) 在次要版本中" "是向前和向後相容的(如果它們以相同的方式編譯;請參閱下面的\\ :ref:`stable-" @@ -65,8 +65,8 @@ msgid "" "releases. When :c:macro:`Py_LIMITED_API` is defined, only this subset is " "exposed from ``Python.h``." msgstr "" -":ref:`受限 API `,在多個次要版本之間相容。當有定義 :c:macro:" -"`Py_LIMITED_API` 時,只有這個子集會從 ``Python.h`` 公開。" +":ref:`受限 API `,在多個次要版本之間相容。當有定" +"義 :c:macro:`Py_LIMITED_API` 時,只有這個子集會從 ``Python.h`` 公開。" #: ../../c-api/stable.rst:29 msgid "These are discussed in more detail below." @@ -76,14 +76,14 @@ msgstr "下面將更詳細地討論這些內容。" msgid "" "Names prefixed by an underscore, such as ``_Py_InternalState``, are private " "API that can change without notice even in patch releases. If you need to " -"use this API, consider reaching out to `CPython developers `_ to discuss adding public API for your use " -"case." +"use this API, consider reaching out to `CPython developers `_ to discuss adding public API for " +"your use case." msgstr "" "帶有底線前綴的名稱是私有 API (private API),像是 ``_Py_InternalState``,即使" "在補丁版本 (patch release) 中也可能被更改,不會另行通知。如果你需要使用這個 " -"API,可以聯繫 `CPython 開發者 `_ 並針對你的使用方法來討論是否新增公開的 API。" +"API,可以聯繫 `CPython 開發者 `_ 並針對你的使用方法來討論是否新增公開的 API。" #: ../../c-api/stable.rst:40 msgid "Unstable C API" @@ -156,9 +156,9 @@ msgid "" "extension will be ABI-compatible with all Python 3 releases from the " "specified one onward, and can use Limited API introduced up to that version." msgstr "" -"將 ``Py_LIMITED_API`` 定義為對應於你的擴充有支援的最低 Python 版本的 :c:" -"macro:`PY_VERSION_HEX` 值。該擴充與從指定版本開始的所有 Python 3 版本之 ABI " -"相容,並且可以使用過去版本有引入的受限 API。" +"將 ``Py_LIMITED_API`` 定義為對應於你的擴充有支援的最低 Python 版本" +"的 :c:macro:`PY_VERSION_HEX` 值。該擴充與從指定版本開始的所有 Python 3 版本" +"之 ABI 相容,並且可以使用過去版本有引入的受限 API。" #: ../../c-api/stable.rst:83 msgid "" @@ -211,8 +211,8 @@ msgstr "" #: ../../c-api/stable.rst:111 msgid "" "On Windows, extensions that use the Stable ABI should be linked against " -"``python3.dll`` rather than a version-specific library such as ``python39." -"dll``." +"``python3.dll`` rather than a version-specific library such as " +"``python39.dll``." msgstr "" "在 Windows 上,使用穩定 ABI 的擴充應該連接到 ``python3.dll`` 而不是特定版本的" "函式庫,例如 ``python39.dll``。" @@ -256,9 +256,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:func:`PyList_GetItem` 可用,但它的「不安全」巨集變" +"體 :c:func:`PyList_GET_ITEM` 為不可用。巨集運行可以更快,因為它可以依賴 list " +"物件的特定版本實作細節。" #: ../../c-api/stable.rst:138 msgid "" @@ -280,7 +280,7 @@ msgid "" "where a version-specific one is not available – for example, for prereleases " "of an upcoming Python version." msgstr "" -"通過省略 ``Py_LIMITED_API`` 定義,可以使用特定版本的 ABI 編譯受限 API 擴充。" +"透過省略 ``Py_LIMITED_API`` 定義,可以使用特定版本的 ABI 編譯受限 API 擴充。" "這可以提高該 Python 版本的性能,但會限制相容性。使用 ``Py_LIMITED_API`` 編譯" "將產生一個擴充,可以在特定版本的擴充不可用的地方發布 — 例如,用於即將發布的 " "Python 版本的預發布版本 (prerelease)。" @@ -292,9 +292,10 @@ msgstr "受限 API 注意事項" #: ../../c-api/stable.rst:154 msgid "" "Note that compiling with ``Py_LIMITED_API`` is *not* a complete guarantee " -"that code conforms to the :ref:`Limited API ` or the :ref:" -"`Stable ABI `. ``Py_LIMITED_API`` only covers definitions, but " -"an API also includes other issues, such as expected semantics." +"that code conforms to the :ref:`Limited API ` or " +"the :ref:`Stable ABI `. ``Py_LIMITED_API`` only covers " +"definitions, but an API also includes other issues, such as expected " +"semantics." msgstr "" "請注意,使用 ``Py_LIMITED_API`` 進行編譯\\ *不*\\ 完全保證程式碼符合\\ :ref:`" "受限 API ` 或\\ :ref:`穩定 ABI `。" @@ -361,9 +362,9 @@ msgstr "平台注意事項" #: ../../c-api/stable.rst:189 msgid "" "ABI stability depends not only on Python, but also on the compiler used, " -"lower-level libraries and compiler options. For the purposes of the :ref:" -"`Stable ABI `, these details define a “platform”. They usually " -"depend on the OS type and processor architecture" +"lower-level libraries and compiler options. For the purposes of " +"the :ref:`Stable ABI `, these details define a “platform”. They " +"usually depend on the OS type and processor architecture" msgstr "" "ABI 穩定性不僅取決於 Python,還取決於使用的編譯器、低階函式庫和編譯器選項。出" "於\\ :ref:`穩定 ABI ` 的目的,這些細節定義了一個「平台」。它們通" diff --git a/faq/extending.po b/faq/extending.po index 3235118126..9e82c59186 100644 --- a/faq/extending.po +++ b/faq/extending.po @@ -34,11 +34,11 @@ msgstr "我可以在 C 中建立自己的函式嗎?" #: ../../faq/extending.rst:18 msgid "" "Yes, you can create built-in modules containing functions, variables, " -"exceptions and even new types in C. This is explained in the document :ref:" -"`extending-index`." +"exceptions and even new types in C. This is explained in the " +"document :ref:`extending-index`." msgstr "" -"是的,你可以在 C 中建立包含函式、變數、例外甚至新型別的內建模組,:ref:" -"`extending-index` 文件中有相關說明。" +"是的,你可以在 C 中建立包含函式、變數、例外甚至新型別的內建模" +"組,:ref:`extending-index` 文件中有相關說明。" #: ../../faq/extending.rst:22 msgid "Most intermediate or advanced Python books will also cover this topic." @@ -73,16 +73,16 @@ msgstr "要編寫你自己的 C 擴充有許多替代方法,取決於你要執 #: ../../faq/extending.rst:44 #, fuzzy msgid "" -"`Cython `_ and its relative `Pyrex `_ are compilers that accept a " -"slightly modified form of Python and generate the corresponding C code. " -"Cython and Pyrex make it possible to write an extension without having to " -"learn Python's C API." +"`Cython `_ and its relative `Pyrex `_ are compilers that " +"accept a slightly modified form of Python and generate the corresponding C " +"code. Cython and Pyrex make it possible to write an extension without " +"having to learn Python's C API." msgstr "" -"`Cython `_ 及其相關的 `Pyrex `_ 是接受稍微修改 Python 形式並生成" -"相應的 C 程式碼。 Cython 和 Pyrex 使編寫擴充程式成為可能,而無需學習 Python " -"的 C API。" +"`Cython `_ 及其相關的 `Pyrex `_ 是接受稍微修改 Python " +"形式並生成相應的 C 程式碼。 Cython 和 Pyrex 使編寫擴充程式成為可能,而無需學" +"習 Python 的 C API。" #: ../../faq/extending.rst:50 #, fuzzy @@ -111,15 +111,15 @@ msgid "" "The highest-level function to do this is :c:func:`PyRun_SimpleString` which " "takes a single string argument to be executed in the context of the module " "``__main__`` and returns ``0`` for success and ``-1`` when an exception " -"occurred (including :exc:`SyntaxError`). If you want more control, use :c:" -"func:`PyRun_String`; see the source for :c:func:`PyRun_SimpleString` in " -"``Python/pythonrun.c``." +"occurred (including :exc:`SyntaxError`). If you want more control, " +"use :c:func:`PyRun_String`; see the source for :c:func:`PyRun_SimpleString` " +"in ``Python/pythonrun.c``." msgstr "" "執行此操作的最高級別函式是 :c:func:`PyRun_SimpleString`,它採用單個字串引數在" "模組 ``__main__`` 的上下文中執行,並回傳 ``0`` 表示成功,``- 1`` 發生例外時" -"(包括 :exc:`SyntaxError`)。如果你想要更多的控制,使用 :c:func:" -"`PyRun_String`;在 ``Python/pythonrun.c`` 中查看 :c:func:" -"`PyRun_SimpleString` 的原始碼。" +"(包括 :exc:`SyntaxError`)。如果你想要更多的控制,使" +"用 :c:func:`PyRun_String`;在 ``Python/pythonrun.c`` 中查" +"看 :c:func:`PyRun_SimpleString` 的原始碼。" #: ../../faq/extending.rst:72 #, fuzzy @@ -133,8 +133,8 @@ msgid "" "start symbol :c:data:`Py_eval_input`; it parses an expression, evaluates it " "and returns its value." msgstr "" -"呼叫上一個問題中的函式 :c:func:`PyRun_String` 開始符號 :c:data:" -"`Py_eval_input`;它解析一個運算式,對其求值並回傳它的值。" +"呼叫上一個問題中的函式 :c:func:`PyRun_String` 開始符" +"號 :c:data:`Py_eval_input`;它解析一個運算式,對其求值並回傳它的值。" #: ../../faq/extending.rst:80 msgid "How do I extract C values from a Python object?" @@ -145,33 +145,34 @@ msgstr "如何從 Python 物件中提取 C 值?" msgid "" "That depends on the object's type. If it's a tuple, :c:func:`PyTuple_Size` " "returns its length and :c:func:`PyTuple_GetItem` returns the item at a " -"specified index. Lists have similar functions, :c:func:`PyList_Size` and :c:" -"func:`PyList_GetItem`." +"specified index. Lists have similar functions, :c:func:`PyList_Size` " +"and :c:func:`PyList_GetItem`." msgstr "" -"這取決於物件的型別。如果它是一個元組,:c:func:`PyTuple_Size` 回傳它的長度,:" -"c:func:`PyTuple_GetItem` 回傳指定索引的項目。列表具有類似的函式:c:func:" -"`PyList_Size` 和 :c:func:`PyList_GetItem`。" +"這取決於物件的型別。如果它是一個元組,:c:func:`PyTuple_Size` 回傳它的長" +"度,:c:func:`PyTuple_GetItem` 回傳指定索引的項目。列表具有類似的函式:" +"c:func:`PyList_Size` 和 :c:func:`PyList_GetItem`。" #: ../../faq/extending.rst:87 #, fuzzy msgid "" -"For bytes, :c:func:`PyBytes_Size` returns its length and :c:func:" -"`PyBytes_AsStringAndSize` provides a pointer to its value and its length. " -"Note that Python bytes objects may contain null bytes so C's :c:func:`!" -"strlen` should not be used." +"For bytes, :c:func:`PyBytes_Size` returns its length " +"and :c:func:`PyBytes_AsStringAndSize` provides a pointer to its value and " +"its length. Note that Python bytes objects may contain null bytes so " +"C's :c:func:`!strlen` should not be used." msgstr "" -"對於位元組,:c:func:`PyBytes_Size` 回傳它的長度,:c:func:" -"`PyBytes_AsStringAndSize` 提供指向它的值和長度的指標。請注意,Python 位元組物" -"件可能包含空位元組,因此不應使用 C 的 :c:func:`!strlen`。" +"對於位元組,:c:func:`PyBytes_Size` 回傳它的長" +"度,:c:func:`PyBytes_AsStringAndSize` 提供指向它的值和長度的指標。請注意," +"Python 位元組物件可能包含空位元組,因此不應使用 C 的 :c:func:`!strlen`。" #: ../../faq/extending.rst:92 msgid "" "To test the type of an object, first make sure it isn't ``NULL``, and then " -"use :c:func:`PyBytes_Check`, :c:func:`PyTuple_Check`, :c:func:" -"`PyList_Check`, etc." +"use :c:func:`PyBytes_Check`, :c:func:`PyTuple_Check`, :c:func:`PyList_Check`, " +"etc." msgstr "" -"要測試物件的型別,首先確保它不是 ``NULL``,然後再使用 :c:func:" -"`PyBytes_Check`、:c:func:`PyTuple_Check`、:c:func:`PyList_Check` 等函式。" +"要測試物件的型別,首先確保它不是 ``NULL``,然後再使" +"用 :c:func:`PyBytes_Check`、:c:func:`PyTuple_Check`、:c:func:`PyList_Check` " +"等函式。" #: ../../faq/extending.rst:95 #, fuzzy @@ -184,9 +185,10 @@ msgid "" "al.) and mappings in the PyMapping APIs." msgstr "" "還有一個針對 Python 物件的高級 API,它由所謂的「抽象」介面提供——閱讀 " -"``Include/abstract.h`` 了解更多詳細資訊。它允許使用 :c:func:" -"`PySequence_Length`、:c:func:`PySequence_GetItem` 等呼叫以及許多其他有用的協" -"議(例如數字 (:c:func:`PyNumber_Index) ` 等)和 PyMapping API 中的對映。" +"``Include/abstract.h`` 了解更多詳細資訊。它允許使" +"用 :c:func:`PySequence_Length`、:c:func:`PySequence_GetItem` 等呼叫以及許多其" +"他有用的協議(例如數字 (:c:func:`PyNumber_Index) ` 等)和 PyMapping API 中的" +"對映。" #: ../../faq/extending.rst:104 msgid "How do I use Py_BuildValue() to create a tuple of arbitrary length?" @@ -229,8 +231,8 @@ msgid "" "defined. You are responsible for eventually :c:func:`Py_DECREF`\\ 'ing the " "return value." msgstr "" -"這適用於任何具有方法的物件——無論是內建的還是使用者定義的。你負責最終 :c:func:" -"`Py_DECREF`\\ 'ing 回傳值。" +"這適用於任何具有方法的物件——無論是內建的還是使用者定義的。你負責最" +"終 :c:func:`Py_DECREF`\\ 'ing 回傳值。" #: ../../faq/extending.rst:124 msgid "" @@ -277,9 +279,9 @@ msgid "" "print_error, or just allow the standard traceback mechanism to work. Then, " "the output will go wherever your ``write()`` method sends it." msgstr "" -"在 Python 程式碼中,定義一個支援 ``write()`` 方法的物件。將此物件分配給 :" -"data:`sys.stdout` 和 :data:`sys.stderr`。呼叫 print_error,或者只允許標準的回" -"溯機制起作用。然後,輸出將到達你的 ``write()`` 方法發送它的任何地方。" +"在 Python 程式碼中,定義一個支援 ``write()`` 方法的物件。將此物件分配" +"給 :data:`sys.stdout` 和 :data:`sys.stderr`。呼叫 print_error,或者只允許標準" +"的回溯機制起作用。然後,輸出將到達你的 ``write()`` 方法發送它的任何地方。" #: ../../faq/extending.rst:149 msgid "The easiest way to do this is to use the :class:`io.StringIO` class:" @@ -356,11 +358,11 @@ msgstr "module = PyImport_ImportModule(\"\");" #: ../../faq/extending.rst:188 #, fuzzy msgid "" -"If the module hasn't been imported yet (i.e. it is not yet present in :data:" -"`sys.modules`), this initializes the module; otherwise it simply returns the " -"value of ``sys.modules[\"\"]``. Note that it doesn't enter the " -"module into any namespace -- it only ensures it has been initialized and is " -"stored in :data:`sys.modules`." +"If the module hasn't been imported yet (i.e. it is not yet present " +"in :data:`sys.modules`), this initializes the module; otherwise it simply " +"returns the value of ``sys.modules[\"\"]``. Note that it " +"doesn't enter the module into any namespace -- it only ensures it has been " +"initialized and is stored in :data:`sys.modules`." msgstr "" "如果模組還沒有被引入(即它還沒有出現在 :data:`sys.modules` 中),這會初始化模" "組;否則它只回傳 ``sys.modules[\"\"]`` 的值。請注意,它不會將模組" @@ -516,9 +518,9 @@ msgid "" "``Parser/myreadline.c`` for more hints." msgstr "" "在 C 中執行此操作的最簡單方法是呼叫:c:func:`PyRun_InteractiveLoop`(可能在單" -"獨的執行緒中)並讓 Python 直譯器為你處理輸入。你還可以將 :c:func:" -"`PyOS_ReadlineFunctionPointer` 設定為指向你的自定義輸入函式。有關更多提示,請" -"參閱``Modules/readline.c`` 和``Parser/myreadline.c``。" +"獨的執行緒中)並讓 Python 直譯器為你處理輸入。你還可以" +"將 :c:func:`PyOS_ReadlineFunctionPointer` 設定為指向你的自定義輸入函式。有關" +"更多提示,請參閱``Modules/readline.c`` 和``Parser/myreadline.c``。" #: ../../faq/extending.rst:275 msgid "How do I find undefined g++ symbols __builtin_new or __pure_virtual?" @@ -541,22 +543,22 @@ msgid "" "Can I create an object class with some methods implemented in C and others " "in Python (e.g. through inheritance)?" msgstr "" -"我可以用一些用 C 實作的方法和用 Python 實作的其他方法(例如通過繼承)建立一個" +"我可以用一些用 C 實作的方法和用 Python 實作的其他方法(例如透過繼承)建立一個" "物件類別嗎?" #: ../../faq/extending.rst:285 msgid "" -"Yes, you can inherit from built-in classes such as :class:`int`, :class:" -"`list`, :class:`dict`, etc." +"Yes, you can inherit from built-in classes such " +"as :class:`int`, :class:`list`, :class:`dict`, etc." msgstr "" "是的,你可以繼承內建類別,例如 :class:`int`、:class:`list`、:class:`dict` " "等。" #: ../../faq/extending.rst:288 msgid "" -"The Boost Python Library (BPL, https://www.boost.org/libs/python/doc/index." -"html) provides a way of doing this from C++ (i.e. you can inherit from an " -"extension class written in C++ using the BPL)." +"The Boost Python Library (BPL, https://www.boost.org/libs/python/doc/" +"index.html) provides a way of doing this from C++ (i.e. you can inherit from " +"an extension class written in C++ using the BPL)." msgstr "" "Boost Python 函式庫(BPL,https://www.boost.org/libs/python/doc/index.html)" "提供了一種從 C++ 執行此操作的方法(即你可以使用 BPL 來繼承用 C++ 編寫的擴充類" diff --git a/faq/library.po b/faq/library.po index 816e1e7b39..21409fd6a7 100644 --- a/faq/library.po +++ b/faq/library.po @@ -117,20 +117,18 @@ msgstr "" "Python 直譯器的路徑。" #: ../../faq/library.rst:53 -#, fuzzy msgid "" "The first is done by executing ``chmod +x scriptfile`` or perhaps ``chmod " "755 scriptfile``." msgstr "" -"第一個是通過執行 ``chmod +x scriptfile`` 或者 ``chmod 755 scriptfile`` 來完成" -"的。" +"第一個是透過執行 ``chmod +x scriptfile`` 或者可能是 ``chmod 755 scriptfile`` " +"來完成的。" #: ../../faq/library.rst:56 -#, fuzzy msgid "" "The second can be done in a number of ways. The most straightforward way is " "to write ::" -msgstr "第二個可以通過多種方式完成。最直接的方法是寫: ::" +msgstr "第二個則可以透過多種方式完成。最直接的方法是寫: ::" #: ../../faq/library.rst:59 msgid "#!/usr/local/bin/python" @@ -191,13 +189,12 @@ msgstr "" "\"\"\"" #: ../../faq/library.rst:86 -#, fuzzy msgid "" "The minor disadvantage is that this defines the script's __doc__ string. " "However, you can fix that by adding ::" msgstr "" -"次要缺點是這定義了腳本的 __doc__ 字串。但是,你可以通過新增來解決這個問" -"題: ::" +"次要缺點是這定義了腳本的 __doc__ 字串。但是你可以透過新增下面這一行來解決這個" +"問題: ::" #: ../../faq/library.rst:89 msgid "__doc__ = \"\"\"...Whatever...\"\"\"" @@ -242,8 +239,7 @@ msgstr "Python 中是否有等同於 C 的 onexit() 的函式?" msgid "" "The :mod:`atexit` module provides a register function that is similar to " "C's :c:func:`!onexit`." -msgstr "" -":mod:`atexit` 模組提供了一個類似於 C 的 :c:func:`onexit` 的寄存器函式。" +msgstr ":mod:`atexit` 模組提供了一個類似於 C :c:func:`onexit` 的註冊器函式。" #: ../../faq/library.rst:118 msgid "Why don't my signal handlers work?" @@ -347,7 +343,7 @@ msgid "" msgstr "" "一旦你的程式被組織為函式和類別行為的易於處理的集合,你就應該編寫測試函式來執" "行這些行為。可將一系列測試自動化的測試套件與每個模組相關聯。這聽起來像是很多" -"工作,但由於 Python 如此簡潔和靈活,所以它非常容易。通過與 \"生產程式碼\" 並" +"工作,但由於 Python 如此簡潔和靈活,所以它非常容易。透過與 \"生產程式碼\" 並" "行編寫測試函式,你可以使編碼變得更加愉快和有趣,因為這使得更早地發現錯誤甚至" "設計缺陷變得容易。" @@ -373,11 +369,10 @@ msgid "" "when the external interfaces are unavailable by using \"fake\" interfaces " "implemented in Python." msgstr "" -"即使是與復雜外部介面交互的程式也可以在外部介面不可用時通過使用 Python 中實作" +"即使是與復雜外部介面交互的程式也可以在外部介面不可用時透過使用 Python 中實作" "的 \"假\" 介面進行測試。" #: ../../faq/library.rst:179 -#, fuzzy msgid "How do I create documentation from doc strings?" msgstr "如何從文件字串建立文件?" @@ -556,7 +551,6 @@ msgstr "" "方法回傳它們。該類別將負責必要的鎖定,以確保每個作業都恰好分發一次。" #: ../../faq/library.rst:302 -#, fuzzy msgid "Here's a trivial example::" msgstr "這是一個簡單的例子: ::" @@ -600,7 +594,6 @@ msgid "" msgstr "" #: ../../faq/library.rst:340 -#, fuzzy msgid "When run, this will produce the following output:" msgstr "運行時,這將產生以下輸出:" @@ -660,7 +653,7 @@ msgid "" msgstr "" "內部使用 :term:`全域直譯器鎖 (GIL, global interpreter lock)`\\ 來確保一次只有" "一個執行緒在 Python VM 中運行。通常,Python 僅提供位元組碼指令之間的執行緒切" -"換;可以通過 :func:`sys.setswitchinterval` 設定它切換的頻率。因此,從 Python " +"換;可以透過 :func:`sys.setswitchinterval` 設定它切換的頻率。因此,從 Python " "程式的角度來看,每條位元組碼指令以及從每條指令到達的所有 C 實作程式碼都是原子" "的。" @@ -1044,7 +1037,7 @@ msgid "" "descriptor. This also happens automatically in ``f``'s destructor, when " "``f`` becomes garbage." msgstr "" -"對於你通過內置的 :func:`open` 函式在 Python 中建立的大多數檔案物件," +"對於你透過內置的 :func:`open` 函式在 Python 中建立的大多數檔案物件," "``f.close()`` 從 Python 的角度將 Python 檔案物件標記為已關閉,並安排關閉底層 " "C 檔案描述器。當 ``f`` 變成垃圾時,這也會自動發生在 ``f`` 的析構函式中。" diff --git a/library/html.parser.po b/library/html.parser.po index e557e6025b..da6a091b3e 100644 --- a/library/html.parser.po +++ b/library/html.parser.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-05-08 00:15+0000\n" "PO-Revision-Date: 2023-05-04 22:54+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -57,8 +57,8 @@ msgid "" "methods to implement the desired behavior." msgstr "" ":class:`.HTMLParser` 實例被提供 HTML 資料,並在遇到開始標籤、結束標籤、文本、" -"註解和其他標記元素時呼叫處理程式 (handler) 方法。使用者應該繼承 :class:`." -"HTMLParser` 並覆蓋其方法以實作所需的行為。" +"註解和其他標記元素時呼叫處理程式 (handler) 方法。使用者應該繼" +"承 :class:`.HTMLParser` 並覆蓋其方法以實作所需的行為。" #: ../../library/html.parser.rst:31 msgid "" @@ -83,12 +83,12 @@ msgstr "HTML 剖析器應用程式範例" #: ../../library/html.parser.rst:44 msgid "" -"As a basic example, below is a simple HTML parser that uses the :class:" -"`HTMLParser` class to print out start tags, end tags, and data as they are " -"encountered::" +"As a basic example, below is a simple HTML parser that uses " +"the :class:`HTMLParser` class to print out start tags, end tags, and data as " +"they are encountered:" msgstr "" "以下的基礎範例是一個簡單的 HTML 剖析器,它使用 :class:`HTMLParser` 類別,當遇" -"到開始標籤、結束標籤和資料時將它們印出: ::" +"到開始標籤、結束標籤和資料時將它們印出:" #: ../../library/html.parser.rst:48 msgid "" @@ -124,11 +124,11 @@ msgstr "" "parser.feed('Test'\n" " '

Parse me!

')" -#: ../../library/html.parser.rst:64 +#: ../../library/html.parser.rst:66 msgid "The output will then be:" msgstr "輸出將是:" -#: ../../library/html.parser.rst:66 +#: ../../library/html.parser.rst:68 msgid "" "Encountered a start tag: html\n" "Encountered a start tag: head\n" @@ -156,24 +156,24 @@ msgstr "" "Encountered an end tag : body\n" "Encountered an end tag : html" -#: ../../library/html.parser.rst:83 +#: ../../library/html.parser.rst:85 msgid ":class:`.HTMLParser` Methods" msgstr ":class:`.HTMLParser` 方法" -#: ../../library/html.parser.rst:85 +#: ../../library/html.parser.rst:87 msgid ":class:`HTMLParser` instances have the following methods:" msgstr ":class:`HTMLParser` 實例具有以下方法:" -#: ../../library/html.parser.rst:90 +#: ../../library/html.parser.rst:92 msgid "" "Feed some text to the parser. It is processed insofar as it consists of " -"complete elements; incomplete data is buffered until more data is fed or :" -"meth:`close` is called. *data* must be :class:`str`." +"complete elements; incomplete data is buffered until more data is fed " +"or :meth:`close` is called. *data* must be :class:`str`." msgstr "" "向剖析器提供一些文本。只要它由完整的元素組成,它就會被處理;不完整的資料會被" "緩衝,直到輸入更多資料或呼叫 :meth:`close`。 *data* 必須是 :class:`str`。" -#: ../../library/html.parser.rst:97 +#: ../../library/html.parser.rst:99 msgid "" "Force processing of all buffered data as if it were followed by an end-of-" "file mark. This method may be redefined by a derived class to define " @@ -181,20 +181,20 @@ msgid "" "should always call the :class:`HTMLParser` base class method :meth:`close`." msgstr "" "強制處理所有緩衝資料,如同它後面跟有文件結束標籤一樣。此方法可能有被衍生類別" -"重新定義,以在輸入末尾定義額外的處理,但重新定義的版本仍應要呼叫 :class:" -"`HTMLParser` 基底類別方法 :meth:`close`。" +"重新定義,以在輸入末尾定義額外的處理,但重新定義的版本仍應要呼" +"叫 :class:`HTMLParser` 基底類別方法 :meth:`close`。" -#: ../../library/html.parser.rst:105 +#: ../../library/html.parser.rst:107 msgid "" "Reset the instance. Loses all unprocessed data. This is called implicitly " "at instantiation time." msgstr "重置實例。丟棄所有未處理的資料。這在實例化時被會隱晦地呼叫。" -#: ../../library/html.parser.rst:111 +#: ../../library/html.parser.rst:113 msgid "Return current line number and offset." msgstr "回傳目前列號 (line number) 和偏移量 (offset)。" -#: ../../library/html.parser.rst:116 +#: ../../library/html.parser.rst:118 msgid "" "Return the text of the most recently opened start tag. This should not " "normally be needed for structured processing, but may be useful in dealing " @@ -205,23 +205,23 @@ msgstr "" "「已部署」的 HTML 或以最少的更改重新生成輸入(可以保留屬性之間的空白等)時可" "能很有用。" -#: ../../library/html.parser.rst:122 +#: ../../library/html.parser.rst:124 msgid "" "The following methods are called when data or markup elements are " "encountered and they are meant to be overridden in a subclass. The base " -"class implementations do nothing (except for :meth:`~HTMLParser." -"handle_startendtag`):" +"class implementations do nothing (except " +"for :meth:`~HTMLParser.handle_startendtag`):" msgstr "" "當遇到資料或標記元素時將呼叫以下方法,並且它們應在子類別中被覆蓋。基底類別實" "作什麼都不做(除了 :meth:`~HTMLParser.handle_startendtag`):" -#: ../../library/html.parser.rst:129 +#: ../../library/html.parser.rst:131 msgid "" "This method is called to handle the start tag of an element (e.g. ``
``)." msgstr "呼叫此方法來處理元素的開始標籤(例如 ``
``)。" -#: ../../library/html.parser.rst:131 +#: ../../library/html.parser.rst:133 msgid "" "The *tag* argument is the name of the tag converted to lower case. The " "*attrs* argument is a list of ``(name, value)`` pairs containing the " @@ -233,44 +233,44 @@ msgstr "" "列表,包含在標籤的 ``<>`` 括號內找到的屬性。 *name* 將被轉成小寫,*value* 中" "的引號會被刪除,字元和實體參照也會被替換。" -#: ../../library/html.parser.rst:137 +#: ../../library/html.parser.rst:139 msgid "" "For instance, for the tag ````, this method " -"would be called as ``handle_starttag('a', [('href', 'https://www.cwi." -"nl/')])``." +"would be called as ``handle_starttag('a', [('href', 'https://" +"www.cwi.nl/')])``." msgstr "" "例如,對於標籤 ````,這個方法會以 " "``handle_starttag('a', [('href', 'https://www.cwi.nl/')])`` 的形式被呼叫。" -#: ../../library/html.parser.rst:140 +#: ../../library/html.parser.rst:142 msgid "" "All entity references from :mod:`html.entities` are replaced in the " "attribute values." msgstr "在屬性值中來自 :mod:`html.entities` 的所有實體參照都會被替換。" -#: ../../library/html.parser.rst:146 +#: ../../library/html.parser.rst:148 msgid "" "This method is called to handle the end tag of an element (e.g. ``
``)." msgstr "呼叫此方法來處理元素的結束標籤(例如 ``
``)。" -#: ../../library/html.parser.rst:148 +#: ../../library/html.parser.rst:150 msgid "The *tag* argument is the name of the tag converted to lower case." msgstr "*tag* 引數是轉換為小寫的標籤名稱。" -#: ../../library/html.parser.rst:153 +#: ../../library/html.parser.rst:155 msgid "" "Similar to :meth:`handle_starttag`, but called when the parser encounters an " "XHTML-style empty tag (````). This method may be overridden by " "subclasses which require this particular lexical information; the default " -"implementation simply calls :meth:`handle_starttag` and :meth:" -"`handle_endtag`." +"implementation simply calls :meth:`handle_starttag` " +"and :meth:`handle_endtag`." msgstr "" "與 :meth:`handle_starttag` 類似,但在剖析器遇到 XHTML 樣式的空標籤 " "(````) 時呼叫。這個方法可能被需要這個特定詞彙資訊 (lexical " -"information) 的子類別覆蓋;預設實作只是呼叫 :meth:`handle_starttag` 和 :meth:" -"`handle_endtag`。" +"information) 的子類別覆蓋;預設實作只是呼叫 :meth:`handle_starttag` " +"和 :meth:`handle_endtag`。" -#: ../../library/html.parser.rst:161 +#: ../../library/html.parser.rst:163 msgid "" "This method is called to process arbitrary data (e.g. text nodes and the " "content of ```` and ````)." @@ -278,7 +278,7 @@ msgstr "" "呼叫此方法來處理任意資料(例如文本節點與 ```` 和 " "```` 的內容)。" -#: ../../library/html.parser.rst:167 +#: ../../library/html.parser.rst:169 msgid "" "This method is called to process a named character reference of the form " "``&name;`` (e.g. ``>``), where *name* is a general entity reference (e.g. " @@ -288,7 +288,7 @@ msgstr "" "*name* 是一般實體參照(例如 ``'gt'``)。如果 *convert_charrefs* 為 ``True``," "則永遠不會呼叫此方法。" -#: ../../library/html.parser.rst:175 +#: ../../library/html.parser.rst:177 msgid "" "This method is called to process decimal and hexadecimal numeric character " "references of the form :samp:`&#{NNN};` and :samp:`&#x{NNN};`. For example, " @@ -297,17 +297,17 @@ msgid "" "This method is never called if *convert_charrefs* is ``True``." msgstr "" "呼叫此方法來處理 :samp:`&#{NNN};` 和 :samp:`&#x{NNN};` 形式的十進位和十六進位" -"數字字元參照。例如,``>`` 的十進位等效為 ``>``,而十六進位為 ``>" -"``;在這種情況下,該方法將收到 ``'62'`` 或 ``'x3E'``。如果 " +"數字字元參照。例如,``>`` 的十進位等效為 ``>``,而十六進位為 " +"``>``;在這種情況下,該方法將收到 ``'62'`` 或 ``'x3E'``。如果 " "*convert_charrefs* 為 ``True``,則永遠不會呼叫此方法。" -#: ../../library/html.parser.rst:184 +#: ../../library/html.parser.rst:186 msgid "" "This method is called when a comment is encountered (e.g. ````)。" -#: ../../library/html.parser.rst:186 +#: ../../library/html.parser.rst:188 msgid "" "For example, the comment ```` will cause this method to be " "called with the argument ``' comment '``." @@ -315,7 +315,7 @@ msgstr "" "舉例來說,註解 ```` 會使得此方法被以引數 ``' comment '`` 來呼" "叫。" -#: ../../library/html.parser.rst:189 +#: ../../library/html.parser.rst:191 msgid "" "The content of Internet Explorer conditional comments (condcoms) will also " "be sent to this method, so, for ```` 為例," "這個方法將會收到 ``'[if IE 9]>IE9-specific content``)." @@ -334,7 +334,7 @@ msgstr "" "呼叫此方法來處理 HTML 文件類型聲明 (doctype declaration)(例如 ````)。" -#: ../../library/html.parser.rst:199 +#: ../../library/html.parser.rst:201 msgid "" "The *decl* parameter will be the entire contents of the declaration inside " "the ```` markup (e.g. ``'DOCTYPE html'``)." @@ -342,7 +342,7 @@ msgstr "" "*decl* 參數將是 ```` 標記內聲明部分的全部內容(例如 ``'DOCTYPE " "html'``)。" -#: ../../library/html.parser.rst:205 +#: ../../library/html.parser.rst:207 msgid "" "Method called when a processing instruction is encountered. The *data* " "parameter will contain the entire processing instruction. For example, for " @@ -355,7 +355,7 @@ msgstr "" "``handle_pi(\"proc color='red'\")`` 形式被呼叫。它旨在被衍生類別覆蓋;基底類" "別實作中什麼都不做。" -#: ../../library/html.parser.rst:213 +#: ../../library/html.parser.rst:215 msgid "" "The :class:`HTMLParser` class uses the SGML syntactic rules for processing " "instructions. An XHTML processing instruction using the trailing ``'?'`` " @@ -364,12 +364,12 @@ msgstr "" ":class:`HTMLParser` 類別使用 SGML 語法規則來處理指示。使用有 ``?`` 跟隨在後面" "的 XHTML 處理指示將導致 ``?`` 被包含在 *data* 中。" -#: ../../library/html.parser.rst:220 +#: ../../library/html.parser.rst:222 msgid "" "This method is called when an unrecognized declaration is read by the parser." msgstr "當剖析器讀取無法識別的聲明時會呼叫此方法。" -#: ../../library/html.parser.rst:222 +#: ../../library/html.parser.rst:224 msgid "" "The *data* parameter will be the entire contents of the declaration inside " "the ```` markup. It is sometimes useful to be overridden by a " @@ -378,17 +378,17 @@ msgstr "" "*data* 參數將是 ```` 標記內聲明的全部內容。有時被衍生類別被覆蓋會是好" "用的。在基底類別實作中什麼都不做。" -#: ../../library/html.parser.rst:230 +#: ../../library/html.parser.rst:232 msgid "Examples" msgstr "範例" -#: ../../library/html.parser.rst:232 +#: ../../library/html.parser.rst:234 msgid "" "The following class implements a parser that will be used to illustrate more " -"examples::" -msgstr "以下類別實作了一個剖析器,將用於解說更多範例: ::" +"examples:" +msgstr "以下類別實作了一個剖析器,將用於解說更多範例:" -#: ../../library/html.parser.rst:235 +#: ../../library/html.parser.rst:237 msgid "" "from html.parser import HTMLParser\n" "from html.entities import name2codepoint\n" @@ -458,27 +458,27 @@ msgstr "" "\n" "parser = MyHTMLParser()" -#: ../../library/html.parser.rst:269 -msgid "Parsing a doctype::" -msgstr "剖析文件類型: ::" +#: ../../library/html.parser.rst:273 +msgid "Parsing a doctype:" +msgstr "剖析文件類型:" -#: ../../library/html.parser.rst:271 +#: ../../library/html.parser.rst:275 msgid "" ">>> parser.feed('')\n" -"Decl : DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3." -"org/TR/html4/strict.dtd\"" +"Decl : DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://" +"www.w3.org/TR/html4/strict.dtd\"" msgstr "" ">>> parser.feed('')\n" -"Decl : DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3." -"org/TR/html4/strict.dtd\"" +"Decl : DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://" +"www.w3.org/TR/html4/strict.dtd\"" -#: ../../library/html.parser.rst:275 -msgid "Parsing an element with a few attributes and a title::" -msgstr "剖析一個具有一些屬性和標題的元素: ::" +#: ../../library/html.parser.rst:281 +msgid "Parsing an element with a few attributes and a title:" +msgstr "剖析一個具有一些屬性和標題的元素:" -#: ../../library/html.parser.rst:277 +#: ../../library/html.parser.rst:283 msgid "" ">>> parser.feed('\"The')\n" "Start tag: img\n" @@ -500,13 +500,13 @@ msgstr "" "Data : Python\n" "End tag : h1" -#: ../../library/html.parser.rst:287 +#: ../../library/html.parser.rst:295 msgid "" "The content of ``script`` and ``style`` elements is returned as is, without " -"further parsing::" -msgstr "``script`` 和 ``style`` 元素的內容按原樣回傳,無需進一步剖析: ::" +"further parsing:" +msgstr "``script`` 和 ``style`` 元素的內容按原樣回傳,無需進一步剖析:" -#: ../../library/html.parser.rst:290 +#: ../../library/html.parser.rst:298 msgid "" ">>> parser.feed('