Skip to content

Commit 2511460

Browse files
committed
feat(c-api/file): partially translate
1 parent 216bd10 commit 2511460

File tree

1 file changed

+47
-7
lines changed

1 file changed

+47
-7
lines changed

c-api/file.po

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
1-
# SOME DESCRIPTIVE TITLE.
2-
# Copyright (C) 2001-2022, Python Software Foundation
1+
# Copyright (C) 2001-2023, Python Software Foundation
32
# This file is distributed under the same license as the Python package.
43
#
54
# Translators:
65
# Ching-Lung Chuang, 2015
76
# Liang-Bo Wang <me@liang2.tw>, 2015
7+
# Matt Wang <mattwang44@gmail.com>, 2022
88
msgid ""
99
msgstr ""
1010
"Project-Id-Version: Python 3.11\n"
1111
"Report-Msgid-Bugs-To: \n"
12-
"POT-Creation-Date: 2023-04-24 00:16+0000\n"
13-
"PO-Revision-Date: 2017-09-22 18:26+0000\n"
14-
"Last-Translator: Liang-Bo Wang <me@liang2.tw>\n"
12+
"POT-Creation-Date: 2022-10-31 08:13+0000\n"
13+
"PO-Revision-Date: 2023-04-24 20:38+0800\n"
14+
"Last-Translator: Matt Wang <mattwang44@gmail.com>\n"
1515
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
1616
"tw)\n"
1717
"Language: zh_TW\n"
1818
"MIME-Version: 1.0\n"
1919
"Content-Type: text/plain; charset=UTF-8\n"
2020
"Content-Transfer-Encoding: 8bit\n"
2121
"Plural-Forms: nplurals=1; plural=0;\n"
22+
"X-Generator: Poedit 3.2.2\n"
2223

2324
#: ../../c-api/file.rst:6
2425
msgid "File Objects"
25-
msgstr "檔案(File)物件"
26+
msgstr "檔案物件 (File Objects)"
2627

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

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

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

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

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

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

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

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

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

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

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

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

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

133173
#: ../../c-api/file.rst:103
134174
msgid ""

0 commit comments

Comments
 (0)