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