Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Translate c-api/conversion.po #751

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 1 commit into from
Dec 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 61 additions & 8 deletions c-api/conversion.po
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# 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
# Leon H., 2017
# Matt Wang <[email protected]>, 2023
msgid ""
msgstr ""
"Project-Id-Version: Python 3.12\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-29 00:03+0000\n"
"PO-Revision-Date: 2017-09-22 18:26+0000\n"
"Last-Translator: Leon H.\n"
"PO-Revision-Date: 2023-12-11 18:26+0000\n"
"Last-Translator: Matt Wang <[email protected]>\n"
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
"tw)\n"
"Language: zh_TW\n"
Expand All @@ -26,21 +26,25 @@ msgstr "字串轉換與格式化"

#: ../../c-api/conversion.rst:8
msgid "Functions for number conversion and formatted string output."
msgstr "數字轉換函式和被格式化的字串輸出。"
msgstr "用於數字轉換和格式化字串輸出的函式。"

#: ../../c-api/conversion.rst:13
msgid ""
"Output not more than *size* bytes to *str* according to the format string "
"*format* and the extra arguments. See the Unix man page :manpage:"
"`snprintf(3)`."
msgstr ""
"根據格式字串 *format* 和額外引數,輸出不超過 *size* 位元組給 *str*。請參閱 "
"Unix 手冊頁面 :manpage:`snprintf(3)`。"

#: ../../c-api/conversion.rst:19
msgid ""
"Output not more than *size* bytes to *str* according to the format string "
"*format* and the variable argument list *va*. Unix man page :manpage:"
"`vsnprintf(3)`."
msgstr ""
"根據格式字串 *format* 和變數引數串列 *va*,輸出不超過 *size* 位元組給 *str*。"
"Unix 手冊頁面 :manpage:`vsnprintf(3)`。"

#: ../../c-api/conversion.rst:23
msgid ""
Expand All @@ -49,6 +53,9 @@ msgid ""
"is to guarantee consistent behavior in corner cases, which the Standard C "
"functions do not."
msgstr ""
":c:func:`PyOS_snprintf` 和 :c:func:`PyOS_vsnprintf` 包裝標準 C 函式庫函式 :c:"
"func:`snprintf` 和 :c:func:`vsnprintf`。它們的目的是確保邊角案例 (corner "
"case) 下的行為一致,而標準 C 函式則不然。"

#: ../../c-api/conversion.rst:28
msgid ""
Expand All @@ -59,38 +66,49 @@ msgid ""
"equivalent to the C99 ``n = snprintf(NULL, 0, ...)`` which would determine "
"the necessary buffer size."
msgstr ""
"包裝器確保回傳時 ``str[size-1]`` 始終為 ``'\\0'``。他們永遠不會在 str 中寫入"
"超過 *size* 位元組(包括尾隨的 ``'\\0'``\\ )。這兩個函式都要求 ``str != "
"NULL``、``size > 0``、``format != NULL`` 和 ``size < INT_MAX``。請注意,這表"
"示沒有與 C99 ``n = snprintf(NULL, 0, ...)`` 等效的函式來決定必要的緩衝區大"
"小。"

#: ../../c-api/conversion.rst:34
msgid ""
"The return value (*rv*) for these functions should be interpreted as follows:"
msgstr "當回傳值 (*rv*) 給這些函式應該被編譯如下:"
msgstr "這些函式的回傳值 (*rv*) 應如下被直譯:"

#: ../../c-api/conversion.rst:36
msgid ""
"When ``0 <= rv < size``, the output conversion was successful and *rv* "
"characters were written to *str* (excluding the trailing ``'\\0'`` byte at "
"``str[rv]``)."
msgstr ""
"當 ``0 <= rv < size`` 時,輸出轉換成功,*rv* 字元被寫入 *str*\\ (不包括 "
"``str[rv]`` 處的尾隨 ``'\\0'`` 位元組)。"

#: ../../c-api/conversion.rst:40
msgid ""
"When ``rv >= size``, the output conversion was truncated and a buffer with "
"``rv + 1`` bytes would have been needed to succeed. ``str[size-1]`` is "
"``'\\0'`` in this case."
msgstr ""
"當 ``rv >= size`` 時,輸出轉換被截斷,並且需要具有 ``rv + 1`` 位元組的緩衝區"
"才能成功。在這種情況下,``str[size-1]`` 是 ``'\\0'``。"

#: ../../c-api/conversion.rst:44
msgid ""
"When ``rv < 0``, \"something bad happened.\" ``str[size-1]`` is ``'\\0'`` in "
"this case too, but the rest of *str* is undefined. The exact cause of the "
"error depends on the underlying platform."
msgstr ""
"當 ``rv < 0`` 時,代表「有不好的事情發生了」。在這種情況下,``str[size-1]`` "
"也是 ``'\\0'``,但 *str* 的其餘部分未定義。錯誤的確切原因取決於底層平台。"

#: ../../c-api/conversion.rst:49
msgid ""
"The following functions provide locale-independent string to number "
"conversions."
msgstr ""
msgstr "以下函式提供與區域設定無關 (locale-independent) 的字串到數字的轉換。"

#: ../../c-api/conversion.rst:53
msgid ""
Expand All @@ -100,13 +118,18 @@ msgid ""
"have leading or trailing whitespace. The conversion is independent of the "
"current locale."
msgstr ""
"將字串 ``s`` 轉換為 :c:expr:`double`,失敗時引發 Python 例外。接受的字串集合"
"對應於 Python 的 :func:`float` 建構函式接受的字串集合,但 ``s`` 不得有前導或"
"尾隨的空格。轉換與目前區域設定無關。"

#: ../../c-api/conversion.rst:59
msgid ""
"If ``endptr`` is ``NULL``, convert the whole string. Raise :exc:"
"`ValueError` and return ``-1.0`` if the string is not a valid representation "
"of a floating-point number."
msgstr ""
"如果 ``endptr`` 為 ``NULL``,則轉換整個字串。如果字串不是浮點數的有效表示,則"
"引發 :exc:`ValueError` 並回傳 ``-1.0``。"

#: ../../c-api/conversion.rst:63
msgid ""
Expand All @@ -116,6 +139,9 @@ msgid ""
"number, set ``*endptr`` to point to the beginning of the string, raise "
"ValueError, and return ``-1.0``."
msgstr ""
"如果 endptr 不是 ``NULL``,則盡可能轉換字串,並將 ``*endptr`` 設定為指向第一"
"個未轉換的字元。如果字串的初始片段都不是浮點數的有效表示,則設定 ``*endptr`` "
"指向字串的開頭,引發 ValueError 並回傳 ``-1.0``。"

#: ../../c-api/conversion.rst:70
msgid ""
Expand All @@ -127,49 +153,67 @@ msgid ""
"exception and return ``-1.0``. In both cases, set ``*endptr`` to point to "
"the first character after the converted value."
msgstr ""
"如果 ``s`` 表示的值太大而無法儲存在浮點數中(例如 ``\"1e500\"`` 在許多平台上"
"都是這樣的字串),如果 ``overflow_exception`` 為 ``NULL`` 則回傳 "
"``Py_HUGE_VAL``\\ (會帶有適當的符號)並且不設定任何例外。否則, "
"``overflow_exception`` 必須指向一個 Python 例外物件;引發該例外並回傳 "
"``-1.0``。在這兩種情況下,將 ``*endptr`` 設定為指向轉換後的值之後的第一個字"
"元。"

#: ../../c-api/conversion.rst:78
msgid ""
"If any other error occurs during the conversion (for example an out-of-"
"memory error), set the appropriate Python exception and return ``-1.0``."
msgstr ""
"如果轉換期間發生任何其他錯誤(例如記憶體不足的錯誤),請設定適當的 Python 例"
"外並回傳 ``-1.0``。"

#: ../../c-api/conversion.rst:87
msgid ""
"Convert a :c:expr:`double` *val* to a string using supplied *format_code*, "
"*precision*, and *flags*."
msgstr ""
"使用提供的 *format_code*、*precision* 和 *flags* 將 :c:expr:`double` *val* 轉"
"換為字串。"

#: ../../c-api/conversion.rst:90
msgid ""
"*format_code* must be one of ``'e'``, ``'E'``, ``'f'``, ``'F'``, ``'g'``, "
"``'G'`` or ``'r'``. For ``'r'``, the supplied *precision* must be 0 and is "
"ignored. The ``'r'`` format code specifies the standard :func:`repr` format."
msgstr ""
"*format_code* 必須是 ``'e'``、``'E'``、``'f'``、``'F'``、``'g'``、``'G'`` 或 "
"``'r'`` 其中之一。對於 ``'r'``,提供的 *precision* 必須為 0 並會被忽略。"
"``'r'`` 格式碼指定標準 :func:`repr` 格式。"

#: ../../c-api/conversion.rst:95
msgid ""
"*flags* can be zero or more of the values ``Py_DTSF_SIGN``, "
"``Py_DTSF_ADD_DOT_0``, or ``Py_DTSF_ALT``, or-ed together:"
msgstr ""
"*flags* 可以是零個或多個值 ``Py_DTSF_SIGN``、``Py_DTSF_ADD_DOT_0`` 或 "
"``Py_DTSF_ALT``,會被聯集在一起:"

#: ../../c-api/conversion.rst:98
msgid ""
"``Py_DTSF_SIGN`` means to always precede the returned string with a sign "
"character, even if *val* is non-negative."
msgstr ""
"``Py_DTSF_SIGN`` 代表總是在回傳的字串前面加上符號字元,即使 *val* 非負數。"

#: ../../c-api/conversion.rst:101
msgid ""
"``Py_DTSF_ADD_DOT_0`` means to ensure that the returned string will not look "
"like an integer."
msgstr ""
msgstr "``Py_DTSF_ADD_DOT_0`` 代表確保回傳的字串看起來不會像整數。"

#: ../../c-api/conversion.rst:104
msgid ""
"``Py_DTSF_ALT`` means to apply \"alternate\" formatting rules. See the "
"documentation for the :c:func:`PyOS_snprintf` ``'#'`` specifier for details."
msgstr ""
"``Py_DTSF_ALT`` 代表要套用「備用的 (alternate)」格式化規則。有關詳細資訊,請"
"參閱 :c:func:`PyOS_snprintf` ``'#'`` 的文件。"

#: ../../c-api/conversion.rst:108
msgid ""
Expand All @@ -178,22 +222,31 @@ msgid ""
"that *val* is a finite number, an infinite number, or not a number, "
"respectively."
msgstr ""
"如果 *ptype* 是非 ``NULL``,那麼它指向的值將被設定為 ``Py_DTST_FINITE``、"
"``Py_DTST_INFINITE`` 或 ``Py_DTST_NAN`` 其中之一,分別代表 *val* 是有限數、無"
"限數或非數。"

#: ../../c-api/conversion.rst:112
msgid ""
"The return value is a pointer to *buffer* with the converted string or "
"``NULL`` if the conversion failed. The caller is responsible for freeing the "
"returned string by calling :c:func:`PyMem_Free`."
msgstr ""
"回傳值是指向 *buffer* 的指標,其中包含轉換後的字串,如果轉換失敗則回傳 "
"``NULL``。呼叫者負責透過呼叫 :c:func:`PyMem_Free` 來釋放回傳的字串。"

#: ../../c-api/conversion.rst:121
msgid ""
"Case insensitive comparison of strings. The function works almost "
"identically to :c:func:`!strcmp` except that it ignores the case."
msgstr ""
"不區分大小寫的字串比較。函式的作用方式幾乎與 :c:func:`!strcmp` 相同,只是它忽"
"略大小寫。"

#: ../../c-api/conversion.rst:127
msgid ""
"Case insensitive comparison of strings. The function works almost "
"identically to :c:func:`!strncmp` except that it ignores the case."
msgstr ""
"不區分大小寫的字串比較。函式的作用方式幾乎與 :c:func:`!strncmp` 相同,只是它"
"忽略大小寫。"