@@ -136,13 +136,17 @@ msgid ""
136136"all incoming non-ASCII characters escaped. If *ensure_ascii* is false, "
137137"these characters will be output as-is."
138138msgstr ""
139+ "如果 *ensure_ascii* 是 true (即默认值),输出保证将所有输入的非 ASCII 字符转义。如果 *ensure_ascii* 是 "
140+ "false,这些字符会原样输出。"
139141
140142#: ../../library/json.rst:148
141143msgid ""
142144"If *check_circular* is false (default: ``True``), then the circular "
143145"reference check for container types will be skipped and a circular reference"
144146" will result in an :exc:`OverflowError` (or worse)."
145147msgstr ""
148+ "如果 *check_circular* 是 false (默认为 ``True``),那么容器类型的循环引用检验会被跳过并且循环引用会引发一个 "
149+ ":exc:`OverflowError`(或者更糟的情况)。"
146150
147151#: ../../library/json.rst:152
148152msgid ""
@@ -152,6 +156,9 @@ msgid ""
152156"*allow_nan* is true, their JavaScript equivalents (``NaN``, ``Infinity``, "
153157"``-Infinity``) will be used."
154158msgstr ""
159+ "如果 *allow_nan* 是 false(默认为 ``True``),那么在对严格 JSON 规格范围外的 :class:`float` "
160+ "类型值(``nan``、``inf`` 和 ``-inf``)进行序列化时会引发一个 :exc:`ValueError`。如果 *allow_nan* "
161+ "是 true,则使用它们的 JavaScript 等价形式(``NaN``、``Infinity`` 和 ``-Infinity``)。"
155162
156163#: ../../library/json.rst:158 ../../library/json.rst:435
157164msgid ""
@@ -162,10 +169,13 @@ msgid ""
162169"indent indents that many spaces per level. If *indent* is a string (such as"
163170" ``\"\\ t\" ``), that string is used to indent each level."
164171msgstr ""
172+ "如果 *indent* 是一个非负整数或者字符串,那么 JSON 数组元素和对象成员会被美化输出为该值指定的缩进等级。如果缩进等级为零、负数或者 "
173+ "``\"\" ``,则只会添加换行符。``None``(默认值)选择最紧凑的表达。使用一个正整数会让每一层缩进同样数量的空格。如果 *indent* "
174+ "是一个字符串(比如 ``\"\\ t\" ``),那个字符串会被用于缩进每一层。"
165175
166176#: ../../library/json.rst:165 ../../library/json.rst:442
167177msgid "Allow strings for *indent* in addition to integers."
168- msgstr ""
178+ msgstr "允许使用字符串作为 *indent* 而不再仅仅是整数。 "
169179
170180#: ../../library/json.rst:168 ../../library/json.rst:445
171181msgid ""
@@ -174,10 +184,13 @@ msgid ""
174184"': ')`` otherwise. To get the most compact JSON representation, you should "
175185"specify ``(',', ':')`` to eliminate whitespace."
176186msgstr ""
187+ "当指定时,*separators* 应当是一个 ``(item_separator, key_separator)`` 元组。当 *indent* 为 "
188+ "``None`` 时,默认值取 ``(', ', ': ')``,否则取 ``(',', ': ')``。为了得到最紧凑的 JSON "
189+ "表达式,你应该指定其为 ``(',', ':')`` 以消除空白字符。"
177190
178191#: ../../library/json.rst:173 ../../library/json.rst:450
179192msgid "Use ``(',', ': ')`` as default if *indent* is not ``None``."
180- msgstr ""
193+ msgstr "现当 *indent* 不是 ``None`` 时,采用 ``(',', ': ')`` 作为默认值。 "
181194
182195#: ../../library/json.rst:176 ../../library/json.rst:453
183196msgid ""
@@ -186,39 +199,47 @@ msgid ""
186199"version of the object or raise a :exc:`TypeError`. If not specified, "
187200":exc:`TypeError` is raised."
188201msgstr ""
202+ "当 *default* 被指定时,其应该是一个函数,每当某个对象无法被序列化时它会被调用。它应该返回该对象的一个可以被 JSON 编码的版本或者引发一个"
203+ " :exc:`TypeError`。如果没有被指定,则会直接引发 :exc:`TypeError`。"
189204
190205#: ../../library/json.rst:181
191206msgid ""
192207"If *sort_keys* is true (default: ``False``), then the output of dictionaries"
193208" will be sorted by key."
194- msgstr ""
209+ msgstr "如果 *sort_keys* 是 true(默认为 ``False``),那么字典的输出会以键的顺序排序。 "
195210
196211#: ../../library/json.rst:184
197212msgid ""
198213"To use a custom :class:`JSONEncoder` subclass (e.g. one that overrides the "
199214":meth:`default` method to serialize additional types), specify it with the "
200215"*cls* kwarg; otherwise :class:`JSONEncoder` is used."
201216msgstr ""
217+ "为了使用一个自定义的 :class:`JSONEncoder` 子类(比如:覆盖了 :meth:`default` 方法来序列化额外的类型), 通过 "
218+ "*cls* 关键字参数来指定;否则将使用 :class:`JSONEncoder`。"
202219
203220#: ../../library/json.rst:188 ../../library/json.rst:261
204221msgid ""
205222"All optional parameters are now :ref:`keyword-only <keyword-"
206223"only_parameter>`."
207- msgstr ""
224+ msgstr "所有的可选参数现在是 :ref:`keyword-only <keyword-only_parameter>` 的了。 "
208225
209226#: ../../library/json.rst:193
210227msgid ""
211228"Unlike :mod:`pickle` and :mod:`marshal`, JSON is not a framed protocol, so "
212229"trying to serialize multiple objects with repeated calls to :func:`dump` "
213230"using the same *fp* will result in an invalid JSON file."
214231msgstr ""
232+ "与 :mod:`pickle` 和 :mod:`marshal` 不同,JSON 不是一个具有框架的协议,所以尝试多次使用同一个 *fp* 调用 "
233+ ":func:`dump` 来序列化多个对象会产生一个不合规的 JSON 文件。"
215234
216235#: ../../library/json.rst:202
217236msgid ""
218237"Serialize *obj* to a JSON formatted :class:`str` using this :ref:`conversion"
219238" table <py-to-json-table>`. The arguments have the same meaning as in "
220239":func:`dump`."
221240msgstr ""
241+ "使用这个:ref:`转换表 <py-to-json-table>`序列化 *obj* 为一个 JSON 格式的 :class:`str`。参数和 "
242+ ":func:`dump` 中的具有相同的含义。"
222243
223244#: ../../library/json.rst:208
224245msgid ""
@@ -228,13 +249,18 @@ msgid ""
228249"JSON and then back into a dictionary, the dictionary may not equal the "
229250"original one. That is, ``loads(dumps(x)) != x`` if x has non-string keys."
230251msgstr ""
252+ "JSON 中的键-值对中的键永远是 :class:`str` 类型的。当一个对象被转化为 JSON "
253+ "时,字典中所有的键都会被强制转换为字符串。这所造成的结果是字典被转换为 JSON 然后转换回字典时可能和原来的不相等。换句话说,如果 x "
254+ "具有非字符串的键,则有 ``loads(dumps(x)) != x``。"
231255
232256#: ../../library/json.rst:217
233257msgid ""
234258"Deserialize *fp* (a ``.read()``-supporting :term:`text file` or "
235259":term:`binary file` containing a JSON document) to a Python object using "
236260"this :ref:`conversion table <json-to-py-table>`."
237261msgstr ""
262+ "使用这个:ref:`转换表<json-to-py-table>`来反序列化 *fp* (一个支持 ``.read()`` 并包含一个 JSON 文档的 "
263+ ":term:`text file` 或者 :term:`binary file`)为一个 Python 对象。"
238264
239265#: ../../library/json.rst:221
240266msgid ""
@@ -244,6 +270,9 @@ msgid ""
244270"be used to implement custom decoders (e.g. `JSON-RPC "
245271"<http://www.jsonrpc.org>`_ class hinting)."
246272msgstr ""
273+ "*object_hook* 是一个可选的函数,它会被调用于每一个解码出的对象字面量(即一个 :class:`dict`)。*object_hook* "
274+ "的返回值会取代原本的 :class:`dict`。这一特性能够被用于实现自定义解码器(如 `JSON-RPC "
275+ "<http://www.jsonrpc.org>`_ 的类型提示)。"
247276
248277#: ../../library/json.rst:227
249278msgid ""
0 commit comments