@@ -104,7 +104,7 @@ msgstr ""
104
104
"JSON 語法是 `YAML <https://yaml.org/>`_ 1.2 語法的一種子集合。所以如果使用預"
105
105
"設的設定的話(準確來說,使用預設的 *separators* 分隔符設定的話),這個模組的"
106
106
"輸出也符合 YAML 1.0 和 1.1 的子集合規範。因此你也可以利用這個模組來當作 YAML "
107
- "的串聯化工具 (serializer)。"
107
+ "的串列化工具 (serializer)。"
108
108
109
109
#: ../../library/json.rst:130
110
110
msgid ""
@@ -124,7 +124,7 @@ msgid ""
124
124
"supporting :term:`file-like object`) using this :ref:`conversion table <py-"
125
125
"to-json-table>`."
126
126
msgstr ""
127
- "參考這個\\ :ref:`轉換表 <py-to-json-table>`\\ 將 *obj* 串聯化為符合 JSON 格式"
127
+ "參考這個\\ :ref:`轉換表 <py-to-json-table>`\\ 將 *obj* 串列化為符合 JSON 格式"
128
128
"的字串流,並寫入到 *fp* (一個支援 ``.write()`` 方法的 :term:`file-like "
129
129
"object`)"
130
130
@@ -173,7 +173,7 @@ 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 規範"
176
+ "如果 *allow_nan* 為 false(預設值:``True``\\ ),則串列化超出嚴格 JSON 規範"
177
177
"之範圍的 :class:`float` 值 (``nan``, ``inf``, ``-inf``) 會引發 :exc:"
178
178
"`ValueError`。如果 *allow_nan* 為 true,則將使用它們的 JavaScript 等效項 "
179
179
"(``NaN``, ``Infinity``, ``-Infinity``)。"
@@ -219,7 +219,7 @@ 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* 應該是一個為無法串聯化的物件呼叫的函式 。它應該傳"
222
+ "如果有指定本參數,*default* 應該是一個為無法串列化的物件呼叫的函式 。它應該傳"
223
223
"回物件的 JSON 可編碼版本或引發 :exc:`TypeError`。如果未指定,則會引發 :exc:"
224
224
"`TypeError`。"
225
225
@@ -237,7 +237,7 @@ msgid ""
237
237
"it with the *cls* kwarg; otherwise :class:`JSONEncoder` is used."
238
238
msgstr ""
239
239
"若要使用自訂 :class:`JSONEncoder` 子類別(例如覆寫 :meth:`~JSONEncoder."
240
- "default` 方法來串聯化其他型別的子類別 ),請使用關鍵字參數 *cls* 指定它;否則"
240
+ "default` 方法來串列化其他型別的子類別 ),請使用關鍵字參數 *cls* 指定它;否則"
241
241
"使用 :class:`JSONEncoder`。"
242
242
243
243
#: ../../library/json.rst:198 ../../library/json.rst:277
@@ -253,7 +253,7 @@ msgid ""
253
253
"using the same *fp* will result in an invalid JSON file."
254
254
msgstr ""
255
255
"與 :mod:`pickle` 和 :mod:`marshal` 不同,JSON 沒有二進位分框的協定,因此嘗試"
256
- "重複呼叫 :func:`dump` 來串聯化多個物件到同一個 *fp* 裡將導致無效的 JSON 檔"
256
+ "重複呼叫 :func:`dump` 來串列化多個物件到同一個 *fp* 裡將導致無效的 JSON 檔"
257
257
"案。"
258
258
259
259
# SkyLull: 我想這裡的 "framed protocol" 指的是 https://peps.python.org/pep-3154/#framing
@@ -263,7 +263,7 @@ msgid ""
263
263
"table <py-to-json-table>`. The arguments have the same meaning as in :func:"
264
264
"`dump`."
265
265
msgstr ""
266
- "使用此\\ :ref:`轉換表 <json-to-py-table>`\\ 來將 *obj* 串聯化為 JSON 格式 :"
266
+ "使用此\\ :ref:`轉換表 <json-to-py-table>`\\ 來將 *obj* 串列化為 JSON 格式 :"
267
267
"class:`str`。這個參數的作用與 :func:`dump` 中的同名參數意義相同。"
268
268
269
269
#: ../../library/json.rst:218
@@ -287,7 +287,7 @@ msgid ""
287
287
msgstr ""
288
288
"使用此\\ :ref:`轉換表 <json-to-py-table>`\\ 來將 *fp*\\ (一個支援 ``."
289
289
"read()``、包含 JSON 文件的\\ :term:`文字檔案 <text file>`\\ 或\\ :term:`二進"
290
- "位檔案 <binary file>`\\ )去序列化為 Python 物件。"
290
+ "位檔案 <binary file>`\\ )去串列化為 Python 物件。"
291
291
292
292
#: ../../library/json.rst:231
293
293
msgid ""
@@ -383,7 +383,7 @@ msgid ""
383
383
"If the data being deserialized is not a valid JSON document, a :exc:"
384
384
"`JSONDecodeError` will be raised."
385
385
msgstr ""
386
- "如果被去序列化 (deserialized)的資料不符合 JSON 格式,將會引發 :exc:"
386
+ "如果被去串列化 (deserialized)的資料不符合 JSON 格式,將會引發 :exc:"
387
387
"`JSONDecodeError` 例外。"
388
388
389
389
#: ../../library/json.rst:280
@@ -402,7 +402,7 @@ msgid ""
402
402
msgstr ""
403
403
"使用\\ :ref:`轉換表 <json-to-py-table>`\\ 將 *s* (一個含有 JSON 文件的 :"
404
404
"class:`str`\\ 、\\ :class:`bytes` 或 :class:`bytearray` 的實例(instance))"
405
- "去序列化 (deserialize)為一個 Python 物件"
405
+ "去串列化 (deserialize)為一個 Python 物件"
406
406
407
407
#: ../../library/json.rst:290
408
408
msgid "The other arguments have the same meaning as in :func:`load`."
@@ -683,6 +683,12 @@ msgid ""
683
683
"example::"
684
684
msgstr "回傳一個 Python 資料結構物件 *o* 的 JSON 的字串表示。例如::"
685
685
686
+ # 執行下列程式後能證明他的回傳物件是generator
687
+ # >>> import json
688
+ # >>> bigobject = list(range(100000))
689
+ # >>> x = json.JSONEncoder().iterencode(bigobject)
690
+ # >>> print(x)
691
+ # <generator object _make_iterencode.<locals>._iterencode at 0x7293c4b48bc0>
686
692
#: ../../library/json.rst:510
687
693
msgid ""
688
694
"Encode the given object, *o*, and yield each string representation as "
@@ -691,12 +697,6 @@ msgstr ""
691
697
"將物件 *o* 編碼,並將結果統整為一個能依序產生(yield)各結果字串的生成器物件"
692
698
"(generator)。如下例::"
693
699
694
- # 執行下列程式後能證明他的回傳物件是generator
695
- # >>> import json
696
- # >>> bigobject = list(range(100000))
697
- # >>> x = json.JSONEncoder().iterencode(bigobject)
698
- # >>> print(x)
699
- # <generator object _make_iterencode.<locals>._iterencode at 0x7293c4b48bc0>
700
700
#: ../../library/json.rst:518
701
701
msgid "Exceptions"
702
702
msgstr "例外"
@@ -707,7 +707,7 @@ msgstr ":exc:`ValueError` 的子類別具有下列額外屬性:"
707
707
708
708
#: ../../library/json.rst:526
709
709
msgid "The unformatted error message."
710
- msgstr "未格式化的錯誤訊息 。"
710
+ msgstr "未受格式化的錯誤訊息 。"
711
711
712
712
#: ../../library/json.rst:530
713
713
msgid "The JSON document being parsed."
@@ -727,7 +727,7 @@ msgstr "*pos* 所在的列(column)數。"
727
727
728
728
#: ../../library/json.rst:548
729
729
msgid "Standard Compliance and Interoperability"
730
- msgstr "標準守則與互通性 "
730
+ msgstr "合規性與互通性 "
731
731
732
732
#: ../../library/json.rst:550
733
733
msgid ""
@@ -737,47 +737,59 @@ msgid ""
737
737
"simplicity, :class:`JSONEncoder` and :class:`JSONDecoder` subclasses, and "
738
738
"parameters other than those explicitly mentioned, are not considered."
739
739
msgstr ""
740
+ "JSON 格式是由 :rfc:`7159` 和 `ECMA-404 <https://www.ecma-international.org/"
741
+ "publications-and-standards/standards/ecma-404/>` 規範的。本節詳細說明了本模組"
742
+ "對 RFC 的遵循程度。簡單起見,:class:`JSONEncoder` 和 :class:`JSONDecoder` 子"
743
+ "類別以及未明確提及的參數將不予考慮。"
740
744
741
745
#: ../../library/json.rst:556
742
746
msgid ""
743
747
"This module does not comply with the RFC in a strict fashion, implementing "
744
748
"some extensions that are valid JavaScript but not valid JSON. In particular:"
745
749
msgstr ""
750
+ "這個模組的部份實作並未非常嚴格地遵循 RFC 規範。準確來說,下列實際實作符合 "
751
+ "JavaScript 語法格式,但並不符合 JSON 格式:"
746
752
747
753
#: ../../library/json.rst:559
748
754
msgid "Infinite and NaN number values are accepted and output;"
749
- msgstr ""
755
+ msgstr "無限(Infinite)和非數字(NaN)值會被接受。 "
750
756
751
757
#: ../../library/json.rst:560
752
758
msgid ""
753
759
"Repeated names within an object are accepted, and only the value of the last "
754
760
"name-value pair is used."
755
- msgstr ""
761
+ msgstr "同一個物件內可以有重複的名稱,但只有最後一個同名物件是有效的。 "
756
762
757
763
#: ../../library/json.rst:563
758
764
msgid ""
759
765
"Since the RFC permits RFC-compliant parsers to accept input texts that are "
760
766
"not RFC-compliant, this module's deserializer is technically RFC-compliant "
761
767
"under default settings."
762
768
msgstr ""
769
+ "不過 RFC 准許遵循 RFC 的剖析器接受不合規的文字輸入,所以技術上來說若以預設設"
770
+ "定運作,本模組的去串列化器是符合 RFC 規範的。"
763
771
764
772
#: ../../library/json.rst:568
765
773
msgid "Character Encodings"
766
- msgstr ""
774
+ msgstr "字元編碼格式 "
767
775
768
776
#: ../../library/json.rst:570
769
777
msgid ""
770
778
"The RFC requires that JSON be represented using either UTF-8, UTF-16, or "
771
779
"UTF-32, with UTF-8 being the recommended default for maximum "
772
780
"interoperability."
773
781
msgstr ""
782
+ "RFC 規定要求 JSON 必須以 UTF-8、UTF-16 或 UTF-32 格式編碼。並推薦以 UTF-8 編"
783
+ "碼以達成最良好的互通性。"
774
784
775
785
#: ../../library/json.rst:573
776
786
msgid ""
777
787
"As permitted, though not required, by the RFC, this module's serializer sets "
778
788
"*ensure_ascii=True* by default, thus escaping the output so that the "
779
789
"resulting strings only contain ASCII characters."
780
790
msgstr ""
791
+ "RFC 准許但並不要求編碼器的 *ensure_ascii=True* 是預設值,但本模組依然實作了此"
792
+ "一選項作為預設,因此本模組會轉義所有非 ASCII 字元。"
781
793
782
794
#: ../../library/json.rst:577
783
795
msgid ""
@@ -786,6 +798,8 @@ msgid ""
786
798
"<str>`, and thus does not otherwise directly address the issue of character "
787
799
"encodings."
788
800
msgstr ""
801
+ "除了 *ensure_ascii* 選項之外,本模組嚴格遵循 Python 物件與 :class:`Unicode "
802
+ "strings <str>` 之間的轉換規範,因此並不另外處理字元編碼的問題。"
789
803
790
804
#: ../../library/json.rst:582
791
805
msgid ""
@@ -795,6 +809,10 @@ msgid ""
795
809
"in their input. This module's deserializer raises a :exc:`ValueError` when "
796
810
"an initial BOM is present."
797
811
msgstr ""
812
+ "RFC 禁止在文件的開頭加上端序記號(BOM),因此本模組的串列化器(serializer)也"
813
+ "不會在輸出中加入端序記號。RFC 允許但不強制 JSON 去串列化器(deserializer)忽"
814
+ "略文件初始的端序記號,因此本模組的去串列化器將在遭遇端序記號時引發 :exc:"
815
+ "`ValueError` 例外。"
798
816
799
817
#: ../../library/json.rst:588
800
818
msgid ""
0 commit comments