@@ -84,11 +84,11 @@ msgstr "自訂特殊的 JSON 解碼方式: ::"
84
84
85
85
#: ../../library/json.rst:90
86
86
msgid "Extending :class:`JSONEncoder`::"
87
- msgstr "在 :class:`JSONEncoder` 裡自行擴充額外的編碼方法 : ::"
87
+ msgstr "繼承 :class:`JSONEncoder` 類別並自行擴充額外的編碼方法 : ::"
88
88
89
89
#: ../../library/json.rst:108
90
90
msgid "Using :mod:`json.tool` from the shell to validate and pretty-print:"
91
- msgstr "在命令列介面裡使用 :mod:`json.tool` 來驗證 JSON 語法和美化 "
91
+ msgstr "在命令列介面裡使用 :mod:`json.tool` 來驗證 JSON 語法和美化呈現方式: "
92
92
93
93
#: ../../library/json.rst:119
94
94
msgid "See :ref:`json-commandline` for detailed documentation."
@@ -112,7 +112,7 @@ msgid ""
112
112
"default. Order is only lost if the underlying containers are unordered."
113
113
msgstr ""
114
114
"這個模組的編、解碼器預設會保存輸入與輸出資料的順序關係,除非一開始的輸入本身"
115
- "就是無序的。(例如集合 :class:`set` )"
115
+ "就是無序的。(例如集合)"
116
116
117
117
#: ../../library/json.rst:135
118
118
msgid "Basic Usage"
@@ -136,15 +136,15 @@ msgid ""
136
136
msgstr ""
137
137
"如果 *skipkeys* 被設為 true(預設值:``False``),那麼非基本型別(:class:"
138
138
"`str`,:class:`int`,:class:`float`,:class:`bool`,``None``)的 dictionary"
139
- "(字典)鍵值將被略過,而不會引發 :exc:`TypeError`。"
139
+ "(字典)鍵值將被略過而不會引發 :exc:`TypeError`。"
140
140
141
141
#: ../../library/json.rst:150
142
142
msgid ""
143
143
"The :mod:`json` module always produces :class:`str` objects, not :class:"
144
144
"`bytes` objects. Therefore, ``fp.write()`` must support :class:`str` input."
145
145
msgstr ""
146
146
":mod:`json` 模組總是產生 :class:`str` 物件,而非 :class:`bytes` 物件。因此,"
147
- "``fp.write()`` 必須支援 :class:`str` 的輸入 。"
147
+ "``fp.write()`` 必須支援 :class:`str` 輸入 。"
148
148
149
149
#: ../../library/json.rst:154 ../../library/json.rst:433
150
150
msgid ""
@@ -162,7 +162,7 @@ msgid ""
162
162
"will result in a :exc:`RecursionError` (or worse)."
163
163
msgstr ""
164
164
"如果 *check_circular* 設為 false(預設是 ``True``),則針對不同容器型別的循環"
165
- "參照 (circular reference) 的檢查將會被跳過 ,若有循環參照則最後將引發 :exc:"
165
+ "參照 (circular reference) 檢查將會被跳過 ,若有循環參照則最後將引發 :exc:"
166
166
"`RecursionError` (或其他更糟的錯誤)。"
167
167
168
168
#: ../../library/json.rst:162
@@ -173,9 +173,9 @@ msgid ""
173
173
"*allow_nan* is true, their JavaScript equivalents (``NaN``, ``Infinity``, ``-"
174
174
"Infinity``) will be used."
175
175
msgstr ""
176
- "如果 *allow_nan* 為 false(預設值:``True``\\ ),則串列化超出嚴格 JSON 規範 "
177
- "之範圍的 :class:`float` 值 (``nan``, ``inf``, ``-inf``) 會引發 :exc:"
178
- "`ValueError`。如果 *allow_nan* 為 true,則將使用它們的 JavaScript 等效項 "
176
+ "如果 *allow_nan* 為 false(預設值:``True``\\ ),則串列化不符合嚴格 JSON 規 "
177
+ "範的 :class:`float` 值 (``nan``, ``inf``, ``-inf``) 會引發 :exc:"
178
+ "`ValueError`。如果 *allow_nan* 為 true,則將使用它們的 JavaScript 等效表示 "
179
179
"(``NaN``, ``Infinity``, ``-Infinity``)。"
180
180
181
181
#: ../../library/json.rst:168 ../../library/json.rst:452
@@ -188,9 +188,9 @@ msgid ""
188
188
"``\"\\ t\" ``), that string is used to indent each level."
189
189
msgstr ""
190
190
"如果 *indent* 是非負整數或字串,則 JSON 陣列元素和物件成員將使用該縮排等級進"
191
- "行漂亮列印 。縮排等級 0、負數或 ``\"\" `` 只會插入換行符號。``None``\\ (預設"
192
- "值)選擇最緊湊的表示法 。使用正整數縮排可以在每層縮排數量相同的空格。如果 "
193
- "*indent* 是一個字串(例如 ``\"\\ t\" ``\\ ),則該字串用於縮排每個層級。"
191
+ "行格式美化 。縮排等級 0、負數或 ``\"\" `` 只會插入換行符號。``None``\\ (預設"
192
+ "值)等於是選擇最緊湊的表示法 。使用正整數縮排可以在每層縮排數量相同的空格。如 "
193
+ "果 *indent* 是一個字串(例如 ``\"\\ t\" ``\\ ),則該字串用於縮排每個層級。"
194
194
195
195
#: ../../library/json.rst:175 ../../library/json.rst:459
196
196
msgid "Allow strings for *indent* in addition to integers."
@@ -204,13 +204,13 @@ msgid ""
204
204
"specify ``(',', ':')`` to eliminate whitespace."
205
205
msgstr ""
206
206
"如果有指定本參數,*separators* 應該是一個 ``(item_separator, "
207
- "key_separator)`` 元組 。如果 *indent* 為 ``None`` 則預設為 ``(', ', ': ')``, "
208
- "否則預設為 ``(',', ': ')``。想要獲得最緊湊的 JSON 表示形式,你應該指定 "
209
- "``(',', ':')`` 來消除空格 。"
207
+ "key_separator)`` 二元組 。如果 *indent* 為 ``None`` 則預設為 ``(', ', ': "
208
+ "')``, 否則預設為 ``(',', ': ')``。想要獲得最緊湊的 JSON 表示形式,你可以改成 "
209
+ "指定 ``(',', ':')`` 來消除尾隨的空格 。"
210
210
211
211
#: ../../library/json.rst:183 ../../library/json.rst:467
212
212
msgid "Use ``(',', ': ')`` as default if *indent* is not ``None``."
213
- msgstr "如果 *indent* 不是 ``None``,則使用 ``(',', ': ')`` 當預設值 "
213
+ msgstr "如果 *indent* 不是 ``None``,則使用 ``(',', ': ')`` 作為預設值 "
214
214
215
215
#: ../../library/json.rst:186 ../../library/json.rst:470
216
216
msgid ""
@@ -219,45 +219,45 @@ msgid ""
219
219
"version of the object or raise a :exc:`TypeError`. If not specified, :exc:"
220
220
"`TypeError` is raised."
221
221
msgstr ""
222
- "如果有指定本參數,*default* 應該是一個為無法串列化的物件呼叫的函式。它應該傳 "
223
- "回物件的 JSON 可編碼版本或引發 :exc:`TypeError`。如果未指定,則會引發 :exc: "
224
- "`TypeError`。"
222
+ "如果有指定本參數,*default* 會是一個遭遇無法串列化的物件時會被呼叫的函式。它 "
223
+ "應該傳回該物件的 JSON 可編碼版本或引發 :exc:`TypeError`。如果未指定,則會直接 "
224
+ "引發 :exc: `TypeError`。"
225
225
226
226
#: ../../library/json.rst:191
227
227
msgid ""
228
228
"If *sort_keys* is true (default: ``False``), then the output of dictionaries "
229
229
"will be sorted by key."
230
230
msgstr ""
231
- "如果 *sort_keys* 為 true(預設值:``False``),則字典的輸出將按鍵排序 。"
231
+ "如果 *sort_keys* 為 true(預設值:``False``),則字典的輸出將按鍵值排序 。"
232
232
233
233
#: ../../library/json.rst:194
234
234
msgid ""
235
235
"To use a custom :class:`JSONEncoder` subclass (e.g. one that overrides the :"
236
236
"meth:`~JSONEncoder.default` method to serialize additional types), specify "
237
237
"it with the *cls* kwarg; otherwise :class:`JSONEncoder` is used."
238
238
msgstr ""
239
- "若要使用自訂 :class:`JSONEncoder` 子類別 (例如覆寫 :meth:`~JSONEncoder. "
240
- "default` 方法來串列化其他型別的子類別),請使用關鍵字參數 *cls* 指定它;否則 "
241
- "使用 :class:`JSONEncoder`。"
239
+ "若要使用繼承自 :class:`JSONEncoder` 的自訂子類別 (例如覆寫 :meth:"
240
+ "`~JSONEncoder. default` 方法來串列化其他型別的一個子類別物件),請使用關鍵字參 "
241
+ "數 *cls* 指定該類別物件;否則預設使用 :class:`JSONEncoder`。"
242
242
243
243
#: ../../library/json.rst:198 ../../library/json.rst:277
244
244
msgid ""
245
245
"All optional parameters are now :ref:`keyword-only <keyword-only_parameter>`."
246
246
msgstr ""
247
247
"所有可選參數現在都是\\ :ref:`僅限關鍵字 <keyword-only_parameter>`\\ 參數了。"
248
248
249
+ # SkyLull: 我想這裡的 "framed protocol" 指的是
250
+ # https://peps.python.org/pep-3154/#framing
249
251
#: ../../library/json.rst:203
250
252
msgid ""
251
253
"Unlike :mod:`pickle` and :mod:`marshal`, JSON is not a framed protocol, so "
252
254
"trying to serialize multiple objects with repeated calls to :func:`dump` "
253
255
"using the same *fp* will result in an invalid JSON file."
254
256
msgstr ""
255
- "與 :mod:`pickle` 和 :mod:`marshal` 不同,JSON 沒有二進位分框的協定,因此嘗試 "
256
- "重複呼叫 :func:`dump` 來串列化多個物件到同一個 *fp* 裡將導致無效的 JSON 檔 "
257
- "案 。"
257
+ "與 :mod:`pickle` 和 :mod:`marshal` 不同,JSON 不具有二進位分框(binary "
258
+ "framed)的協定,因此嘗試重複呼叫 :func:`dump` 來串列化多個物件到同一個 *fp* "
259
+ "裡將導致無效的 JSON 檔案 。"
258
260
259
- # SkyLull: 我想這裡的 "framed protocol" 指的是
260
- # https://peps.python.org/pep-3154/#framing
261
261
#: ../../library/json.rst:212
262
262
msgid ""
263
263
"Serialize *obj* to a JSON formatted :class:`str` using this :ref:`conversion "
@@ -349,24 +349,25 @@ msgid ""
349
349
"integer string via the interpreter's :ref:`integer string conversion length "
350
350
"limitation <int_max_str_digits>` to help avoid denial of service attacks."
351
351
msgstr ""
352
- ":func:`int` 預設的 *parse_int* 現在有限制整數字串的長度上限了,限制由直譯器的 "
353
- "\\ :ref:`整數字串轉換長度限制 <int_max_str_digits>`\\ 機制來達成,這能防止阻 "
354
- "斷服務攻擊 (denial of service attacks)。"
352
+ "預設 *parse_int* 使用的 :func:`int` 函數現在有限制整數字串的長度上限了,限制 "
353
+ "由直譯器的 \\ :ref:`整數字串轉換長度限制 <int_max_str_digits>`\\ 機制來達成,"
354
+ "這能防止阻斷服務攻擊 (Denial of Service attacks)。"
355
355
356
356
#: ../../library/json.rst:262 ../../library/json.rst:361
357
357
msgid ""
358
358
"*parse_constant*, if specified, will be called with one of the following "
359
359
"strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``. This can be used to "
360
360
"raise an exception if invalid JSON numbers are encountered."
361
361
msgstr ""
362
- "如有給定 *parse_constant* 的話,在解碼時若遭遇以下字串 ``'-Infinity'``、"
362
+ "如有給定 *parse_constant* 的話,在解碼時若遭遇字串 ``'-Infinity'``、"
363
363
"``'Infinity'`` 或 ``'NaN'`` 其中之一則會改用這個參數給定的函數來進行解碼。這"
364
364
"也可用於使解碼過程中遇到無效的 JSON 數字時引發一個例外。"
365
365
366
366
#: ../../library/json.rst:267
367
367
msgid "*parse_constant* doesn't get called on 'null', 'true', 'false' anymore."
368
368
msgstr ""
369
- "遭遇 'null'、 'true'、 'false' 時不再以 *parse_constant* 給定的函數來處理了。"
369
+ "遭遇 'null'、 'true' 或 'false' 時不再以 *parse_constant* 給定的函數來處理"
370
+ "了。"
370
371
371
372
#: ../../library/json.rst:270
372
373
msgid ""
@@ -376,7 +377,7 @@ msgid ""
376
377
msgstr ""
377
378
"若想要使用自定義的 :class:`JSONDecoder` 子類別物件,請以 ``cls`` 關鍵字參數指"
378
379
"定之,否則將使用預設的 :class:`JSONDecoder`。其他未使用到的關鍵字參數將繼續傳"
379
- "入給 :class:` JSONDecoder` 的建構函數使用。"
380
+ "入給 JSONDecoder 的建構函數使用。"
380
381
381
382
#: ../../library/json.rst:274 ../../library/json.rst:292
382
383
#: ../../library/json.rst:371
@@ -414,8 +415,8 @@ msgid ""
414
415
"*s* can now be of type :class:`bytes` or :class:`bytearray`. The input "
415
416
"encoding should be UTF-8, UTF-16 or UTF-32."
416
417
msgstr ""
417
- "現在,*s* 可以是一個 \\ :term:`二進位檔案 <binary file>` \\ ,前提是其編碼格式 "
418
- "為 UTF-8、UTF-16 或 UTF-32。"
418
+ "現在,*s* 可以是一個二進位檔案如 :class:`bytes` 或 :class:`bytearray`,前提是 "
419
+ "其編碼格式為 UTF-8、UTF-16 或 UTF-32。"
419
420
420
421
#: ../../library/json.rst:299
421
422
msgid "The keyword argument *encoding* has been removed."
@@ -467,7 +468,7 @@ msgstr "str"
467
468
468
469
#: ../../library/json.rst:323
469
470
msgid "number (int)"
470
- msgstr "number (int )"
471
+ msgstr "number (整數 )"
471
472
472
473
#: ../../library/json.rst:323
473
474
msgid "int"
@@ -510,8 +511,8 @@ msgid ""
510
511
"It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their "
511
512
"corresponding ``float`` values, which is outside the JSON spec."
512
513
msgstr ""
513
- "雖然 ``NaN``、``Infinity`` 和 ``-Infinity`` 並不符合 JSON 規範,解碼器依然能 "
514
- "正確的將其對應到相應的 Python ``float`` 值。"
514
+ "雖然 ``NaN``、``Infinity`` 和 ``-Infinity`` 並不符合 JSON 規範,但解碼器依然 "
515
+ "能正確地將其轉換到相應的 Python ``float`` 值。"
515
516
516
517
#: ../../library/json.rst:337
517
518
msgid ""
@@ -522,8 +523,8 @@ msgid ""
522
523
msgstr ""
523
524
"*object_hook* 是一個可選參數,其接受一個函數作為輸入。原始的字串解碼結果(一"
524
525
"個 :class:`dict`\\ )將被傳入這個函數、並使用 *object_hook* 的回傳值來取代原"
525
- "先的 :class:` dict` 輸出。此功能可用於實作自訂義解碼器(例如 `JSON-RPC "
526
- "<https://www. jsonrpc.org>`_ 類別提示)。"
526
+ "先的 dict 輸出。此功能可用於實作自訂義解碼器(例如 `JSON-RPC <https://www. "
527
+ "jsonrpc.org>`_ 類別提示)。"
527
528
528
529
#: ../../library/json.rst:342
529
530
msgid ""
@@ -559,8 +560,7 @@ msgid ""
559
560
"Return the Python representation of *s* (a :class:`str` instance containing "
560
561
"a JSON document)."
561
562
msgstr ""
562
- "返回用 Python 方式表達的 *s*(一個含有 JSON 文件的 :class:`str` 實例"
563
- "(instance))"
563
+ "返回用 Python 型式表達的 *s* (一個含有 JSON 文件的 :class:`str` 實例)。"
564
564
565
565
#: ../../library/json.rst:382
566
566
msgid ""
@@ -615,8 +615,8 @@ msgid ""
615
615
"superclass implementation (to raise :exc:`TypeError`)."
616
616
msgstr ""
617
617
"若要擴充此功能來識別其他物件,請繼承並實作一個 :meth:`~JSONEncoder.default` "
618
- "方法。此方法應回傳一個可序列化的 ``o`` 物件,否則此方法應呼叫父類別的 :meth: "
619
- "`~ JSONEncoder.default` 方法(以拋出 :exc:`TypeError` 例外)。"
618
+ "方法。此方法應回傳一個可序列化的 ``o`` 物件,否則此方法應呼叫父類別的 "
619
+ "JSONEncoder.default 方法(以拋出 :exc:`TypeError` 例外)。"
620
620
621
621
#: ../../library/json.rst:429
622
622
msgid ""
@@ -739,9 +739,9 @@ msgid ""
739
739
"parameters other than those explicitly mentioned, are not considered."
740
740
msgstr ""
741
741
"JSON 格式是由 :rfc:`7159` 和 `ECMA-404 <https://www.ecma-international.org/"
742
- "publications-and-standards/standards/ecma-404/>` 規範的。本節詳細說明了本模組 "
743
- "對 RFC 的遵循程度。簡單起見,:class:`JSONEncoder` 和 :class:`JSONDecoder` 子 "
744
- "類別以及未明確提及的參數將不予考慮 。"
742
+ "publications-and-standards/standards/ecma-404/>`_ 規範的。本節詳細說明了本模 "
743
+ "組對 RFC 的遵循程度。簡單起見,:class:`JSONEncoder` 和 :class:`JSONDecoder` "
744
+ "子類別以及未明確提及的參數將不予討論 。"
745
745
746
746
#: ../../library/json.rst:556
747
747
msgid ""
@@ -862,8 +862,8 @@ msgid ""
862
862
"but the last name-value pair for a given name::"
863
863
msgstr ""
864
864
"RFC 規範僅表明 JSON 物件中的名字應該是唯一的,但沒有強制要求如何處理重複的名"
865
- "字。預設情況下,這個模組不會引發例外 ;相反的,它會忽略該名字的所有重複鍵值"
866
- "對,只保留最後一個 : ::"
865
+ "字。預設情況下,本模組不會因此引發例外 ;相反的,它會忽略該名字的所有重複鍵值"
866
+ "對,並只保留最後一個 : ::"
867
867
868
868
#: ../../library/json.rst:630
869
869
msgid "The *object_pairs_hook* parameter can be used to alter this behavior."
@@ -882,10 +882,10 @@ msgid ""
882
882
"this module does not and has never implemented that restriction in either "
883
883
"its serializer or its deserializer."
884
884
msgstr ""
885
- "由已廢棄的 :rfc:`4627` 規範的舊版 JSON 要求 JSON 文字的頂層值必須是 JSON 物件 "
886
- "或陣列 (Python :class:`dict` 或 :class:`list`),而且不能是 JSON 的 null、"
887
- "boolean、數字或字串值。 :rfc:`7159` 移除了這個限制,而此模組在其串列化器或去 "
888
- "串列化器中也未曾實施過該限制 。"
885
+ "由已廢棄的 :rfc:`4627` 所規範的舊版 JSON 要求 JSON 文字的頂層值必須是 JSON 物 "
886
+ "件或陣列 (Python :class:`dict` 或 :class:`list`),而且不能是 JSON 的 null、"
887
+ "boolean、數字或字串值。 :rfc:`7159` 移除了這個限制,而本模組的串列化器或去串 "
888
+ "列化器中未曾實施過該限制 。"
889
889
890
890
#: ../../library/json.rst:643
891
891
msgid ""
@@ -922,8 +922,8 @@ msgid ""
922
922
"This module does not impose any such limits beyond those of the relevant "
923
923
"Python datatypes themselves or the Python interpreter itself."
924
924
msgstr ""
925
- "這個模組本身不會設定任何此類限制,除了 Python 資料型態本身或 Python 直譯器本 "
926
- "身的限制 。"
925
+ "本模組除了 Python 資料型態本身或 Python 直譯器本身的限制以外,不會設定任何此 "
926
+ "類限制 。"
927
927
928
928
#: ../../library/json.rst:660
929
929
msgid ""
@@ -935,10 +935,10 @@ msgid ""
935
935
"magnitude, or when serializing instances of \" exotic\" numerical types such "
936
936
"as :class:`decimal.Decimal`."
937
937
msgstr ""
938
- "串列化為 JSON 時,要注意可能會使用該 JSON 的應用程式中的相關限制。特別要注意 "
939
- "的是 ,JSON 數字常會被去串列化為 IEEE 754 雙精度浮點數(double),並因而受到其 "
940
- "表示範圍和精度限制的影響 。這在序列化極大的 Python :class:`int` 數值、或是序列 "
941
- "化特殊數字型別 (例如 :class:`decimal.Decimal`)實例時尤其重要 。"
938
+ "將資料串列化為 JSON 時,要注意可能會使用該 JSON 輸出的應用程式中的相關限制。 "
939
+ "特別要注意的是 ,JSON 數字常會被去串列化為 IEEE 754 雙精度浮點數(double),並 "
940
+ "因而受到其表示範圍和精度限制的影響 。這在序列化極大的 Python :class:`int` 數 "
941
+ "值、或是序列化特殊數字型別的實例時 (例如 :class:`decimal.Decimal`)尤其重要 。"
942
942
943
943
#: ../../library/json.rst:673
944
944
msgid "Command Line Interface"
@@ -961,7 +961,7 @@ msgid ""
961
961
"data:`sys.stdin` and :data:`sys.stdout` will be used respectively:"
962
962
msgstr ""
963
963
"如果沒有指定可選參數 ``infile`` 和 ``outfile`` ,則 :data:`sys.stdin` 和 :"
964
- "data:`sys.stdout` 各自為預設值 。"
964
+ "data:`sys.stdout` 將各自做為輸入和輸出的預設值 。"
965
965
966
966
#: ../../library/json.rst:697
967
967
msgid ""
@@ -977,7 +977,7 @@ msgstr "命令列選項"
977
977
978
978
#: ../../library/json.rst:708
979
979
msgid "The JSON file to be validated or pretty-printed:"
980
- msgstr "被用於校驗或美化呈現的 JSON 文件:"
980
+ msgstr "將被用於校驗或美化呈現的 JSON 文件:"
981
981
982
982
#: ../../library/json.rst:724
983
983
msgid "If *infile* is not specified, read from :data:`sys.stdin`."
@@ -988,8 +988,8 @@ msgid ""
988
988
"Write the output of the *infile* to the given *outfile*. Otherwise, write it "
989
989
"to :data:`sys.stdout`."
990
990
msgstr ""
991
- "將 *infile* 的結果寫入到給定的 *outfile*。若未提供則寫入到:data:`sys."
992
- "stdout`。"
991
+ "將 *infile* 的結果寫入到給定的 *outfile*。若未提供則寫入到 :data:`sys."
992
+ "stdout`\\ 。"
993
993
994
994
#: ../../library/json.rst:733
995
995
msgid "Sort the output of dictionaries alphabetically by key."
@@ -1026,5 +1026,4 @@ msgid ""
1026
1026
msgstr ""
1027
1027
"如 `RFC 7159 更正 <https://www.rfc-editor.org/errata_search.php?rfc=7159>`_ "
1028
1028
"所述,JSON 允許字串中出現 U+2028(行分隔符)和 U+2029(段落分隔符)字元,而 "
1029
- "JavaScript(截至 ECMAScript 5.1 版)則不允許。\n"
1030
- "`"
1029
+ "JavaScript(截至 ECMAScript 5.1 版)則不允許。"
0 commit comments