Skip to content

Sync with CPython 3.11 #410

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Apr 25, 2023
54 changes: 47 additions & 7 deletions c-api/file.po
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
# 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:
# Ching-Lung Chuang, 2015
# Liang-Bo Wang <me@liang2.tw>, 2015
# Matt Wang <mattwang44@gmail.com>, 2022
msgid ""
msgstr ""
"Project-Id-Version: Python 3.11\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-10-31 08:13+0000\n"
"PO-Revision-Date: 2017-09-22 18:26+0000\n"
"Last-Translator: Liang-Bo Wang <me@liang2.tw>\n"
"PO-Revision-Date: 2023-04-24 20:38+0800\n"
"Last-Translator: Matt Wang <mattwang44@gmail.com>\n"
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
"tw)\n"
"Language: zh_TW\n"
"MIME-Version: 1.0\n"
"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/file.rst:6
msgid "File Objects"
msgstr "檔案(File)物件"
msgstr "檔案物件 (File Objects)"

#: ../../c-api/file.rst:10
msgid ""
Expand All @@ -35,8 +36,14 @@ msgid ""
"reporting in the interpreter; third-party code is advised to access the :mod:"
"`io` APIs instead."
msgstr ""
"這些 API 是用於內建檔案物件的 Python 2 C API 的最小模擬 (minimal emulation),"
"它過去依賴於 C 標準函式庫對於緩衝 I/O (:c:expr:`FILE*`) 的支援。在 Python 3 "
"中,檔案和串流使用新的 :mod:`io` 模組,它在操作系統的低階無緩衝 I/O 上定義了"
"多個層級。下面描述的函式是這些新 API 的便捷 C 包裝器,主要用於直譯器中的內部"
"錯誤報告;建議第三方程式碼改為存取 :mod:`io` API。"

#: ../../c-api/file.rst:22
#, fuzzy
msgid ""
"Create a Python file object from the file descriptor of an already opened "
"file *fd*. The arguments *name*, *encoding*, *errors* and *newline* can be "
Expand All @@ -45,13 +52,19 @@ msgid ""
"failure. For a more comprehensive description of the arguments, please refer "
"to the :func:`io.open` function documentation."
msgstr ""
"從已打開檔案 *fd* 的檔案描述器建立一個 Python 檔案物件。引數 *name*、"
"*encoding*、*errors* 和 *newline* 可以為 ``NULL`` 以使用預設值; *buffering* "
"可以是 *-1* 以使用預設值。 *name* 被忽略並保留以實作向後相容性。失敗時回傳 "
"``NULL``。有關引數的更全面描述,請參閱 :func:`io.open` 函式文檔。"

#: ../../c-api/file.rst:31
msgid ""
"Since Python streams have their own buffering layer, mixing them with OS-"
"level file descriptors can produce various issues (such as unexpected "
"ordering of data)."
msgstr ""
"由於 Python 串流有自己的緩衝層,將它們與操作系統層級檔案描述器混合使用會產生"
"各種問題(例如資料的排序不符合預期)。"

#: ../../c-api/file.rst:35
msgid "Ignore *name* attribute."
Expand All @@ -65,8 +78,12 @@ msgid ""
"integer, which is returned as the file descriptor value. Sets an exception "
"and returns ``-1`` on failure."
msgstr ""
"回傳與 *p* 關聯的檔案描述器作為 :c:expr:`int`。如果物件是整數,則回傳其值。如"
"果不是整數,則呼叫物件的 :meth:`~io.IOBase.fileno` 方法(如果存在);該方法必"
"須回傳一個整數,它作為檔案描述器值回傳。設定例外並在失敗時回傳 ``-1``。"

#: ../../c-api/file.rst:52
#, fuzzy
msgid ""
"Equivalent to ``p.readline([n])``, this function reads one line from the "
"object *p*. *p* may be a file object or any object with a :meth:`~io.IOBase."
Expand All @@ -78,49 +95,69 @@ msgid ""
"regardless of length, but :exc:`EOFError` is raised if the end of the file "
"is reached immediately."
msgstr ""
"相當於 ``p.readline([n])``,這個函式從物件 *p* 中讀取一行。 *p* 可以是檔案對"
"像或任何具有 :meth:`~io.IOBase.readline` 方法的物件。如果 *n* 為 ``0``,則只"
"讀取一行,而不管該行的長度。如果 *n* 大於 ``0``,則不會從檔案中讀取超過 *n* "
"個位元組;可以回傳部分行。在這兩種情況下,如果立即到達檔案末尾,則回傳一個空"
"字串。但是,如果 *n* 小於 ``0``,無論長度如何,都會讀取一行,但如果立即到達檔"
"案末尾,則會引發 :exc:`EOFError`。"

#: ../../c-api/file.rst:65
msgid ""
"Overrides the normal behavior of :func:`io.open_code` to pass its parameter "
"through the provided handler."
msgstr ""
"覆蓋 :func:`io.open_code` 的正常行為以透過提供的處理程式 (handler) 傳遞其參"
"數。"

#: ../../c-api/file.rst:68
msgid ""
"The handler is a function of type :c:expr:`PyObject *(\\*)(PyObject *path, "
"void *userData)`, where *path* is guaranteed to be :c:type:`PyUnicodeObject`."
msgstr ""
"處理程式是 :c:expr:`PyObject *(\\*)(PyObject *path, void *userData)` 型別的函"
"式,其中 *path* 保證為 :c:type:`PyUnicodeObject`。"

#: ../../c-api/file.rst:71
msgid ""
"The *userData* pointer is passed into the hook function. Since hook "
"functions may be called from different runtimes, this pointer should not "
"refer directly to Python state."
msgstr ""
"*userData* 指標被傳遞到掛鉤函式 (hook function) 中。由於可能會從不同的運行時"
"間 (runtime) 呼叫掛鉤函式,因此該指標不應直接指向 Python 狀態。"

#: ../../c-api/file.rst:75
msgid ""
"As this hook is intentionally used during import, avoid importing new "
"modules during its execution unless they are known to be frozen or available "
"in ``sys.modules``."
msgstr ""
"由於此掛鉤函式是在導入期間有意使用的,因此請避免在其執行期間導入新模組,除非"
"它們已知有被凍結或在 ``sys.modules`` 中可用。"

#: ../../c-api/file.rst:79
#, fuzzy
msgid ""
"Once a hook has been set, it cannot be removed or replaced, and later calls "
"to :c:func:`PyFile_SetOpenCodeHook` will fail. On failure, the function "
"returns -1 and sets an exception if the interpreter has been initialized."
msgstr ""
"一旦設定了一個掛鉤函式,它就不能被刪除或替換,以後呼叫 :c:func:"
"`PyFile_SetOpenCodeHook` 將失敗。失敗時,函式回傳 -1 並在直譯器已初始化時設定"
"例外。"

#: ../../c-api/file.rst:83
msgid "This function is safe to call before :c:func:`Py_Initialize`."
msgstr ""
msgstr "在 :c:func:`Py_Initialize` 之前呼叫此函式是安全的。"

#: ../../c-api/file.rst:21
#: ../../c-api/file.rst:85
msgid ""
"Raises an :ref:`auditing event <auditing>` ``setopencodehook`` with no "
"arguments."
msgstr ""
"不帶引數地引發一個\\ :ref:`稽核事件 (auditing event) <auditing>` "
"``setopencodehook``\\ 。"

#: ../../c-api/file.rst:95
msgid ""
Expand All @@ -129,6 +166,9 @@ msgid ""
"instead of the :func:`repr`. Return ``0`` on success or ``-1`` on failure; "
"the appropriate exception will be set."
msgstr ""
"將物件 *obj* 寫入檔案物件 *p*。 *flags* 唯一支援的旗標是 :const:"
"`Py_PRINT_RAW`;如果有給定,則寫入物件的 :func:`str` 而不是 :func:`repr`。在"
"成功回傳 ``0`` 或在失敗回傳 ``-1``;將設定適當的例外。"

#: ../../c-api/file.rst:103
msgid ""
Expand Down
46 changes: 27 additions & 19 deletions c-api/init.po
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
# This file is distributed under the same license as the Python package.
#
# Translators:
# Adrian Liaw <adrianliaw2000@gmail.com>, 2018
msgid ""
msgstr ""
"Project-Id-Version: Python 3.11\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-03-16 00:18+0000\n"
"PO-Revision-Date: 2018-05-23 14:06+0000\n"
"PO-Revision-Date: 2023-04-24 20:49+0800\n"
"Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n"
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
"tw)\n"
Expand All @@ -17,6 +18,7 @@ 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/init.rst:8
msgid "Initialization, Finalization, and Threads"
Expand Down Expand Up @@ -200,7 +202,7 @@ msgstr ""

#: ../../c-api/init.rst:90
msgid "Set by the :option:`-b` option."
msgstr ""
msgstr "由 :option:`-b` 選項設定。"

#: ../../c-api/init.rst:94
msgid ""
Expand All @@ -212,7 +214,7 @@ msgstr ""
msgid ""
"Set by the :option:`-d` option and the :envvar:`PYTHONDEBUG` environment "
"variable."
msgstr ""
msgstr "由 :option:`-d` 選項與 :envvar:`PYTHONDEBUG` 環境變數設定。"

#: ../../c-api/init.rst:102
msgid ""
Expand All @@ -225,6 +227,7 @@ msgid ""
"Set by the :option:`-B` option and the :envvar:`PYTHONDONTWRITEBYTECODE` "
"environment variable."
msgstr ""
"由 :option:`-B` 選項與 :envvar:`PYTHONDONTWRITEBYTECODE` 環境變數設定。"

#: ../../c-api/init.rst:110
msgid ""
Expand All @@ -241,6 +244,7 @@ msgid ""
"Set to ``1`` if the :envvar:`PYTHONHASHSEED` environment variable is set to "
"a non-empty string."
msgstr ""
"如果環境變數 :envvar:`PYTHONHASHSEED` 被設定為一個非空字串則設為 ``1``。"

#: ../../c-api/init.rst:120
msgid ""
Expand All @@ -256,7 +260,7 @@ msgstr ""

#: ../../c-api/init.rst:128
msgid "Set by the :option:`-E` and :option:`-I` options."
msgstr ""
msgstr "由 :option:`-E` 與 :option:`-I` 選項設定。"

#: ../../c-api/init.rst:132
msgid ""
Expand All @@ -269,11 +273,11 @@ msgstr ""
msgid ""
"Set by the :option:`-i` option and the :envvar:`PYTHONINSPECT` environment "
"variable."
msgstr ""
msgstr "由 :option:`-i` 選項與 :envvar:`PYTHONINSPECT` 環境變數設定。"

#: ../../c-api/init.rst:141
msgid "Set by the :option:`-i` option."
msgstr ""
msgstr "由 :option:`-i` 選項設定。"

#: ../../c-api/init.rst:145
msgid ""
Expand All @@ -283,7 +287,7 @@ msgstr ""

#: ../../c-api/init.rst:148
msgid "Set by the :option:`-I` option."
msgstr ""
msgstr "由 :option:`-i` 選項設定。"

#: ../../c-api/init.rst:154
msgid ""
Expand All @@ -297,6 +301,8 @@ msgid ""
"Set to ``1`` if the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` environment "
"variable is set to a non-empty string."
msgstr ""
"如果環境變數 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 被設定為一個非空字串則設"
"為 ``1``。"

#: ../../c-api/init.rst:161
msgid "See :pep:`529` for more details."
Expand Down Expand Up @@ -332,7 +338,7 @@ msgstr ""

#: ../../c-api/init.rst:184
msgid "Set by the :option:`-S` option."
msgstr ""
msgstr "由 :option:`-S` 選項設定。"

#: ../../c-api/init.rst:188
msgid ""
Expand All @@ -345,12 +351,14 @@ msgid ""
"Set by the :option:`-s` and :option:`-I` options, and the :envvar:"
"`PYTHONNOUSERSITE` environment variable."
msgstr ""
"由 :option:`-s` 選項、:option:`-I` 選項與 :envvar:`PYTHONNOUSERSITE` 環境變數"
"設定。"

#: ../../c-api/init.rst:196
msgid ""
"Set by the :option:`-O` option and the :envvar:`PYTHONOPTIMIZE` environment "
"variable."
msgstr ""
msgstr "由 :option:`-O` 選項與 :envvar:`PYTHONOPTIMIZE` 環境變數設定。"

#: ../../c-api/init.rst:201
msgid ""
Expand All @@ -359,7 +367,7 @@ msgstr ""

#: ../../c-api/init.rst:203
msgid "Set by the :option:`-q` option."
msgstr ""
msgstr "由 :option:`-q` 選項設定。"

#: ../../c-api/init.rst:209
msgid "Force the stdout and stderr streams to be unbuffered."
Expand All @@ -369,7 +377,7 @@ msgstr ""
msgid ""
"Set by the :option:`-u` option and the :envvar:`PYTHONUNBUFFERED` "
"environment variable."
msgstr ""
msgstr "由 :option:`-u` 選項與 :envvar:`PYTHONUNBUFFERED` 環境變數設定。"

#: ../../c-api/init.rst:216
msgid ""
Expand All @@ -383,7 +391,7 @@ msgstr ""
msgid ""
"Set by the :option:`-v` option and the :envvar:`PYTHONVERBOSE` environment "
"variable."
msgstr ""
msgstr "由 :option:`-v` 選項與 :envvar:`PYTHONVERBOSE` 環境變數設定。"

#: ../../c-api/init.rst:226
msgid "Initializing and finalizing the interpreter"
Expand Down Expand Up @@ -464,7 +472,7 @@ msgid ""
"than once."
msgstr ""

#: ../../c-api/init.rst:29
#: ../../c-api/init.rst:305
msgid ""
"Raises an :ref:`auditing event <auditing>` ``cpython."
"_PySys_ClearAuditHooks`` with no arguments."
Expand Down Expand Up @@ -1030,7 +1038,7 @@ msgstr ""

#: ../../c-api/init.rst:896
msgid "High-level API"
msgstr ""
msgstr "高階 API"

#: ../../c-api/init.rst:898
msgid ""
Expand Down Expand Up @@ -1072,7 +1080,7 @@ msgstr ""

#: ../../c-api/init.rst:933
msgid "The function now does nothing."
msgstr ""
msgstr "此函式現在不會做任何事情。"

#: ../../c-api/init.rst:936
msgid ""
Expand Down Expand Up @@ -1241,7 +1249,7 @@ msgstr ""

#: ../../c-api/init.rst:1095
msgid "Low-level API"
msgstr ""
msgstr "低階 API"

#: ../../c-api/init.rst:1097
msgid ""
Expand All @@ -1259,7 +1267,7 @@ msgid ""
"function."
msgstr ""

#: ../../c-api/init.rst:5
#: ../../c-api/init.rst:1109
msgid ""
"Raises an :ref:`auditing event <auditing>` ``cpython."
"PyInterpreterState_New`` with no arguments."
Expand All @@ -1271,7 +1279,7 @@ msgid ""
"interpreter lock must be held."
msgstr ""

#: ../../c-api/init.rst:4
#: ../../c-api/init.rst:1117
msgid ""
"Raises an :ref:`auditing event <auditing>` ``cpython."
"PyInterpreterState_Clear`` with no arguments."
Expand Down Expand Up @@ -1900,7 +1908,7 @@ msgstr ""

#: ../../c-api/init.rst:1666 ../../c-api/init.rst:1680
msgid "The caller must hold the :term:`GIL`."
msgstr ""
msgstr "呼叫者必須持有 :term:`GIL`。"

#: ../../c-api/init.rst:1671
msgid ""
Expand Down
Loading