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# Leon H., 2017
7+ # Matt Wang <mattwang44@gmail.com>, 2023
88msgid ""
99msgstr ""
1010"Project-Id-Version : Python 3.12\n "
1111"Report-Msgid-Bugs-To : \n "
1212"POT-Creation-Date : 2023-07-29 00:03+0000\n "
13- "PO-Revision-Date : 2017-09-22 18:26+0000\n "
14- "Last-Translator : Leon H. \n "
13+ "PO-Revision-Date : 2023-12-11 18:26+0000\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 "
@@ -26,21 +26,25 @@ msgstr "字串轉換與格式化"
2626
2727#: ../../c-api/conversion.rst:8
2828msgid "Functions for number conversion and formatted string output."
29- msgstr "數字轉換函式和被格式化的字串輸出 。"
29+ msgstr "用於數字轉換和格式化字串輸出的函式 。"
3030
3131#: ../../c-api/conversion.rst:13
3232msgid ""
3333"Output not more than *size* bytes to *str* according to the format string "
3434"*format* and the extra arguments. See the Unix man page :manpage:"
3535"`snprintf(3)`."
3636msgstr ""
37+ "根據格式字串 *format* 和額外引數,輸出不超過 *size* 位元組給 *str*。請參閱 "
38+ "Unix 手冊頁面 :manpage:`snprintf(3)`。"
3739
3840#: ../../c-api/conversion.rst:19
3941msgid ""
4042"Output not more than *size* bytes to *str* according to the format string "
4143"*format* and the variable argument list *va*. Unix man page :manpage:"
4244"`vsnprintf(3)`."
4345msgstr ""
46+ "根據格式字串 *format* 和變數引數串列 *va*,輸出不超過 *size* 位元組給 *str*。"
47+ "Unix 手冊頁面 :manpage:`vsnprintf(3)`。"
4448
4549#: ../../c-api/conversion.rst:23
4650msgid ""
@@ -49,6 +53,9 @@ msgid ""
4953"is to guarantee consistent behavior in corner cases, which the Standard C "
5054"functions do not."
5155msgstr ""
56+ ":c:func:`PyOS_snprintf` 和 :c:func:`PyOS_vsnprintf` 包裝標準 C 函式庫函式 :c:"
57+ "func:`snprintf` 和 :c:func:`vsnprintf`。它們的目的是確保邊角案例 (corner "
58+ "case) 下的行為一致,而標準 C 函式則不然。"
5259
5360#: ../../c-api/conversion.rst:28
5461msgid ""
@@ -59,38 +66,49 @@ msgid ""
5966"equivalent to the C99 ``n = snprintf(NULL, 0, ...)`` which would determine "
6067"the necessary buffer size."
6168msgstr ""
69+ "包裝器確保回傳時 ``str[size-1]`` 始終為 ``'\\ 0'``。他們永遠不會在 str 中寫入"
70+ "超過 *size* 位元組(包括尾隨的 ``'\\ 0'``\\ )。這兩個函式都要求 ``str != "
71+ "NULL``、``size > 0``、``format != NULL`` 和 ``size < INT_MAX``。請注意,這表"
72+ "示沒有與 C99 ``n = snprintf(NULL, 0, ...)`` 等效的函式來決定必要的緩衝區大"
73+ "小。"
6274
6375#: ../../c-api/conversion.rst:34
6476msgid ""
6577"The return value (*rv*) for these functions should be interpreted as follows:"
66- msgstr "當回傳值 (*rv*) 給這些函式應該被編譯如下 :"
78+ msgstr "這些函式的回傳值 (*rv*) 應如下被直譯 :"
6779
6880#: ../../c-api/conversion.rst:36
6981msgid ""
7082"When ``0 <= rv < size``, the output conversion was successful and *rv* "
7183"characters were written to *str* (excluding the trailing ``'\\ 0'`` byte at "
7284"``str[rv]``)."
7385msgstr ""
86+ "當 ``0 <= rv < size`` 時,輸出轉換成功,*rv* 字元被寫入 *str*\\ (不包括 "
87+ "``str[rv]`` 處的尾隨 ``'\\ 0'`` 位元組)。"
7488
7589#: ../../c-api/conversion.rst:40
7690msgid ""
7791"When ``rv >= size``, the output conversion was truncated and a buffer with "
7892"``rv + 1`` bytes would have been needed to succeed. ``str[size-1]`` is "
7993"``'\\ 0'`` in this case."
8094msgstr ""
95+ "當 ``rv >= size`` 時,輸出轉換被截斷,並且需要具有 ``rv + 1`` 位元組的緩衝區"
96+ "才能成功。在這種情況下,``str[size-1]`` 是 ``'\\ 0'``。"
8197
8298#: ../../c-api/conversion.rst:44
8399msgid ""
84100"When ``rv < 0``, \" something bad happened.\" ``str[size-1]`` is ``'\\ 0'`` in "
85101"this case too, but the rest of *str* is undefined. The exact cause of the "
86102"error depends on the underlying platform."
87103msgstr ""
104+ "當 ``rv < 0`` 時,代表「有不好的事情發生了」。在這種情況下,``str[size-1]`` "
105+ "也是 ``'\\ 0'``,但 *str* 的其餘部分未定義。錯誤的確切原因取決於底層平台。"
88106
89107#: ../../c-api/conversion.rst:49
90108msgid ""
91109"The following functions provide locale-independent string to number "
92110"conversions."
93- msgstr ""
111+ msgstr "以下函式提供與區域設定無關 (locale-independent) 的字串到數字的轉換。 "
94112
95113#: ../../c-api/conversion.rst:53
96114msgid ""
@@ -100,13 +118,18 @@ msgid ""
100118"have leading or trailing whitespace. The conversion is independent of the "
101119"current locale."
102120msgstr ""
121+ "將字串 ``s`` 轉換為 :c:expr:`double`,失敗時引發 Python 例外。接受的字串集合"
122+ "對應於 Python 的 :func:`float` 建構函式接受的字串集合,但 ``s`` 不得有前導或"
123+ "尾隨的空格。轉換與目前區域設定無關。"
103124
104125#: ../../c-api/conversion.rst:59
105126msgid ""
106127"If ``endptr`` is ``NULL``, convert the whole string. Raise :exc:"
107128"`ValueError` and return ``-1.0`` if the string is not a valid representation "
108129"of a floating-point number."
109130msgstr ""
131+ "如果 ``endptr`` 為 ``NULL``,則轉換整個字串。如果字串不是浮點數的有效表示,則"
132+ "引發 :exc:`ValueError` 並回傳 ``-1.0``。"
110133
111134#: ../../c-api/conversion.rst:63
112135msgid ""
@@ -116,6 +139,9 @@ msgid ""
116139"number, set ``*endptr`` to point to the beginning of the string, raise "
117140"ValueError, and return ``-1.0``."
118141msgstr ""
142+ "如果 endptr 不是 ``NULL``,則盡可能轉換字串,並將 ``*endptr`` 設定為指向第一"
143+ "個未轉換的字元。如果字串的初始片段都不是浮點數的有效表示,則設定 ``*endptr`` "
144+ "指向字串的開頭,引發 ValueError 並回傳 ``-1.0``。"
119145
120146#: ../../c-api/conversion.rst:70
121147msgid ""
@@ -127,49 +153,67 @@ msgid ""
127153"exception and return ``-1.0``. In both cases, set ``*endptr`` to point to "
128154"the first character after the converted value."
129155msgstr ""
156+ "如果 ``s`` 表示的值太大而無法儲存在浮點數中(例如 ``\" 1e500\" `` 在許多平台上"
157+ "都是這樣的字串),如果 ``overflow_exception`` 為 ``NULL`` 則回傳 "
158+ "``Py_HUGE_VAL``\\ (會帶有適當的符號)並且不設定任何例外。否則, "
159+ "``overflow_exception`` 必須指向一個 Python 例外物件;引發該例外並回傳 "
160+ "``-1.0``。在這兩種情況下,將 ``*endptr`` 設定為指向轉換後的值之後的第一個字"
161+ "元。"
130162
131163#: ../../c-api/conversion.rst:78
132164msgid ""
133165"If any other error occurs during the conversion (for example an out-of-"
134166"memory error), set the appropriate Python exception and return ``-1.0``."
135167msgstr ""
168+ "如果轉換期間發生任何其他錯誤(例如記憶體不足的錯誤),請設定適當的 Python 例"
169+ "外並回傳 ``-1.0``。"
136170
137171#: ../../c-api/conversion.rst:87
138172msgid ""
139173"Convert a :c:expr:`double` *val* to a string using supplied *format_code*, "
140174"*precision*, and *flags*."
141175msgstr ""
176+ "使用提供的 *format_code*、*precision* 和 *flags* 將 :c:expr:`double` *val* 轉"
177+ "換為字串。"
142178
143179#: ../../c-api/conversion.rst:90
144180msgid ""
145181"*format_code* must be one of ``'e'``, ``'E'``, ``'f'``, ``'F'``, ``'g'``, "
146182"``'G'`` or ``'r'``. For ``'r'``, the supplied *precision* must be 0 and is "
147183"ignored. The ``'r'`` format code specifies the standard :func:`repr` format."
148184msgstr ""
185+ "*format_code* 必須是 ``'e'``、``'E'``、``'f'``、``'F'``、``'g'``、``'G'`` 或 "
186+ "``'r'`` 其中之一。對於 ``'r'``,提供的 *precision* 必須為 0 並會被忽略。"
187+ "``'r'`` 格式碼指定標準 :func:`repr` 格式。"
149188
150189#: ../../c-api/conversion.rst:95
151190msgid ""
152191"*flags* can be zero or more of the values ``Py_DTSF_SIGN``, "
153192"``Py_DTSF_ADD_DOT_0``, or ``Py_DTSF_ALT``, or-ed together:"
154193msgstr ""
194+ "*flags* 可以是零個或多個值 ``Py_DTSF_SIGN``、``Py_DTSF_ADD_DOT_0`` 或 "
195+ "``Py_DTSF_ALT``,會被聯集在一起:"
155196
156197#: ../../c-api/conversion.rst:98
157198msgid ""
158199"``Py_DTSF_SIGN`` means to always precede the returned string with a sign "
159200"character, even if *val* is non-negative."
160201msgstr ""
202+ "``Py_DTSF_SIGN`` 代表總是在回傳的字串前面加上符號字元,即使 *val* 非負數。"
161203
162204#: ../../c-api/conversion.rst:101
163205msgid ""
164206"``Py_DTSF_ADD_DOT_0`` means to ensure that the returned string will not look "
165207"like an integer."
166- msgstr ""
208+ msgstr "``Py_DTSF_ADD_DOT_0`` 代表確保回傳的字串看起來不會像整數。 "
167209
168210#: ../../c-api/conversion.rst:104
169211msgid ""
170212"``Py_DTSF_ALT`` means to apply \" alternate\" formatting rules. See the "
171213"documentation for the :c:func:`PyOS_snprintf` ``'#'`` specifier for details."
172214msgstr ""
215+ "``Py_DTSF_ALT`` 代表要套用「備用的 (alternate)」格式化規則。有關詳細資訊,請"
216+ "參閱 :c:func:`PyOS_snprintf` ``'#'`` 的文件。"
173217
174218#: ../../c-api/conversion.rst:108
175219msgid ""
@@ -178,22 +222,31 @@ msgid ""
178222"that *val* is a finite number, an infinite number, or not a number, "
179223"respectively."
180224msgstr ""
225+ "如果 *ptype* 是非 ``NULL``,那麼它指向的值將被設定為 ``Py_DTST_FINITE``、"
226+ "``Py_DTST_INFINITE`` 或 ``Py_DTST_NAN`` 其中之一,分別代表 *val* 是有限數、無"
227+ "限數或非數。"
181228
182229#: ../../c-api/conversion.rst:112
183230msgid ""
184231"The return value is a pointer to *buffer* with the converted string or "
185232"``NULL`` if the conversion failed. The caller is responsible for freeing the "
186233"returned string by calling :c:func:`PyMem_Free`."
187234msgstr ""
235+ "回傳值是指向 *buffer* 的指標,其中包含轉換後的字串,如果轉換失敗則回傳 "
236+ "``NULL``。呼叫者負責透過呼叫 :c:func:`PyMem_Free` 來釋放回傳的字串。"
188237
189238#: ../../c-api/conversion.rst:121
190239msgid ""
191240"Case insensitive comparison of strings. The function works almost "
192241"identically to :c:func:`!strcmp` except that it ignores the case."
193242msgstr ""
243+ "不區分大小寫的字串比較。函式的作用方式幾乎與 :c:func:`!strcmp` 相同,只是它忽"
244+ "略大小寫。"
194245
195246#: ../../c-api/conversion.rst:127
196247msgid ""
197248"Case insensitive comparison of strings. The function works almost "
198249"identically to :c:func:`!strncmp` except that it ignores the case."
199250msgstr ""
251+ "不區分大小寫的字串比較。函式的作用方式幾乎與 :c:func:`!strncmp` 相同,只是它"
252+ "忽略大小寫。"
0 commit comments