-
-
Notifications
You must be signed in to change notification settings - Fork 98
Expand file tree
/
Copy pathconversion.po
More file actions
397 lines (342 loc) · 17.2 KB
/
conversion.po
File metadata and controls
397 lines (342 loc) · 17.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001 Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Translators:
# python-doc bot, 2025
# 99 <wh2099@pm.me>, 2026
# Freesand Leo <yuqinju@163.com>, 2026
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Python 3.15\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-05-08 18:34+0000\n"
"PO-Revision-Date: 2025-09-16 00:00+0000\n"
"Last-Translator: Freesand Leo <yuqinju@163.com>, 2026\n"
"Language-Team: Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: zh_CN\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: ../../c-api/conversion.rst:6
msgid "String conversion and formatting"
msgstr "字符串转换与格式化"
#: ../../c-api/conversion.rst:8
msgid "Functions for number conversion and formatted string output."
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 ""
":c:func:`PyOS_snprintf` and :c:func:`PyOS_vsnprintf` wrap the Standard C "
"library functions :c:func:`snprintf` and :c:func:`vsnprintf`. Their purpose "
"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`。它们的目的是保证在极端情况下的一致行为,而标准 C 的函数则不然。"
#: ../../c-api/conversion.rst:28
msgid ""
"The wrappers ensure that ``str[size-1]`` is always ``'\\0'`` upon return. "
"They never write more than *size* bytes (including the trailing ``'\\0'``) "
"into str. Both functions require that ``str != NULL``, ``size > 0``, "
"``format != NULL`` and ``size < INT_MAX``. Note that this means there is no "
"equivalent to the C99 ``n = snprintf(NULL, 0, ...)`` which would determine "
"the necessary buffer size."
msgstr ""
"此包装器会确保 ``str[size-1]`` 在返回时始终为 ``'\\0'``。它们从不写入超过 *size* 字节 (包括末尾的 "
"``'\\0'``) 到 str。两个函数都要求 ``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* )应按照以下规则被解释:"
#: ../../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``, the output conversion failed and ``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 "以下函数提供与语言环境无关的字符串到数字转换。"
#: ../../c-api/conversion.rst:53
msgid ""
"Convert the initial part of the string in ``str`` to an :c:expr:`unsigned "
"long` value according to the given ``base``, which must be between ``2`` and"
" ``36`` inclusive, or be the special value ``0``."
msgstr ""
"根据给定的 ``base`` 将 ``str`` 中字符串的初始部分转换为 :c:expr:`unsigned long` 值,基数必须在 ``2`` "
"至 ``36`` 之间(包括边界值),或者为特殊值 ``0``。"
#: ../../c-api/conversion.rst:57
msgid ""
"Leading white space and case of characters are ignored. If ``base`` is zero"
" it looks for a leading ``0b``, ``0o`` or ``0x`` to tell which base. If "
"these are absent it defaults to ``10``. Base must be 0 or between 2 and 36 "
"(inclusive). If ``ptr`` is non-``NULL`` it will contain a pointer to the "
"end of the scan."
msgstr ""
"空白前缀和字符大小写将被忽略。如果 ``base`` 为零则会查找 ``0b``、``0o`` 或 ``0x`` 前缀以确定基数。如果没有则默认基数为 "
"``10``。基数必须为 0 或在 2 和 36 之间(包括边界值)。如果 ``ptr`` 不为 ``NULL`` "
"则它将包含一个指向扫描结束位置的指针。"
#: ../../c-api/conversion.rst:63
msgid ""
"If the converted value falls out of range of corresponding return type, "
"range error occurs (:c:data:`errno` is set to :c:macro:`!ERANGE`) and "
":c:macro:`!ULONG_MAX` is returned. If no conversion can be performed, ``0``"
" is returned."
msgstr ""
"如果转换后的值不在对应返回类型的取值范围之内,则会发生取值范围错误 (:c:data:`errno` 被设为 :c:macro:`!ERANGE`) "
"并返回 :c:macro:`!ULONG_MAX`。如果无法执行转换,则返回 ``0``。"
#: ../../c-api/conversion.rst:68
msgid "See also the Unix man page :manpage:`strtoul(3)`."
msgstr "另请参阅 Unix 手册页 :manpage:`strtoul(3)`。"
#: ../../c-api/conversion.rst:75
msgid ""
"Convert the initial part of the string in ``str`` to an :c:expr:`long` value"
" according to the given ``base``, which must be between ``2`` and ``36`` "
"inclusive, or be the special value ``0``."
msgstr ""
"根据给定的 ``base`` 将 ``str`` 中字符串的初始部分转换为 :c:expr:`long` 值,基数必须在 ``2`` 至 ``36`` "
"之间(包括边界值),或者为特殊值 ``0``。"
#: ../../c-api/conversion.rst:79
msgid ""
"Same as :c:func:`PyOS_strtoul`, but return a :c:expr:`long` value instead "
"and :c:macro:`LONG_MAX` on overflows."
msgstr ""
"类似于 :c:func:`PyOS_strtoul`,但改为返回 :c:expr:`long` 值,溢出时返回 :c:macro:`LONG_MAX`。"
#: ../../c-api/conversion.rst:82
msgid "See also the Unix man page :manpage:`strtol(3)`."
msgstr "另请参阅 Unix 手册页 :manpage:`strtol(3)`。"
#: ../../c-api/conversion.rst:89
msgid ""
"Convert a string ``s`` to a :c:expr:`double`, raising a Python exception on "
"failure. The set of accepted strings corresponds to the set of strings "
"accepted by Python's :func:`float` constructor, except that ``s`` must not "
"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:95
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:99
msgid ""
"If endptr is not ``NULL``, convert as much of the string as possible and set"
" ``*endptr`` to point to the first unconverted character. If no initial "
"segment of the string is the valid representation of a floating-point "
"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:106
msgid ""
"If ``s`` represents a value that is too large to store in a float (for "
"example, ``\"1e500\"`` is such a string on many platforms) then if "
"``overflow_exception`` is ``NULL`` return :c:macro:`!INFINITY` (with an "
"appropriate sign) and don't set any exception. Otherwise, "
"``overflow_exception`` must point to a Python exception object; raise that "
"exception and return ``-1.0``. In both cases, set ``*endptr`` to point to "
"the first character after the converted value."
msgstr ""
#: ../../c-api/conversion.rst:114
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:123
msgid ""
"Convert a :c:expr:`double` *val* to a string using supplied *format_code*, "
"*precision*, and *flags*."
msgstr ""
"将 :c:expr:`double` *val* 转换为一个使用给定的 *format_code*, *precision* 和 *flags* "
"的字符串。"
#: ../../c-api/conversion.rst:126
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:131
msgid "*flags* can be zero or more of the following values or-ed together:"
msgstr "*flags* 可以为零或多个下列值进行或运算的结果:"
#: ../../c-api/conversion.rst:137
msgid ""
"Always precede the returned string with a sign character, even if *val* is "
"non-negative."
msgstr "总是在返回的字符串前加一个正负号字符,即使 *val* 为非负数。"
#: ../../c-api/conversion.rst:142
msgid "Ensure that the returned string will not look like an integer."
msgstr "确保返回的字符串看起来不像是一个整数。"
#: ../../c-api/conversion.rst:146
msgid ""
"Apply \"alternate\" formatting rules. See the documentation for the "
":c:func:`PyOS_snprintf` ``'#'`` specifier for details."
msgstr "应用“替代”格式化规则。请参阅 :c:func:`PyOS_snprintf` ``'#'`` 格式符的文档了解详情。"
#: ../../c-api/conversion.rst:152
msgid "Negative zero is converted to positive zero."
msgstr "负零将被转换为正零。"
#: ../../c-api/conversion.rst:156
msgid ""
"If *ptype* is non-``NULL``, then the value it points to will be set to one "
"of the following constants depending on the type of *val*:"
msgstr "如果 *ptype* 不为 ``NULL``,则它指向的值将根据 *val* 的类型被设为以下常量之一:"
#: ../../c-api/conversion.rst:163
msgid "*\\*ptype*"
msgstr "*\\*ptype*"
#: ../../c-api/conversion.rst:164
msgid "type of *val*"
msgstr "*val* 的类型"
#: ../../c-api/conversion.rst:166
msgid "finite number"
msgstr "有限数字"
#: ../../c-api/conversion.rst:168
msgid "infinite number"
msgstr "无穷大数字"
#: ../../c-api/conversion.rst:170
msgid "not a number"
msgstr "非数字"
#: ../../c-api/conversion.rst:172
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:182
msgid ""
"Case insensitive comparison of strings. These functions work almost "
"identically to :c:func:`!strcmp` and :c:func:`!strncmp` (respectively), "
"except that they ignore the case of ASCII characters."
msgstr ""
"不区分大小写的字符串比较。这些函数的工作方式(分别)与 :c:func:`!strcmp` 和 :c:func:`!strncmp` "
"几乎一样,只是它们会忽略 ASCII 字符的大小写。"
#: ../../c-api/conversion.rst:186
msgid ""
"Return ``0`` if the strings are equal, a negative value if *str1* sorts "
"lexicographically before *str2*, or a positive value if it sorts after."
msgstr "如果字符串相等则返回 ``0``,如果 *str1* 的词典排序在 *str2* 之前则返回负值,或者如果排序在其后则返回正值。"
#: ../../c-api/conversion.rst:189
msgid ""
"In the *str1* or *str2* arguments, a NUL byte marks the end of the string. "
"For :c:func:`!PyOS_mystrnicmp`, the *size* argument gives the maximum size "
"of the string, as if NUL was present at the index given by *size*."
msgstr ""
"在 *str1* 或 *str2* 参数中,NUL 字符表示字符串结束。对于 :c:func:`!PyOS_mystrnicmp`,*size* "
"参数给出了字符串的最大长度,就像 NUL 出现在由 *size* 给出的索引位置。"
#: ../../c-api/conversion.rst:193
msgid "These functions do not use the locale."
msgstr "这些函数不使用语言区域设置。"
#: ../../c-api/conversion.rst:199
msgid "Case insensitive comparison of strings."
msgstr "忽略大小写的字符串比较。"
#: ../../c-api/conversion.rst:201
msgid ""
"On Windows, these are aliases of :c:func:`!stricmp` and :c:func:`!strnicmp`,"
" respectively."
msgstr "在 Windows 上,它们分别是 :c:func:`!stricmp` 和 :c:func:`!strnicmp` 的别名。"
#: ../../c-api/conversion.rst:204
msgid ""
"On other platforms, they are aliases of :c:func:`PyOS_mystricmp` and "
":c:func:`PyOS_mystrnicmp`, respectively."
msgstr ""
"在其他平台上,它们分别是 :c:func:`PyOS_mystricmp` 和 :c:func:`PyOS_mystrnicmp` 的别名。"
#: ../../c-api/conversion.rst:209
msgid "Character classification and conversion"
msgstr "字符分类与转换"
#: ../../c-api/conversion.rst:211
msgid ""
"The following macros provide locale-independent (unlike the C standard "
"library ``ctype.h``) character classification and conversion. The argument "
"must be a signed or unsigned :c:expr:`char`."
msgstr ""
"下列宏提供了独立于语言区域 (不同于 C 标准库 ``ctype.h``) 的字符分类与转换。其参数必须是一个有符号或无符号的 "
":c:expr:`char` 值。"
#: ../../c-api/conversion.rst:218
msgid "Return true if the character *c* is an alphanumeric character."
msgstr "如果字符 *c* 为字母数字类字符则返回真值。"
#: ../../c-api/conversion.rst:223
msgid ""
"Return true if the character *c* is an alphabetic character (``a-z`` and "
"``A-Z``)."
msgstr "如果字符 *c* 为字母类字符 (``a-z`` 和 ``A-Z``) 则返回真值。"
#: ../../c-api/conversion.rst:228
msgid "Return true if the character *c* is a decimal digit (``0-9``)."
msgstr "如果字符 *c* 为十进制数码 (``0-9``) 则返回真值。"
#: ../../c-api/conversion.rst:233
msgid ""
"Return true if the character *c* is a lowercase ASCII letter (``a-z``)."
msgstr "如果字符 *c* 为小写 ASCII 字母 (``a-z``) 则返回真值。"
#: ../../c-api/conversion.rst:238
msgid ""
"Return true if the character *c* is an uppercase ASCII letter (``A-Z``)."
msgstr "如果字符 *c* 是一个大写 ASCII 字母 (``A-Z``) 则返回真值。"
#: ../../c-api/conversion.rst:243
msgid ""
"Return true if the character *c* is a whitespace character (space, tab, "
"carriage return, newline, vertical tab, or form feed)."
msgstr "如果字符 *c* 是一个空白字符 (空格符,制表符,回车符,换行符,垂直制表符或换页符) 则返回真值。"
#: ../../c-api/conversion.rst:249
msgid ""
"Return true if the character *c* is a hexadecimal digit (``0-9``, ``a-f``, "
"and ``A-F``)."
msgstr "如果字符 *c* 是一个十六进制数码 (``0-9``, ``a-f`` 和 ``A-F``) 则返回真值。"
#: ../../c-api/conversion.rst:255
msgid "Return the lowercase equivalent of the character *c*."
msgstr "返回字符 *c* 的小写形式。"
#: ../../c-api/conversion.rst:260
msgid "Return the uppercase equivalent of the character *c*."
msgstr "返回字符 *c* 的大写形式。"