@@ -150,7 +150,7 @@ msgid ""
150
150
"reference check for container types will be skipped and a circular reference "
151
151
"will result in a :exc:`RecursionError` (or worse)."
152
152
msgstr ""
153
- "如果 *chech_circular * 設為 false(預設是 ``True``),則針對不同容器型別的循環"
153
+ "如果 *check_circular * 設為 false(預設是 ``True``),則針對不同容器型別的循環"
154
154
"參照 (circular reference) 的檢查將會被跳過,若有循環參照則最後將引發 :exc:"
155
155
"`RecursionError` (或者更糟的錯誤)。"
156
156
@@ -162,6 +162,10 @@ msgid ""
162
162
"*allow_nan* is true, their JavaScript equivalents (``NaN``, ``Infinity``, ``-"
163
163
"Infinity``) will be used."
164
164
msgstr ""
165
+ "如果 *allow_nan* 為 false(預設值:``True``\\ ),則序列化超出嚴格 JSON 規範"
166
+ "之範圍的 :class:`float` 值 (``nan``, ``inf``, ``-inf``) 會引發 :exc:"
167
+ "`ValueError`。如果 *allow_nan* 為 true,則將使用它們的 JavaScript 等效項 "
168
+ "(``NaN``, ``Infinity``, ``-Infinity``)。"
165
169
166
170
#: ../../library/json.rst:168 ../../library/json.rst:452
167
171
msgid ""
@@ -172,10 +176,14 @@ msgid ""
172
176
"indent indents that many spaces per level. If *indent* is a string (such as "
173
177
"``\"\\ t\" ``), that string is used to indent each level."
174
178
msgstr ""
179
+ "如果 *indent* 是非負整數或字串,則 JSON 陣列元素和物件成員將使用該縮排等級進"
180
+ "行漂亮列印。縮排等級 0、負數或 ``\"\" `` 只會插入換行符號。``None``\\ (預設"
181
+ "值)選擇最緊湊的表示法。使用正整數縮排可以在每層縮排數量相同的空格。如果 "
182
+ "*indent* 是一個字串(例如 ``\"\\ t\" ``\\ ),則該字串用於縮排每個層級。"
175
183
176
184
#: ../../library/json.rst:175 ../../library/json.rst:459
177
185
msgid "Allow strings for *indent* in addition to integers."
178
- msgstr ""
186
+ msgstr "除了整數之外,還允許使用字串進行 *indent*。 "
179
187
180
188
#: ../../library/json.rst:178 ../../library/json.rst:462
181
189
msgid ""
@@ -184,10 +192,13 @@ msgid ""
184
192
"': ')`` otherwise. To get the most compact JSON representation, you should "
185
193
"specify ``(',', ':')`` to eliminate whitespace."
186
194
msgstr ""
195
+ "如果有指定,*separators* 應該是一個 ``(item_separator, key_separator)`` 元"
196
+ "組。如果 *indent* 為 ``None`` 則預設為 ``(', ', ': ')``,否則預設為 ``(',', "
197
+ "': ')``。要獲得最緊湊的 JSON 表示形式,你應該指定 ``(',', ':')`` 來消除空格。"
187
198
188
199
#: ../../library/json.rst:183 ../../library/json.rst:467
189
200
msgid "Use ``(',', ': ')`` as default if *indent* is not ``None``."
190
- msgstr ""
201
+ msgstr "如果 *indent* 不是 ``None``,則用 ``(',', ': ')`` 當預設值 "
191
202
192
203
#: ../../library/json.rst:186 ../../library/json.rst:470
193
204
msgid ""
@@ -196,38 +207,50 @@ msgid ""
196
207
"version of the object or raise a :exc:`TypeError`. If not specified, :exc:"
197
208
"`TypeError` is raised."
198
209
msgstr ""
210
+ "如果有指定,*default* 應該是一個為無法序列化的物件呼叫的函式。它應該傳回物件"
211
+ "的 JSON 可編碼版本或引發 :exc:`TypeError`。如果未指定,則會引發 :exc:"
212
+ "`TypeError`。"
199
213
200
214
#: ../../library/json.rst:191
201
215
msgid ""
202
216
"If *sort_keys* is true (default: ``False``), then the output of dictionaries "
203
217
"will be sorted by key."
204
218
msgstr ""
219
+ "如果 *sort_keys* 為 true(預設值:``False``),則字典的輸出將按鍵排序。"
205
220
206
221
#: ../../library/json.rst:194
207
222
msgid ""
208
223
"To use a custom :class:`JSONEncoder` subclass (e.g. one that overrides the :"
209
224
"meth:`~JSONEncoder.default` method to serialize additional types), specify "
210
225
"it with the *cls* kwarg; otherwise :class:`JSONEncoder` is used."
211
226
msgstr ""
227
+ "若要使用自訂 :class:`JSONEncoder` 子類別(例如覆寫 :meth:`~JSONEncoder."
228
+ "default` 方法來序列化其他型別的子類別),請使用 *cls* kwarg 指定它;否則使"
229
+ "用 :class:`JSONEncoder`。"
212
230
213
231
#: ../../library/json.rst:198 ../../library/json.rst:277
214
232
msgid ""
215
233
"All optional parameters are now :ref:`keyword-only <keyword-only_parameter>`."
216
234
msgstr ""
235
+ "所有可選參數現在都是\\ :ref:`僅限關鍵字 <keyword-only_parameter>`\\ 了。"
217
236
218
237
#: ../../library/json.rst:203
219
238
msgid ""
220
239
"Unlike :mod:`pickle` and :mod:`marshal`, JSON is not a framed protocol, so "
221
240
"trying to serialize multiple objects with repeated calls to :func:`dump` "
222
241
"using the same *fp* will result in an invalid JSON file."
223
242
msgstr ""
243
+ "與 :mod:`pickle` 和 :mod:`marshal` 不同,JSON 不是框架協定,因此嘗試使用相同"
244
+ "的 *fp* 重複呼叫 :func:`dump` 來序列化多個物件將導致無效的 JSON 檔案。"
224
245
225
246
#: ../../library/json.rst:212
226
247
msgid ""
227
248
"Serialize *obj* to a JSON formatted :class:`str` using this :ref:`conversion "
228
249
"table <py-to-json-table>`. The arguments have the same meaning as in :func:"
229
250
"`dump`."
230
251
msgstr ""
252
+ "使用此\\ :ref:`轉換表 <json-to-py-table>`\\ 來將 *obj* 序列化為 JSON 格式化 :"
253
+ "class:`str`。這些引數與 :func:`dump` 中的意義相同。"
231
254
232
255
#: ../../library/json.rst:218
233
256
msgid ""
@@ -237,13 +260,20 @@ msgid ""
237
260
"JSON and then back into a dictionary, the dictionary may not equal the "
238
261
"original one. That is, ``loads(dumps(x)) != x`` if x has non-string keys."
239
262
msgstr ""
263
+ "JSON 鍵/值對中的鍵始終為 :class:`str` 型別。當字典轉換為 JSON 時,字典的所有"
264
+ "鍵都被強制轉換為字串。因此,如果將字典轉換為 JSON,然後再轉換回字典,則該字典"
265
+ "可能不等於原始字典。也就是說,如果 x 有非字串鍵,則 ``loads(dumps(x)) != "
266
+ "x``。"
240
267
241
268
#: ../../library/json.rst:227
242
269
msgid ""
243
270
"Deserialize *fp* (a ``.read()``-supporting :term:`text file` or :term:"
244
271
"`binary file` containing a JSON document) to a Python object using this :ref:"
245
272
"`conversion table <json-to-py-table>`."
246
273
msgstr ""
274
+ "使用此\\ :ref:`轉換表 <json-to-py-table>`\\ 來將 *fp*\\ (一個支援 ``."
275
+ "read()``、包含 JSON 文件的\\ :term:`文字檔案 <text file>`\\ 或\\ :term:`二進"
276
+ "位檔案 <binary file>`\\ )反序列化為 Python 物件。"
247
277
248
278
#: ../../library/json.rst:231
249
279
msgid ""
@@ -253,6 +283,10 @@ msgid ""
253
283
"be used to implement custom decoders (e.g. `JSON-RPC <https://www.jsonrpc."
254
284
"org>`_ class hinting)."
255
285
msgstr ""
286
+ "*object_hook* 是一個可選函式,將使用任何物件文本解碼的結果(一個 :class:"
287
+ "`dict`\\ )來呼叫它。將使用 *object_hook* 的回傳值而不是 :class:`dict`。此功"
288
+ "能可用於實作自訂解碼器(例如 `JSON-RPC <https://www.jsonrpc.org>`_ 類別提"
289
+ "示)。"
256
290
257
291
#: ../../library/json.rst:237
258
292
msgid ""
@@ -262,6 +296,10 @@ msgid ""
262
296
"`dict`. This feature can be used to implement custom decoders. If "
263
297
"*object_hook* is also defined, the *object_pairs_hook* takes priority."
264
298
msgstr ""
299
+ "*object_pairs_hook* 是一個可選函式,將使用使用有序對列表解碼的任何物件文本的"
300
+ "結果來呼叫該函式。將使用 *object_pairs_hook* 的回傳值而不是 :class:`dict`。此"
301
+ "功能可用於實作自訂解碼器。如果也定義了 *object_hook*,則 *object_pairs_hook* "
302
+ "優先。"
265
303
266
304
#: ../../library/json.rst:243 ../../library/json.rst:348
267
305
msgid "Added support for *object_pairs_hook*."
@@ -274,6 +312,9 @@ msgid ""
274
312
"This can be used to use another datatype or parser for JSON floats (e.g. :"
275
313
"class:`decimal.Decimal`)."
276
314
msgstr ""
315
+ "如有指定 *parse_float*,將使用要解碼的每個 JSON 浮點數字串進行呼叫。預設情況"
316
+ "下,這相當於 ``float(num_str)``。這可用於將另一種資料型別或剖析器用於 JSON 浮"
317
+ "點(例如 :class:`decimal.Decimal`\\ )。"
277
318
278
319
#: ../../library/json.rst:251 ../../library/json.rst:356
279
320
msgid ""
@@ -282,24 +323,33 @@ msgid ""
282
323
"can be used to use another datatype or parser for JSON integers (e.g. :class:"
283
324
"`float`)."
284
325
msgstr ""
326
+ "如有指定 *parse_int*,將使用要解碼的每個 JSON 整數字串進行呼叫。預設情況下,"
327
+ "這相當於 ``int(num_str)``。這可用於對 JSON 整數使用另一種資料型別或剖析器(例"
328
+ "如 :class:`float`\\ )。"
285
329
286
330
#: ../../library/json.rst:256
287
331
msgid ""
288
332
"The default *parse_int* of :func:`int` now limits the maximum length of the "
289
333
"integer string via the interpreter's :ref:`integer string conversion length "
290
334
"limitation <int_max_str_digits>` to help avoid denial of service attacks."
291
335
msgstr ""
336
+ ":func:`int` 預設的 *parse_int* 現在對於整數字串有長度上限,上限是直譯器的\\ :"
337
+ "ref:`整數字串轉換長度限制 <int_max_str_digits>`,這能防止阻斷服務攻擊 "
338
+ "(denial of service attacks)。"
292
339
293
340
#: ../../library/json.rst:262 ../../library/json.rst:361
294
341
msgid ""
295
342
"*parse_constant*, if specified, will be called with one of the following "
296
343
"strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``. This can be used to "
297
344
"raise an exception if invalid JSON numbers are encountered."
298
345
msgstr ""
346
+ "如果 *parse_constant* 有值,那麼以 ``'-Infinity'``、``'Infinity'`` 或 "
347
+ "``'NaN'`` 字串其中之一來呼叫。這也可用於在遇到無效的 JSON 數字時引發一個例"
348
+ "外。"
299
349
300
350
#: ../../library/json.rst:267
301
351
msgid "*parse_constant* doesn't get called on 'null', 'true', 'false' anymore."
302
- msgstr ""
352
+ msgstr "*parse_constant* 不再以 'null'、 'true'、 'false' 呼叫了。 "
303
353
304
354
#: ../../library/json.rst:270
305
355
msgid ""
0 commit comments