Skip to content

Commit ad790eb

Browse files
committed
feat: translate part of library/json.po
1 parent 2f6d0eb commit ad790eb

File tree

1 file changed

+55
-4
lines changed

1 file changed

+55
-4
lines changed

library/json.po

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ msgid ""
150150
"reference check for container types will be skipped and a circular reference "
151151
"will result in a :exc:`RecursionError` (or worse)."
152152
msgstr ""
153-
"如果 *chech_circular* 設為 false(預設是 ``True``),則針對不同容器型別的循環"
153+
"如果 *check_circular* 設為 false(預設是 ``True``),則針對不同容器型別的循環"
154154
"參照 (circular reference) 的檢查將會被跳過,若有循環參照則最後將引發 :exc:"
155155
"`RecursionError` (或者更糟的錯誤)。"
156156

@@ -162,6 +162,11 @@ msgid ""
162162
"*allow_nan* is true, their JavaScript equivalents (``NaN``, ``Infinity``, ``-"
163163
"Infinity``) will be used."
164164
msgstr ""
165+
"如果 *allow_nan* 設為 False(預設值為 ``True``),那麼序列化 (serialize):"
166+
"class:`float` 的特殊值 (``nan``, ``inf``, ``-inf``) 會觸發 :exc:"
167+
"`ValueError`,這麼設定是為了遵守較嚴格的 JSON 規範。如果設為 True,則序列化這"
168+
"些極值不會出錯,而是會被自動代換成 JavaScript 上等價的值 (``NaN``, "
169+
"``Infinity``, ``-Infinity``)"
165170

166171
#: ../../library/json.rst:168 ../../library/json.rst:452
167172
msgid ""
@@ -172,10 +177,12 @@ msgid ""
172177
"indent indents that many spaces per level. If *indent* is a string (such as "
173178
"``\"\\t\"``), that string is used to indent each level."
174179
msgstr ""
180+
"如果 *indent* 是一個非負整數或字串,那麼 JSON 序列及其所含元素,會以pretty-"
181+
"print 的方式顯示,並會有幾個。"
175182

176183
#: ../../library/json.rst:175 ../../library/json.rst:459
177184
msgid "Allow strings for *indent* in addition to integers."
178-
msgstr ""
185+
msgstr "允許字串作為 *indent* 的值,而不只是允許整數。"
179186

180187
#: ../../library/json.rst:178 ../../library/json.rst:462
181188
msgid ""
@@ -184,10 +191,14 @@ msgid ""
184191
"': ')`` otherwise. To get the most compact JSON representation, you should "
185192
"specify ``(',', ':')`` to eliminate whitespace."
186193
msgstr ""
194+
"*separator* 是分隔符號,``( 項跟項 (item) 之間的分隔符號, 鍵值 (key) 之間的分"
195+
"隔符號)`` 的 tuple。 如果 *indent* 是 ``None``,則預設值為 ``(', ', ': ')``,"
196+
"否則預設值為 ``(',', ': ')``。如果希望 JSON 更省空間,建議指定為 ``(',', "
197+
"':')``,這樣可以消除空白。"
187198

188199
#: ../../library/json.rst:183 ../../library/json.rst:467
189200
msgid "Use ``(',', ': ')`` as default if *indent* is not ``None``."
190-
msgstr ""
201+
msgstr "如果 *indent* 不是 ``None``,則用 ``(',', ': ')`` 當預設值"
191202

192203
#: ../../library/json.rst:186 ../../library/json.rst:470
193204
msgid ""
@@ -196,38 +207,53 @@ msgid ""
196207
"version of the object or raise a :exc:`TypeError`. If not specified, :exc:"
197208
"`TypeError` is raised."
198209
msgstr ""
210+
"*default* 必須一個函式,如果你有設定它的話,遇到無法 JSON 序列化的物件時會呼"
211+
"叫你 *default* 設定的函式。該函式只能有兩種狀況:要不就回傳一個可以被 JSON 序"
212+
"列化的物件,要不就拋出 :exc:`TypeError`。如果 *default* 沒有指定值,則只要遇"
213+
"到無法 JSON 序列化的物件就會丟出 :exc:`TypeError`。"
199214

200215
#: ../../library/json.rst:191
201216
msgid ""
202217
"If *sort_keys* is true (default: ``False``), then the output of dictionaries "
203218
"will be sorted by key."
204219
msgstr ""
220+
"如果 *sort_keys* 設為 True(預設值為 False),那麼字典的輸出會按照 "
221+
"*sort_keys* 排序。"
205222

206223
#: ../../library/json.rst:194
207224
msgid ""
208225
"To use a custom :class:`JSONEncoder` subclass (e.g. one that overrides the :"
209226
"meth:`~JSONEncoder.default` method to serialize additional types), specify "
210227
"it with the *cls* kwarg; otherwise :class:`JSONEncoder` is used."
211228
msgstr ""
229+
"如果要使用自訂的 :class:`JSONEncoder` 子類別去改寫 (overrides)原來預設的 "
230+
"meth:`~JSONEncoder.default`,請標明 *cls* 以序列化更多不同的型別。如果沒有標"
231+
"的話,就會使用 :class:`JSONEncoder` 來序列化。"
212232

213233
#: ../../library/json.rst:198 ../../library/json.rst:277
214234
msgid ""
215235
"All optional parameters are now :ref:`keyword-only <keyword-only_parameter>`."
216236
msgstr ""
237+
"所有非必要參數現在都是 :ref:`keyword-only <keyword-only_parameter>` 了。"
217238

218239
#: ../../library/json.rst:203
219240
msgid ""
220241
"Unlike :mod:`pickle` and :mod:`marshal`, JSON is not a framed protocol, so "
221242
"trying to serialize multiple objects with repeated calls to :func:`dump` "
222243
"using the same *fp* will result in an invalid JSON file."
223244
msgstr ""
245+
"JSON 和 :mod:`pickle` 跟 :mod:`marshal` 不同,JSON不是一個框架協定,所以如果"
246+
"你試著用同一個 *fp* 來重複呼叫 :func:`dump` 來序列化多個物件,會導致無效的"
247+
"JSON檔案。"
224248

225249
#: ../../library/json.rst:212
226250
msgid ""
227251
"Serialize *obj* to a JSON formatted :class:`str` using this :ref:`conversion "
228252
"table <py-to-json-table>`. The arguments have the same meaning as in :func:"
229253
"`dump`."
230254
msgstr ""
255+
"用這個 :ref:`conversion table <py-to-json-table>` 來把 *obj* 序列化成JSON 格"
256+
"式的 :class:`str`。 裡面所有引數和 :func: `dump` 裡的意義相同。"
231257

232258
#: ../../library/json.rst:218
233259
msgid ""
@@ -237,13 +263,20 @@ msgid ""
237263
"JSON and then back into a dictionary, the dictionary may not equal the "
238264
"original one. That is, ``loads(dumps(x)) != x`` if x has non-string keys."
239265
msgstr ""
266+
"在 JSON 的 鍵值/值對 (key/value pairs) 中,鍵值一定是 :class:`str`。當一個字"
267+
"典物件 (dictionary) 被轉換成 JSON 時,字典的所有鍵都會被強制轉換成字串。因"
268+
"此,如果一個字典被轉換成 JSON 然後再轉回字典,該字典可能不等於原來的字典。也"
269+
"就是說,如果字典 x 有些鍵值不是字串,那麼 ``loads(dumps(x)) != x``。"
240270

241271
#: ../../library/json.rst:227
242272
msgid ""
243273
"Deserialize *fp* (a ``.read()``-supporting :term:`text file` or :term:"
244274
"`binary file` containing a JSON document) to a Python object using this :ref:"
245275
"`conversion table <json-to-py-table>`."
246276
msgstr ""
277+
"將 fp(一個支持.read() 的 :term:`text file` 或包含 JSON 的:term:`binary "
278+
"file` 反序列化 (deserialize) 為 Python 物件,轉換規則使用`conversion table "
279+
"<json-to-py-table>`。"
247280

248281
#: ../../library/json.rst:231
249282
msgid ""
@@ -253,6 +286,10 @@ msgid ""
253286
"be used to implement custom decoders (e.g. `JSON-RPC <https://www.jsonrpc."
254287
"org>`_ class hinting)."
255288
msgstr ""
289+
"*object_hook* 是一個非必要性的函式,用來解碼物件 object_literal。如果沒有值"
290+
"時,物件會被解碼成 :class:`dict`。如果有值,會 *object_hook* 的回傳值會被用來"
291+
"取代原來的 :class:`dict`。因此,改寫 *object_hook* 就能自訂的解碼器(例如"
292+
"`JSON-RPC <https://www.jsonrpc.org>`_ 類別提示)。"
256293

257294
#: ../../library/json.rst:237
258295
msgid ""
@@ -262,6 +299,10 @@ msgid ""
262299
"`dict`. This feature can be used to implement custom decoders. If "
263300
"*object_hook* is also defined, the *object_pairs_hook* takes priority."
264301
msgstr ""
302+
"*object_pairs_hook* 是一個非必要函式,會在解碼物件成有序值對陣列(暫譯,"
303+
"ordered list of pairs),如果有值,JSON 會使用 *object_pairs_hook* 的回傳值而"
304+
"非原本的 :class:`dict`。此功能可以用來自訂解碼器。如果 *object_hook*也有值,"
305+
"*object_pairs_hook* 的值會優先採用。"
265306

266307
#: ../../library/json.rst:243 ../../library/json.rst:348
267308
msgid "Added support for *object_pairs_hook*."
@@ -274,6 +315,9 @@ msgid ""
274315
"This can be used to use another datatype or parser for JSON floats (e.g. :"
275316
"class:`decimal.Decimal`)."
276317
msgstr ""
318+
"如果 *parse_float* 有值,含浮點數的 JSON 文字會被解析。預設是"
319+
"``float(num_str)``,但可以設成別的資料型別或 JSON 浮點數文字解析器,例如:"
320+
"class:`decimal.Decimal`。"
277321

278322
#: ../../library/json.rst:251 ../../library/json.rst:356
279323
msgid ""
@@ -282,24 +326,31 @@ msgid ""
282326
"can be used to use another datatype or parser for JSON integers (e.g. :class:"
283327
"`float`)."
284328
msgstr ""
329+
"如果 *parse_int* 有值,含整數的 JSON 文字會被解析。預設是``int(num_str)``,但"
330+
"可以設成別的資料型別或 JSON 整數文字解析器,例如:class:`float`。"
285331

286332
#: ../../library/json.rst:256
287333
msgid ""
288334
"The default *parse_int* of :func:`int` now limits the maximum length of the "
289335
"integer string via the interpreter's :ref:`integer string conversion length "
290336
"limitation <int_max_str_digits>` to help avoid denial of service attacks."
291337
msgstr ""
338+
":func:`int` 預設的 *parse_int* 現在有字數上限了,上限是直譯器的:ref:`integer "
339+
"string conversion length limitation <int_max_str_digits>`"
292340

293341
#: ../../library/json.rst:262 ../../library/json.rst:361
294342
msgid ""
295343
"*parse_constant*, if specified, will be called with one of the following "
296344
"strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``. This can be used to "
297345
"raise an exception if invalid JSON numbers are encountered."
298346
msgstr ""
347+
"如果 *parse_constant* 有值,那麼遇到 ``'-Infinity'``、``'Infinity'``或"
348+
"``'NaN'``等字串時,會被呼叫用以解析它們。 *parse_constant* 也可是設定成在遇在"
349+
"遇無效的 JSON 數字時出錯。"
299350

300351
#: ../../library/json.rst:267
301352
msgid "*parse_constant* doesn't get called on 'null', 'true', 'false' anymore."
302-
msgstr ""
353+
msgstr "*parse_constant* 不再在遇到 'null'、 'true'、 'false' 呼叫了。"
303354

304355
#: ../../library/json.rst:270
305356
msgid ""

0 commit comments

Comments
 (0)