From c32ec08136a5344049114f14f2ba780117767b17 Mon Sep 17 00:00:00 2001 From: "Raynor@Gull" Date: Mon, 5 Aug 2024 23:38:55 +0800 Subject: [PATCH 01/18] editing json.po, up to line 125. --- library/json.po | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/library/json.po b/library/json.po index b9d14ec55d..27b4134ad7 100644 --- a/library/json.po +++ b/library/json.po @@ -67,7 +67,7 @@ msgstr "對基本 Python 物件階層進行編碼: ::" #: ../../library/json.rst:48 msgid "Compact encoding::" -msgstr "" +msgstr "改用密集型編碼方式::" #: ../../library/json.rst:54 msgid "Pretty printing::" @@ -79,15 +79,15 @@ msgstr "JSON 解碼: ::" #: ../../library/json.rst:75 msgid "Specializing JSON object decoding::" -msgstr "" +msgstr "自訂特殊的 JSON 解碼方式::" #: ../../library/json.rst:90 msgid "Extending :class:`JSONEncoder`::" -msgstr "" +msgstr "在 :class:`JSONEncoder` 裡自行擴充額外的編碼方法::" #: ../../library/json.rst:108 msgid "Using :mod:`json.tool` from the shell to validate and pretty-print:" -msgstr "" +msgstr "在命令列介面裡使用 :mod:`json.tool` 來驗證 JSON 語法和美化" #: ../../library/json.rst:119 msgid "See :ref:`json-commandline` for detailed documentation." @@ -100,12 +100,16 @@ msgid "" "value) is also a subset of YAML 1.0 and 1.1. This module can thus also be " "used as a YAML serializer." msgstr "" +"JSON 語法是 `YAML `_ 1.2 語法的一種子集合。" +"所以如果使用預設的設定的話(準確來說,使用預設的 *separators* 分隔符設定的話),這個模組的輸出也符合 YAML 1.0 和 1.1 的子集合規範。" +"因此你也可以利用這個模組來當作 YAML 的序列化工具(serializer)。" #: ../../library/json.rst:130 msgid "" "This module's encoders and decoders preserve input and output order by " "default. Order is only lost if the underlying containers are unordered." msgstr "" +"這個模組的編、解碼器預設會保存輸入與輸出資料的順序關係,除非一開始的輸入本身就是無序的。(例如集合)" #: ../../library/json.rst:135 msgid "Basic Usage" @@ -117,6 +121,8 @@ msgid "" "supporting :term:`file-like object`) using this :ref:`conversion table `." msgstr "" +"參考這個列表 :ref:`conversion table ` 將 *obj* 序列化為" +"符合 JSON 格式的字串流,並寫入到 *fp* (一個支援 ``.write()`` 方法的 :term:`file-like object`)" #: ../../library/json.rst:146 msgid "" From bd9b3cebb9175bc10017d2b4adbbfcbe5a10296d Mon Sep 17 00:00:00 2001 From: "Raynor@Gull" Date: Wed, 7 Aug 2024 00:11:08 +0800 Subject: [PATCH 02/18] editing json.po, up to line 348 --- library/json.po | 70 +++++++++++++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 29 deletions(-) diff --git a/library/json.po b/library/json.po index 27b4134ad7..b6c6b5ba4c 100644 --- a/library/json.po +++ b/library/json.po @@ -67,7 +67,7 @@ msgstr "對基本 Python 物件階層進行編碼: ::" #: ../../library/json.rst:48 msgid "Compact encoding::" -msgstr "改用密集型編碼方式::" +msgstr "改用緊湊型編碼方式::" #: ../../library/json.rst:54 msgid "Pretty printing::" @@ -130,12 +130,18 @@ msgid "" "basic type (:class:`str`, :class:`int`, :class:`float`, :class:`bool`, " "``None``) will be skipped instead of raising a :exc:`TypeError`." msgstr "" +"如果 *skipkeys* 被設為 true(預設值:``False``),那麼非基本型別" +"(:class:`str`,:class:`int`,:class:`float`,:class:`bool`,``None``)" +"的 dictionary(字典)鍵值將被略過,而不會引發 :exc:`TypeError`。" #: ../../library/json.rst:150 msgid "" "The :mod:`json` module always produces :class:`str` objects, not :class:" "`bytes` objects. Therefore, ``fp.write()`` must support :class:`str` input." msgstr "" +":mod:`json` 模組總是產生 :class:`str` 物件,而非 :class:`bytes` 物件。" +"因此,``fp.write()`` 必須支援 :class:`str` 的輸入。" + #: ../../library/json.rst:154 ../../library/json.rst:433 msgid "" @@ -143,6 +149,8 @@ msgid "" "all incoming non-ASCII characters escaped. If *ensure_ascii* is false, " "these characters will be output as-is." msgstr "" +"如果 *ensure_ascii* 被設為 true(預設值),則輸出時將確保所有輸入的非 ASCII 字元都會被轉義。若 *ensure_ascii* 為 false,則這些字元將照原樣輸出。" + #: ../../library/json.rst:158 msgid "" @@ -152,7 +160,7 @@ msgid "" msgstr "" "如果 *check_circular* 設為 false(預設是 ``True``),則針對不同容器型別的循環" "參照 (circular reference) 的檢查將會被跳過,若有循環參照則最後將引發 :exc:" -"`RecursionError` (或者更糟的錯誤)。" +"`RecursionError` (或其他更糟的錯誤)。" #: ../../library/json.rst:162 msgid "" @@ -183,7 +191,7 @@ msgstr "" #: ../../library/json.rst:175 ../../library/json.rst:459 msgid "Allow strings for *indent* in addition to integers." -msgstr "除了整數之外,還允許使用字串進行 *indent*。" +msgstr "除了整數之外,*indent* 還允許使用字串作為輸入。" #: ../../library/json.rst:178 ../../library/json.rst:462 msgid "" @@ -192,13 +200,13 @@ msgid "" "': ')`` otherwise. To get the most compact JSON representation, you should " "specify ``(',', ':')`` to eliminate whitespace." msgstr "" -"如果有指定,*separators* 應該是一個 ``(item_separator, key_separator)`` 元" +"如果有指定本參數,*separators* 應該是一個 ``(item_separator, key_separator)`` 元" "組。如果 *indent* 為 ``None`` 則預設為 ``(', ', ': ')``,否則預設為 ``(',', " -"': ')``。要獲得最緊湊的 JSON 表示形式,你應該指定 ``(',', ':')`` 來消除空格。" +"': ')``。想要獲得最緊湊的 JSON 表示形式,你應該指定 ``(',', ':')`` 來消除空格。" #: ../../library/json.rst:183 ../../library/json.rst:467 msgid "Use ``(',', ': ')`` as default if *indent* is not ``None``." -msgstr "如果 *indent* 不是 ``None``,則用 ``(',', ': ')`` 當預設值" +msgstr "如果 *indent* 不是 ``None``,則使用 ``(',', ': ')`` 當預設值" #: ../../library/json.rst:186 ../../library/json.rst:470 msgid "" @@ -207,7 +215,7 @@ msgid "" "version of the object or raise a :exc:`TypeError`. If not specified, :exc:" "`TypeError` is raised." msgstr "" -"如果有指定,*default* 應該是一個為無法序列化的物件呼叫的函式。它應該傳回物件" +"如果有指定本參數,*default* 應該是一個為無法序列化的物件呼叫的函式。它應該傳回物件" "的 JSON 可編碼版本或引發 :exc:`TypeError`。如果未指定,則會引發 :exc:" "`TypeError`。" @@ -225,14 +233,14 @@ msgid "" "it with the *cls* kwarg; otherwise :class:`JSONEncoder` is used." msgstr "" "若要使用自訂 :class:`JSONEncoder` 子類別(例如覆寫 :meth:`~JSONEncoder." -"default` 方法來序列化其他型別的子類別),請使用 *cls* kwarg 指定它;否則使" +"default` 方法來序列化其他型別的子類別),請使用關鍵字參數 *cls* 指定它;否則使" "用 :class:`JSONEncoder`。" #: ../../library/json.rst:198 ../../library/json.rst:277 msgid "" "All optional parameters are now :ref:`keyword-only `." msgstr "" -"所有可選參數現在都是\\ :ref:`僅限關鍵字 `\\ 了。" +"所有可選參數現在都是\\ :ref:`關鍵字參數 `\\ 了。" #: ../../library/json.rst:203 msgid "" @@ -240,8 +248,9 @@ msgid "" "trying to serialize multiple objects with repeated calls to :func:`dump` " "using the same *fp* will result in an invalid JSON file." msgstr "" -"與 :mod:`pickle` 和 :mod:`marshal` 不同,JSON 不是框架協定,因此嘗試使用相同" -"的 *fp* 重複呼叫 :func:`dump` 來序列化多個物件將導致無效的 JSON 檔案。" +"與 :mod:`pickle` 和 :mod:`marshal` 不同,JSON 沒有二進位分框的協定,因此嘗試重複呼叫 :func:`dump` " +"來序列化多個物件到同一個 *fp* 裡將導致無效的 JSON 檔案。" +# SkyLull: 我想這裡的 "framed protocol" 指的是 https://peps.python.org/pep-3154/#framing #: ../../library/json.rst:212 msgid "" @@ -249,8 +258,8 @@ msgid "" "table `. The arguments have the same meaning as in :func:" "`dump`." msgstr "" -"使用此\\ :ref:`轉換表 `\\ 來將 *obj* 序列化為 JSON 格式化 :" -"class:`str`。這些引數與 :func:`dump` 中的意義相同。" +"使用此\\ :ref:`轉換表 `\\ 來將 *obj* 序列化為 JSON 格式 :" +"class:`str`。這個參數的作用與 :func:`dump` 中的同名參數意義相同。" #: ../../library/json.rst:218 msgid "" @@ -260,9 +269,9 @@ msgid "" "JSON and then back into a dictionary, the dictionary may not equal the " "original one. That is, ``loads(dumps(x)) != x`` if x has non-string keys." msgstr "" -"JSON 鍵/值對中的鍵始終為 :class:`str` 型別。當字典轉換為 JSON 時,字典的所有" -"鍵都被強制轉換為字串。因此,如果將字典轉換為 JSON,然後再轉換回字典,則該字典" -"可能不等於原始字典。也就是說,如果 x 有非字串鍵,則 ``loads(dumps(x)) != " +"JSON 鍵/值對中的鍵始終為 :class:`str` 型別。當字典被轉換為 JSON 時,字典的所有" +"鍵值資料型別都會被強制轉換為字串。因此,如果將字典先轉換為 JSON 格式然後再轉換回字典,則該字典" +"可能不等於原始字典。也就是說,如果字典 x 含有非字串鍵值,則 ``loads(dumps(x)) != " "x``。" #: ../../library/json.rst:227 @@ -283,9 +292,9 @@ msgid "" "be used to implement custom decoders (e.g. `JSON-RPC `_ class hinting)." msgstr "" -"*object_hook* 是一個可選函式,將使用任何物件文本解碼的結果(一個 :class:" -"`dict`\\ )來呼叫它。將使用 *object_hook* 的回傳值而不是 :class:`dict`。此功" -"能可用於實作自訂解碼器(例如 `JSON-RPC `_ 類別提" +"*object_hook* 是一個可選參數,其接受一個函數作為輸入。原始的字串解碼結果(一個 :class:" +"`dict`\\ )將被傳入這個函數、並使用 *object_hook* 的回傳值來取代原先的 :class:`dict` 輸出。此功" +"能可用於實作自訂義解碼器(例如 `JSON-RPC `_ 類別提" "示)。" #: ../../library/json.rst:237 @@ -296,9 +305,9 @@ msgid "" "`dict`. This feature can be used to implement custom decoders. If " "*object_hook* is also defined, the *object_pairs_hook* takes priority." msgstr "" -"*object_pairs_hook* 是一個可選函式,將使用使用有序對列表解碼的任何物件文本的" -"結果來呼叫該函式。將使用 *object_pairs_hook* 的回傳值而不是 :class:`dict`。此" -"功能可用於實作自訂解碼器。如果也定義了 *object_hook*,則 *object_pairs_hook* " +"*object_pairs_hook* 是一個可選參數,其接受一個函數作為輸入。原始的有序對列表(ordered list of pairs)解碼" +"結果將被傳入這個函數、並使用 *object_pairs_hook* 的回傳值來取代原先的 :class:`dict` 輸出。此" +"功能可用於實作自訂義解碼器。如果也同時給定了 *object_hook*,則 *object_pairs_hook* " "優先。" #: ../../library/json.rst:243 ../../library/json.rst:348 @@ -312,9 +321,9 @@ msgid "" "This can be used to use another datatype or parser for JSON floats (e.g. :" "class:`decimal.Decimal`)." msgstr "" -"如有指定 *parse_float*,將使用要解碼的每個 JSON 浮點數字串進行呼叫。預設情況" -"下,這相當於 ``float(num_str)``。這可用於將另一種資料型別或剖析器用於 JSON 浮" -"點(例如 :class:`decimal.Decimal`\\ )。" +"如有給定 *parse_float* 的話,每個要被解碼的 JSON 浮點數字串都會改用這個參數給定的函數來進行解碼。預設情況" +"的浮點數剖析器等效於 ``float(num_str)``。這個參數可用於將 JSON 中的浮點數解碼或剖析為另一種資料型別" +"(例如 :class:`decimal.Decimal`\\ )。" #: ../../library/json.rst:251 ../../library/json.rst:356 msgid "" @@ -323,8 +332,8 @@ msgid "" "can be used to use another datatype or parser for JSON integers (e.g. :class:" "`float`)." msgstr "" -"如有指定 *parse_int*,將使用要解碼的每個 JSON 整數字串進行呼叫。預設情況下," -"這相當於 ``int(num_str)``。這可用於對 JSON 整數使用另一種資料型別或剖析器(例" +"如有給定 *parse_int* 的話,每個要被解碼的 JSON 整數字串都會改用這個參數給定的函數來進行解碼。預設情況" +"的整數剖析器等效於 ``int(num_str)``。這個參數可用於將 JSON 中的整數解碼或剖析為另一種資料型別(例" "如 :class:`float`\\ )。" #: ../../library/json.rst:256 @@ -333,8 +342,8 @@ msgid "" "integer string via the interpreter's :ref:`integer string conversion length " "limitation ` to help avoid denial of service attacks." msgstr "" -":func:`int` 預設的 *parse_int* 現在對於整數字串有長度上限,上限是直譯器的\\ :" -"ref:`整數字串轉換長度限制 `,這能防止阻斷服務攻擊 " +":func:`int` 預設的 *parse_int* 現在有限制整數字串的長度上限了,上限限制由直譯器的\\ :" +"ref:`整數字串轉換長度限制 `\\ 達成,這能防止阻斷服務攻擊 " "(denial of service attacks)。" #: ../../library/json.rst:262 ../../library/json.rst:361 @@ -498,6 +507,9 @@ msgid "" "can be used to implement custom decoders. If *object_hook* is also defined, " "the *object_pairs_hook* takes priority." msgstr "" +"若給定了 *object_pairs_hook*,則會在每次解碼 JSON 物件後,將結果作為一對有序列表傳入 *object_pairs_hook* 中。" +"*object_pairs_hook* 的回傳值將取代 :class:`dictionary`。這個功能可以用來實作自定義的解碼器。" +"如果還同時定義了 *object_hook*,則本 *object_pairs_hook* 具有優先權。" #: ../../library/json.rst:366 msgid "" From 8cb26960828537bd9ddd5773f0a53d3496a570ae Mon Sep 17 00:00:00 2001 From: "Raynor@Gull" Date: Wed, 7 Aug 2024 00:24:57 +0800 Subject: [PATCH 03/18] editing json.po, up to line 358 --- library/json.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/json.po b/library/json.po index b6c6b5ba4c..04ad805c68 100644 --- a/library/json.po +++ b/library/json.po @@ -352,8 +352,8 @@ msgid "" "strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``. This can be used to " "raise an exception if invalid JSON numbers are encountered." msgstr "" -"如果 *parse_constant* 有值,那麼以 ``'-Infinity'``、``'Infinity'`` 或 " -"``'NaN'`` 字串其中之一來呼叫。這也可用於在遇到無效的 JSON 數字時引發一個例" +"如有給定 *parse_constant* 的話,在解碼時若遭遇以下字串 ``'-Infinity'``、``'Infinity'`` 或 " +"``'NaN'`` 其中之一則會改用這個參數給定的函數來進行解碼。這也可用於使解碼過程中遇到無效的 JSON 數字時引發一個例" "外。" #: ../../library/json.rst:267 From 59aa815147908450d11d82f70d9b1708f135bb82 Mon Sep 17 00:00:00 2001 From: "Raynor@Gull" Date: Wed, 7 Aug 2024 01:16:41 +0800 Subject: [PATCH 04/18] editing json.po, up to line 540. --- library/json.po | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/library/json.po b/library/json.po index 04ad805c68..0f45b9aede 100644 --- a/library/json.po +++ b/library/json.po @@ -240,7 +240,7 @@ msgstr "" msgid "" "All optional parameters are now :ref:`keyword-only `." msgstr "" -"所有可選參數現在都是\\ :ref:`關鍵字參數 `\\ 了。" +"所有可選參數現在都是\\ :ref:`僅限關鍵字 `\\ 參數了。" #: ../../library/json.rst:203 msgid "" @@ -342,8 +342,8 @@ msgid "" "integer string via the interpreter's :ref:`integer string conversion length " "limitation ` to help avoid denial of service attacks." msgstr "" -":func:`int` 預設的 *parse_int* 現在有限制整數字串的長度上限了,上限限制由直譯器的\\ :" -"ref:`整數字串轉換長度限制 `\\ 達成,這能防止阻斷服務攻擊 " +":func:`int` 預設的 *parse_int* 現在有限制整數字串的長度上限了,限制由直譯器的\\ :" +"ref:`整數字串轉換長度限制 `\\ 機制來達成,這能防止阻斷服務攻擊 " "(denial of service attacks)。" #: ../../library/json.rst:262 ../../library/json.rst:361 @@ -358,7 +358,7 @@ msgstr "" #: ../../library/json.rst:267 msgid "*parse_constant* doesn't get called on 'null', 'true', 'false' anymore." -msgstr "*parse_constant* 不再以 'null'、 'true'、 'false' 呼叫了。" +msgstr "遭遇 'null'、 'true'、 'false' 時不再以 *parse_constant* 給定的函數來處理了。" #: ../../library/json.rst:270 msgid "" @@ -366,6 +366,8 @@ msgid "" "kwarg; otherwise :class:`JSONDecoder` is used. Additional keyword arguments " "will be passed to the constructor of the class." msgstr "" +"若想要使用自定義的 :class:`JSONDecoder` 子類別物件,請以 ``cls`` 關鍵字參數指定之,否則將使用預設的 :class:`JSONDecoder`。" +"其他未使用到的關鍵字參數將繼續傳入給 :class:`JSONDecoder` 的建構函數使用。" #: ../../library/json.rst:274 ../../library/json.rst:292 #: ../../library/json.rst:371 @@ -373,12 +375,14 @@ msgid "" "If the data being deserialized is not a valid JSON document, a :exc:" "`JSONDecodeError` will be raised." msgstr "" +"如果被反序列化(deserialized)的資料不符合 JSON 格式,將會觸發 :exc:`JSONDecodeError` 例外。" #: ../../library/json.rst:280 msgid "" "*fp* can now be a :term:`binary file`. The input encoding should be UTF-8, " "UTF-16 or UTF-32." msgstr "" +"現在,*fp* 可以是一個\\ :term:`二進位檔案 `\\ ,前提是其編碼格式為 UTF-8、UTF-16 或 UTF-32。" #: ../../library/json.rst:286 msgid "" @@ -386,32 +390,35 @@ msgid "" "instance containing a JSON document) to a Python object using this :ref:" "`conversion table `." msgstr "" +"使用\\ :ref:`轉換表 `\\ 將 *s* (一個含有 JSON 文件的 :class:`str`\\ 、\\ :class:`bytes` 或 :class:`bytearray` " +"的實例(instance))反序列化(deserialize)為一個 Python 物件" #: ../../library/json.rst:290 msgid "The other arguments have the same meaning as in :func:`load`." -msgstr "" +msgstr "其餘參數的使用方式與意義和 :func:`load` 的相同。" #: ../../library/json.rst:295 msgid "" "*s* can now be of type :class:`bytes` or :class:`bytearray`. The input " "encoding should be UTF-8, UTF-16 or UTF-32." msgstr "" +"現在,*s* 可以是一個\\ :term:`二進位檔案 `\\ ,前提是其編碼格式為 UTF-8、UTF-16 或 UTF-32。" #: ../../library/json.rst:299 msgid "The keyword argument *encoding* has been removed." -msgstr "關鍵字引數 *encoding* 已經被刪除。" +msgstr "刪除關鍵字參數 *encoding*。" #: ../../library/json.rst:304 msgid "Encoders and Decoders" -msgstr "" +msgstr "編碼器與解碼器" #: ../../library/json.rst:308 msgid "Simple JSON decoder." -msgstr "" +msgstr "簡易 JSON 解碼器" #: ../../library/json.rst:310 msgid "Performs the following translations in decoding by default:" -msgstr "" +msgstr "預設將執行下列資料型別轉換:" #: ../../library/json.rst:315 ../../library/json.rst:404 msgid "JSON" @@ -490,6 +497,7 @@ msgid "" "It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their " "corresponding ``float`` values, which is outside the JSON spec." msgstr "" +"雖然 ``NaN``、``Infinity`` 和 ``-Infinity`` 並不符合 JSON 規範,解碼器依然能正確的將其對應到相應的 Python ``float`` 值。" #: ../../library/json.rst:337 msgid "" @@ -498,6 +506,10 @@ msgid "" "class:`dict`. This can be used to provide custom deserializations (e.g. to " "support `JSON-RPC `_ class hinting)." msgstr "" +"*object_hook* 是一個可選參數,其接受一個函數作為輸入。原始的字串解碼結果(一個 :class:" +"`dict`\\ )將被傳入這個函數、並使用 *object_hook* 的回傳值來取代原先的 :class:`dict` 輸出。此功" +"能可用於實作自訂義解碼器(例如 `JSON-RPC `_ 類別提" +"示)。" #: ../../library/json.rst:342 msgid "" @@ -507,9 +519,11 @@ msgid "" "can be used to implement custom decoders. If *object_hook* is also defined, " "the *object_pairs_hook* takes priority." msgstr "" -"若給定了 *object_pairs_hook*,則會在每次解碼 JSON 物件後,將結果作為一對有序列表傳入 *object_pairs_hook* 中。" -"*object_pairs_hook* 的回傳值將取代 :class:`dictionary`。這個功能可以用來實作自定義的解碼器。" -"如果還同時定義了 *object_hook*,則本 *object_pairs_hook* 具有優先權。" +"*object_pairs_hook* 是一個可選參數,其接受一個函數作為輸入。原始的有序對列表(ordered list of pairs)解碼" +"結果將被傳入這個函數、並使用 *object_pairs_hook* 的回傳值來取代原先的 :class:`dict` 輸出。此" +"功能可用於實作自訂義解碼器。如果也同時給定了 *object_hook*,則 *object_pairs_hook* " +"優先。" + #: ../../library/json.rst:366 msgid "" @@ -518,10 +532,11 @@ msgid "" "with character codes in the 0--31 range, including ``'\\t'`` (tab), " "``'\\n'``, ``'\\r'`` and ``'\\0'``." msgstr "" +"如果 *strict* 被設為 false(預設值為 ``True``),那麼字串中將允許控制字元。此語境中的控制字元指的是 ASCII 字元編碼在 0~31 範圍內的字元,包括 ``'\\t'``(tab 鍵)、``'\\n'``、``'\\r'`` 和 ``'\\0'``。" #: ../../library/json.rst:374 ../../library/json.rst:475 msgid "All parameters are now :ref:`keyword-only `." -msgstr "" +msgstr "所有可選參數現在都是\\ :ref:`僅限關鍵字 `\\ 參數了。" #: ../../library/json.rst:379 msgid "" From a78ad38cffd24d8e1c0d60a9ab08c60b20801d35 Mon Sep 17 00:00:00 2001 From: "Raynor@Gull" Date: Wed, 7 Aug 2024 01:22:21 +0800 Subject: [PATCH 05/18] =?UTF-8?q?=E6=A0=B9=E6=93=9Adiscussion=20547?= =?UTF-8?q?=E4=B9=8B=E5=BB=BA=E8=AD=B0=E4=BF=AE=E6=94=B9=20serialize,=20de?= =?UTF-8?q?serialize=E7=9A=84=E8=AD=AF=E6=96=87=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/json.po | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/library/json.po b/library/json.po index 0f45b9aede..36c5de179d 100644 --- a/library/json.po +++ b/library/json.po @@ -4,6 +4,8 @@ # # Translators: # Asoul Yang , 2016 +# SkyLull , 2024 + msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" @@ -102,7 +104,7 @@ msgid "" msgstr "" "JSON 語法是 `YAML `_ 1.2 語法的一種子集合。" "所以如果使用預設的設定的話(準確來說,使用預設的 *separators* 分隔符設定的話),這個模組的輸出也符合 YAML 1.0 和 1.1 的子集合規範。" -"因此你也可以利用這個模組來當作 YAML 的序列化工具(serializer)。" +"因此你也可以利用這個模組來當作 YAML 的串聯化工具(serializer)。" #: ../../library/json.rst:130 msgid "" @@ -121,7 +123,7 @@ msgid "" "supporting :term:`file-like object`) using this :ref:`conversion table `." msgstr "" -"參考這個列表 :ref:`conversion table ` 將 *obj* 序列化為" +"參考這個列表 :ref:`conversion table ` 將 *obj* 串聯化為" "符合 JSON 格式的字串流,並寫入到 *fp* (一個支援 ``.write()`` 方法的 :term:`file-like object`)" #: ../../library/json.rst:146 @@ -170,7 +172,7 @@ msgid "" "*allow_nan* is true, their JavaScript equivalents (``NaN``, ``Infinity``, ``-" "Infinity``) will be used." msgstr "" -"如果 *allow_nan* 為 false(預設值:``True``\\ ),則序列化超出嚴格 JSON 規範" +"如果 *allow_nan* 為 false(預設值:``True``\\ ),則串聯化超出嚴格 JSON 規範" "之範圍的 :class:`float` 值 (``nan``, ``inf``, ``-inf``) 會引發 :exc:" "`ValueError`。如果 *allow_nan* 為 true,則將使用它們的 JavaScript 等效項 " "(``NaN``, ``Infinity``, ``-Infinity``)。" @@ -215,7 +217,7 @@ msgid "" "version of the object or raise a :exc:`TypeError`. If not specified, :exc:" "`TypeError` is raised." msgstr "" -"如果有指定本參數,*default* 應該是一個為無法序列化的物件呼叫的函式。它應該傳回物件" +"如果有指定本參數,*default* 應該是一個為無法串聯化的物件呼叫的函式。它應該傳回物件" "的 JSON 可編碼版本或引發 :exc:`TypeError`。如果未指定,則會引發 :exc:" "`TypeError`。" @@ -233,7 +235,7 @@ msgid "" "it with the *cls* kwarg; otherwise :class:`JSONEncoder` is used." msgstr "" "若要使用自訂 :class:`JSONEncoder` 子類別(例如覆寫 :meth:`~JSONEncoder." -"default` 方法來序列化其他型別的子類別),請使用關鍵字參數 *cls* 指定它;否則使" +"default` 方法來串聯化其他型別的子類別),請使用關鍵字參數 *cls* 指定它;否則使" "用 :class:`JSONEncoder`。" #: ../../library/json.rst:198 ../../library/json.rst:277 @@ -249,7 +251,7 @@ msgid "" "using the same *fp* will result in an invalid JSON file." msgstr "" "與 :mod:`pickle` 和 :mod:`marshal` 不同,JSON 沒有二進位分框的協定,因此嘗試重複呼叫 :func:`dump` " -"來序列化多個物件到同一個 *fp* 裡將導致無效的 JSON 檔案。" +"來串聯化多個物件到同一個 *fp* 裡將導致無效的 JSON 檔案。" # SkyLull: 我想這裡的 "framed protocol" 指的是 https://peps.python.org/pep-3154/#framing #: ../../library/json.rst:212 @@ -258,7 +260,7 @@ msgid "" "table `. The arguments have the same meaning as in :func:" "`dump`." msgstr "" -"使用此\\ :ref:`轉換表 `\\ 來將 *obj* 序列化為 JSON 格式 :" +"使用此\\ :ref:`轉換表 `\\ 來將 *obj* 串聯化為 JSON 格式 :" "class:`str`。這個參數的作用與 :func:`dump` 中的同名參數意義相同。" #: ../../library/json.rst:218 @@ -282,7 +284,7 @@ msgid "" msgstr "" "使用此\\ :ref:`轉換表 `\\ 來將 *fp*\\ (一個支援 ``." "read()``、包含 JSON 文件的\\ :term:`文字檔案 `\\ 或\\ :term:`二進" -"位檔案 `\\ )反序列化為 Python 物件。" +"位檔案 `\\ )去序列化為 Python 物件。" #: ../../library/json.rst:231 msgid "" @@ -375,7 +377,7 @@ msgid "" "If the data being deserialized is not a valid JSON document, a :exc:" "`JSONDecodeError` will be raised." msgstr "" -"如果被反序列化(deserialized)的資料不符合 JSON 格式,將會觸發 :exc:`JSONDecodeError` 例外。" +"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會觸發 :exc:`JSONDecodeError` 例外。" #: ../../library/json.rst:280 msgid "" @@ -391,7 +393,7 @@ msgid "" "`conversion table `." msgstr "" "使用\\ :ref:`轉換表 `\\ 將 *s* (一個含有 JSON 文件的 :class:`str`\\ 、\\ :class:`bytes` 或 :class:`bytearray` " -"的實例(instance))反序列化(deserialize)為一個 Python 物件" +"的實例(instance))去序列化(deserialize)為一個 Python 物件" #: ../../library/json.rst:290 msgid "The other arguments have the same meaning as in :func:`load`." From fa7d0e292b7effe15c8b9715b9182244a5718256 Mon Sep 17 00:00:00 2001 From: "Raynor@Gull" Date: Wed, 7 Aug 2024 01:43:52 +0800 Subject: [PATCH 06/18] editing json.po, up to line 594. --- library/json.po | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/library/json.po b/library/json.po index 36c5de179d..e925879275 100644 --- a/library/json.po +++ b/library/json.po @@ -60,7 +60,7 @@ msgid "" ":mod:`json` exposes an API familiar to users of the standard library :mod:" "`marshal` and :mod:`pickle` modules." msgstr "" -":mod:`json` 為標準函式庫 :mod:`marshal` 與 :mod:`pickle` 模組的使用者提供熟悉" +":mod:`json` 為習慣標準函式庫 :mod:`marshal` 與 :mod:`pickle` 模組的使用者提供熟悉" "的 API。" #: ../../library/json.rst:29 @@ -111,7 +111,7 @@ msgid "" "This module's encoders and decoders preserve input and output order by " "default. Order is only lost if the underlying containers are unordered." msgstr "" -"這個模組的編、解碼器預設會保存輸入與輸出資料的順序關係,除非一開始的輸入本身就是無序的。(例如集合)" +"這個模組的編、解碼器預設會保存輸入與輸出資料的順序關係,除非一開始的輸入本身就是無序的。(例如集合 :class:`set`)" #: ../../library/json.rst:135 msgid "Basic Usage" @@ -123,7 +123,7 @@ msgid "" "supporting :term:`file-like object`) using this :ref:`conversion table `." msgstr "" -"參考這個列表 :ref:`conversion table ` 將 *obj* 串聯化為" +"參考這個\\ :ref:`轉換表 `\\ 將 *obj* 串聯化為" "符合 JSON 格式的字串流,並寫入到 *fp* (一個支援 ``.write()`` 方法的 :term:`file-like object`)" #: ../../library/json.rst:146 @@ -377,7 +377,7 @@ msgid "" "If the data being deserialized is not a valid JSON document, a :exc:" "`JSONDecodeError` will be raised." msgstr "" -"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會觸發 :exc:`JSONDecodeError` 例外。" +"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引發 :exc:`JSONDecodeError` 例外。" #: ../../library/json.rst:280 msgid "" @@ -545,12 +545,13 @@ msgid "" "Return the Python representation of *s* (a :class:`str` instance containing " "a JSON document)." msgstr "" +"返回用 Python 方式表達的 *s*(一個含有 JSON 文件的 :class:`str` 實例(instance))" #: ../../library/json.rst:382 msgid "" ":exc:`JSONDecodeError` will be raised if the given JSON document is not " "valid." -msgstr "" +msgstr "若給定的輸入不符合 JSON 格式會引發 :exc:`JSONDecodeError` 例外。" #: ../../library/json.rst:387 msgid "" @@ -558,20 +559,22 @@ msgid "" "document) and return a 2-tuple of the Python representation and the index in " "*s* where the document ended." msgstr "" +"將 *s* (一個開頭部分含有合格 JSON 文件的 :class:`str`) 解碼,並將 JSON 文件結束點的索引值(index)和解碼結果合併為一個二元組(2-tuple)後回傳。" #: ../../library/json.rst:391 msgid "" "This can be used to decode a JSON document from a string that may have " "extraneous data at the end." msgstr "" +"這個方法可以用來解碼尾段可能帶有 JSON 以外資料的文字。" #: ../../library/json.rst:397 msgid "Extensible JSON encoder for Python data structures." -msgstr "" +msgstr "可擴充的 Python 資料結構 JSON 編碼器。" #: ../../library/json.rst:399 msgid "Supports the following objects and types by default:" -msgstr "" +msgstr "預設可支援下列物件及型別:" #: ../../library/json.rst:408 msgid "list, tuple" @@ -579,15 +582,15 @@ msgstr "list, tuple" #: ../../library/json.rst:412 msgid "int, float, int- & float-derived Enums" -msgstr "" +msgstr "int, float, int- & float-derived Enums" #: ../../library/json.rst:412 msgid "number" -msgstr "" +msgstr "number" #: ../../library/json.rst:421 msgid "Added support for int- and float-derived Enum classes." -msgstr "" +msgstr "Added support for int- and float-derived Enum classes." #: ../../library/json.rst:424 msgid "" From 4290af4057adadf255ada29c08707a9b1ea2f864 Mon Sep 17 00:00:00 2001 From: "Raynor@Gull" Date: Wed, 7 Aug 2024 20:28:57 +0800 Subject: [PATCH 07/18] editing json.po, up to line 604. --- library/json.po | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/library/json.po b/library/json.po index e925879275..493a6681db 100644 --- a/library/json.po +++ b/library/json.po @@ -582,7 +582,7 @@ msgstr "list, tuple" #: ../../library/json.rst:412 msgid "int, float, int- & float-derived Enums" -msgstr "int, float, int- & float-derived Enums" +msgstr "int, float, int 和 float 格式的 Enums" #: ../../library/json.rst:412 msgid "number" @@ -590,7 +590,7 @@ msgstr "number" #: ../../library/json.rst:421 msgid "Added support for int- and float-derived Enum classes." -msgstr "Added support for int- and float-derived Enum classes." +msgstr "增加整數(int)和浮點數(float)格式的列舉序數(Enums)的支援性。" #: ../../library/json.rst:424 msgid "" @@ -599,6 +599,8 @@ msgid "" "serializable object for ``o`` if possible, otherwise it should call the " "superclass implementation (to raise :exc:`TypeError`)." msgstr "" +"若要擴充此功能來識別其他物件,請繼承並實作一個 :meth:`~JSONEncoder.default` 方法。" +"此方法應回傳一個可序列化的 ``o`` 物件,否則此方法應呼叫父類別的 :meth:`~JSONEncoder.default` 方法(以拋出 :exc:`TypeError` 例外)。" #: ../../library/json.rst:429 msgid "" From 8e232f13b9a97f666bb2132f7cbb96b5a29f4df4 Mon Sep 17 00:00:00 2001 From: "Raynor@GullU" Date: Wed, 7 Aug 2024 23:27:58 +0800 Subject: [PATCH 08/18] cleaned po format --- library/json.po | 169 ++++++++++++++++++++++++++---------------------- 1 file changed, 92 insertions(+), 77 deletions(-) diff --git a/library/json.po b/library/json.po index 493a6681db..bebc540ece 100644 --- a/library/json.po +++ b/library/json.po @@ -5,7 +5,6 @@ # Translators: # Asoul Yang , 2016 # SkyLull , 2024 - msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" @@ -60,8 +59,8 @@ msgid "" ":mod:`json` exposes an API familiar to users of the standard library :mod:" "`marshal` and :mod:`pickle` modules." msgstr "" -":mod:`json` 為習慣標準函式庫 :mod:`marshal` 與 :mod:`pickle` 模組的使用者提供熟悉" -"的 API。" +":mod:`json` 為習慣標準函式庫 :mod:`marshal` 與 :mod:`pickle` 模組的使用者提供" +"熟悉的 API。" #: ../../library/json.rst:29 msgid "Encoding basic Python object hierarchies::" @@ -102,16 +101,18 @@ msgid "" "value) is also a subset of YAML 1.0 and 1.1. This module can thus also be " "used as a YAML serializer." msgstr "" -"JSON 語法是 `YAML `_ 1.2 語法的一種子集合。" -"所以如果使用預設的設定的話(準確來說,使用預設的 *separators* 分隔符設定的話),這個模組的輸出也符合 YAML 1.0 和 1.1 的子集合規範。" -"因此你也可以利用這個模組來當作 YAML 的串聯化工具(serializer)。" +"JSON 語法是 `YAML `_ 1.2 語法的一種子集合。所以如果使用預" +"設的設定的話(準確來說,使用預設的 *separators* 分隔符設定的話),這個模組的" +"輸出也符合 YAML 1.0 和 1.1 的子集合規範。因此你也可以利用這個模組來當作 YAML " +"的串聯化工具(serializer)。" #: ../../library/json.rst:130 msgid "" "This module's encoders and decoders preserve input and output order by " "default. Order is only lost if the underlying containers are unordered." msgstr "" -"這個模組的編、解碼器預設會保存輸入與輸出資料的順序關係,除非一開始的輸入本身就是無序的。(例如集合 :class:`set`)" +"這個模組的編、解碼器預設會保存輸入與輸出資料的順序關係,除非一開始的輸入本身" +"就是無序的。(例如集合 :class:`set`)" #: ../../library/json.rst:135 msgid "Basic Usage" @@ -123,8 +124,9 @@ msgid "" "supporting :term:`file-like object`) using this :ref:`conversion table `." msgstr "" -"參考這個\\ :ref:`轉換表 `\\ 將 *obj* 串聯化為" -"符合 JSON 格式的字串流,並寫入到 *fp* (一個支援 ``.write()`` 方法的 :term:`file-like object`)" +"參考這個\\ :ref:`轉換表 `\\ 將 *obj* 串聯化為符合 JSON 格式" +"的字串流,並寫入到 *fp* (一個支援 ``.write()`` 方法的 :term:`file-like " +"object`)" #: ../../library/json.rst:146 msgid "" @@ -132,18 +134,17 @@ msgid "" "basic type (:class:`str`, :class:`int`, :class:`float`, :class:`bool`, " "``None``) will be skipped instead of raising a :exc:`TypeError`." msgstr "" -"如果 *skipkeys* 被設為 true(預設值:``False``),那麼非基本型別" -"(:class:`str`,:class:`int`,:class:`float`,:class:`bool`,``None``)" -"的 dictionary(字典)鍵值將被略過,而不會引發 :exc:`TypeError`。" +"如果 *skipkeys* 被設為 true(預設值:``False``),那麼非基本型別(:class:" +"`str`,:class:`int`,:class:`float`,:class:`bool`,``None``)的 dictionary" +"(字典)鍵值將被略過,而不會引發 :exc:`TypeError`。" #: ../../library/json.rst:150 msgid "" "The :mod:`json` module always produces :class:`str` objects, not :class:" "`bytes` objects. Therefore, ``fp.write()`` must support :class:`str` input." msgstr "" -":mod:`json` 模組總是產生 :class:`str` 物件,而非 :class:`bytes` 物件。" -"因此,``fp.write()`` 必須支援 :class:`str` 的輸入。" - +":mod:`json` 模組總是產生 :class:`str` 物件,而非 :class:`bytes` 物件。因此," +"``fp.write()`` 必須支援 :class:`str` 的輸入。" #: ../../library/json.rst:154 ../../library/json.rst:433 msgid "" @@ -151,8 +152,8 @@ msgid "" "all incoming non-ASCII characters escaped. If *ensure_ascii* is false, " "these characters will be output as-is." msgstr "" -"如果 *ensure_ascii* 被設為 true(預設值),則輸出時將確保所有輸入的非 ASCII 字元都會被轉義。若 *ensure_ascii* 為 false,則這些字元將照原樣輸出。" - +"如果 *ensure_ascii* 被設為 true(預設值),則輸出時將確保所有輸入的非 ASCII " +"字元都會被轉義。若 *ensure_ascii* 為 false,則這些字元將照原樣輸出。" #: ../../library/json.rst:158 msgid "" @@ -202,9 +203,10 @@ msgid "" "': ')`` otherwise. To get the most compact JSON representation, you should " "specify ``(',', ':')`` to eliminate whitespace." msgstr "" -"如果有指定本參數,*separators* 應該是一個 ``(item_separator, key_separator)`` 元" -"組。如果 *indent* 為 ``None`` 則預設為 ``(', ', ': ')``,否則預設為 ``(',', " -"': ')``。想要獲得最緊湊的 JSON 表示形式,你應該指定 ``(',', ':')`` 來消除空格。" +"如果有指定本參數,*separators* 應該是一個 ``(item_separator, " +"key_separator)`` 元組。如果 *indent* 為 ``None`` 則預設為 ``(', ', ': ')``," +"否則預設為 ``(',', ': ')``。想要獲得最緊湊的 JSON 表示形式,你應該指定 " +"``(',', ':')`` 來消除空格。" #: ../../library/json.rst:183 ../../library/json.rst:467 msgid "Use ``(',', ': ')`` as default if *indent* is not ``None``." @@ -217,8 +219,8 @@ msgid "" "version of the object or raise a :exc:`TypeError`. If not specified, :exc:" "`TypeError` is raised." msgstr "" -"如果有指定本參數,*default* 應該是一個為無法串聯化的物件呼叫的函式。它應該傳回物件" -"的 JSON 可編碼版本或引發 :exc:`TypeError`。如果未指定,則會引發 :exc:" +"如果有指定本參數,*default* 應該是一個為無法串聯化的物件呼叫的函式。它應該傳" +"回物件的 JSON 可編碼版本或引發 :exc:`TypeError`。如果未指定,則會引發 :exc:" "`TypeError`。" #: ../../library/json.rst:191 @@ -235,8 +237,8 @@ msgid "" "it with the *cls* kwarg; otherwise :class:`JSONEncoder` is used." msgstr "" "若要使用自訂 :class:`JSONEncoder` 子類別(例如覆寫 :meth:`~JSONEncoder." -"default` 方法來串聯化其他型別的子類別),請使用關鍵字參數 *cls* 指定它;否則使" -"用 :class:`JSONEncoder`。" +"default` 方法來串聯化其他型別的子類別),請使用關鍵字參數 *cls* 指定它;否則" +"使用 :class:`JSONEncoder`。" #: ../../library/json.rst:198 ../../library/json.rst:277 msgid "" @@ -250,10 +252,11 @@ msgid "" "trying to serialize multiple objects with repeated calls to :func:`dump` " "using the same *fp* will result in an invalid JSON file." msgstr "" -"與 :mod:`pickle` 和 :mod:`marshal` 不同,JSON 沒有二進位分框的協定,因此嘗試重複呼叫 :func:`dump` " -"來串聯化多個物件到同一個 *fp* 裡將導致無效的 JSON 檔案。" -# SkyLull: 我想這裡的 "framed protocol" 指的是 https://peps.python.org/pep-3154/#framing +"與 :mod:`pickle` 和 :mod:`marshal` 不同,JSON 沒有二進位分框的協定,因此嘗試" +"重複呼叫 :func:`dump` 來串聯化多個物件到同一個 *fp* 裡將導致無效的 JSON 檔" +"案。" +# SkyLull: 我想這裡的 "framed protocol" 指的是 https://peps.python.org/pep-3154/#framing #: ../../library/json.rst:212 msgid "" "Serialize *obj* to a JSON formatted :class:`str` using this :ref:`conversion " @@ -271,10 +274,10 @@ msgid "" "JSON and then back into a dictionary, the dictionary may not equal the " "original one. That is, ``loads(dumps(x)) != x`` if x has non-string keys." msgstr "" -"JSON 鍵/值對中的鍵始終為 :class:`str` 型別。當字典被轉換為 JSON 時,字典的所有" -"鍵值資料型別都會被強制轉換為字串。因此,如果將字典先轉換為 JSON 格式然後再轉換回字典,則該字典" -"可能不等於原始字典。也就是說,如果字典 x 含有非字串鍵值,則 ``loads(dumps(x)) != " -"x``。" +"JSON 鍵/值對中的鍵始終為 :class:`str` 型別。當字典被轉換為 JSON 時,字典的所" +"有鍵值資料型別都會被強制轉換為字串。因此,如果將字典先轉換為 JSON 格式然後再" +"轉換回字典,則該字典可能不等於原始字典。也就是說,如果字典 x 含有非字串鍵值," +"則 ``loads(dumps(x)) != x``。" #: ../../library/json.rst:227 msgid "" @@ -294,10 +297,10 @@ msgid "" "be used to implement custom decoders (e.g. `JSON-RPC `_ class hinting)." msgstr "" -"*object_hook* 是一個可選參數,其接受一個函數作為輸入。原始的字串解碼結果(一個 :class:" -"`dict`\\ )將被傳入這個函數、並使用 *object_hook* 的回傳值來取代原先的 :class:`dict` 輸出。此功" -"能可用於實作自訂義解碼器(例如 `JSON-RPC `_ 類別提" -"示)。" +"*object_hook* 是一個可選參數,其接受一個函數作為輸入。原始的字串解碼結果(一" +"個 :class:`dict`\\ )將被傳入這個函數、並使用 *object_hook* 的回傳值來取代原" +"先的 :class:`dict` 輸出。此功能可用於實作自訂義解碼器(例如 `JSON-RPC " +"`_ 類別提示)。" #: ../../library/json.rst:237 msgid "" @@ -307,10 +310,10 @@ msgid "" "`dict`. This feature can be used to implement custom decoders. If " "*object_hook* is also defined, the *object_pairs_hook* takes priority." msgstr "" -"*object_pairs_hook* 是一個可選參數,其接受一個函數作為輸入。原始的有序對列表(ordered list of pairs)解碼" -"結果將被傳入這個函數、並使用 *object_pairs_hook* 的回傳值來取代原先的 :class:`dict` 輸出。此" -"功能可用於實作自訂義解碼器。如果也同時給定了 *object_hook*,則 *object_pairs_hook* " -"優先。" +"*object_pairs_hook* 是一個可選參數,其接受一個函數作為輸入。原始的有序對列表" +"(ordered list of pairs)解碼結果將被傳入這個函數、並使用 " +"*object_pairs_hook* 的回傳值來取代原先的 :class:`dict` 輸出。此功能可用於實作" +"自訂義解碼器。如果也同時給定了 *object_hook*,則 *object_pairs_hook* 優先。" #: ../../library/json.rst:243 ../../library/json.rst:348 msgid "Added support for *object_pairs_hook*." @@ -323,9 +326,10 @@ msgid "" "This can be used to use another datatype or parser for JSON floats (e.g. :" "class:`decimal.Decimal`)." msgstr "" -"如有給定 *parse_float* 的話,每個要被解碼的 JSON 浮點數字串都會改用這個參數給定的函數來進行解碼。預設情況" -"的浮點數剖析器等效於 ``float(num_str)``。這個參數可用於將 JSON 中的浮點數解碼或剖析為另一種資料型別" -"(例如 :class:`decimal.Decimal`\\ )。" +"如有給定 *parse_float* 的話,每個要被解碼的 JSON 浮點數字串都會改用這個參數給" +"定的函數來進行解碼。預設情況的浮點數剖析器等效於 ``float(num_str)``。這個參數" +"可用於將 JSON 中的浮點數解碼或剖析為另一種資料型別(例如 :class:`decimal." +"Decimal`\\ )。" #: ../../library/json.rst:251 ../../library/json.rst:356 msgid "" @@ -334,9 +338,9 @@ msgid "" "can be used to use another datatype or parser for JSON integers (e.g. :class:" "`float`)." msgstr "" -"如有給定 *parse_int* 的話,每個要被解碼的 JSON 整數字串都會改用這個參數給定的函數來進行解碼。預設情況" -"的整數剖析器等效於 ``int(num_str)``。這個參數可用於將 JSON 中的整數解碼或剖析為另一種資料型別(例" -"如 :class:`float`\\ )。" +"如有給定 *parse_int* 的話,每個要被解碼的 JSON 整數字串都會改用這個參數給定的" +"函數來進行解碼。預設情況的整數剖析器等效於 ``int(num_str)``。這個參數可用於" +"將 JSON 中的整數解碼或剖析為另一種資料型別(例如 :class:`float`\\ )。" #: ../../library/json.rst:256 msgid "" @@ -344,9 +348,9 @@ msgid "" "integer string via the interpreter's :ref:`integer string conversion length " "limitation ` to help avoid denial of service attacks." msgstr "" -":func:`int` 預設的 *parse_int* 現在有限制整數字串的長度上限了,限制由直譯器的\\ :" -"ref:`整數字串轉換長度限制 `\\ 機制來達成,這能防止阻斷服務攻擊 " -"(denial of service attacks)。" +":func:`int` 預設的 *parse_int* 現在有限制整數字串的長度上限了,限制由直譯器的" +"\\ :ref:`整數字串轉換長度限制 `\\ 機制來達成,這能防止阻" +"斷服務攻擊 (denial of service attacks)。" #: ../../library/json.rst:262 ../../library/json.rst:361 msgid "" @@ -354,13 +358,14 @@ msgid "" "strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``. This can be used to " "raise an exception if invalid JSON numbers are encountered." msgstr "" -"如有給定 *parse_constant* 的話,在解碼時若遭遇以下字串 ``'-Infinity'``、``'Infinity'`` 或 " -"``'NaN'`` 其中之一則會改用這個參數給定的函數來進行解碼。這也可用於使解碼過程中遇到無效的 JSON 數字時引發一個例" -"外。" +"如有給定 *parse_constant* 的話,在解碼時若遭遇以下字串 ``'-Infinity'``、" +"``'Infinity'`` 或 ``'NaN'`` 其中之一則會改用這個參數給定的函數來進行解碼。這" +"也可用於使解碼過程中遇到無效的 JSON 數字時引發一個例外。" #: ../../library/json.rst:267 msgid "*parse_constant* doesn't get called on 'null', 'true', 'false' anymore." -msgstr "遭遇 'null'、 'true'、 'false' 時不再以 *parse_constant* 給定的函數來處理了。" +msgstr "" +"遭遇 'null'、 'true'、 'false' 時不再以 *parse_constant* 給定的函數來處理了。" #: ../../library/json.rst:270 msgid "" @@ -368,8 +373,9 @@ msgid "" "kwarg; otherwise :class:`JSONDecoder` is used. Additional keyword arguments " "will be passed to the constructor of the class." msgstr "" -"若想要使用自定義的 :class:`JSONDecoder` 子類別物件,請以 ``cls`` 關鍵字參數指定之,否則將使用預設的 :class:`JSONDecoder`。" -"其他未使用到的關鍵字參數將繼續傳入給 :class:`JSONDecoder` 的建構函數使用。" +"若想要使用自定義的 :class:`JSONDecoder` 子類別物件,請以 ``cls`` 關鍵字參數指" +"定之,否則將使用預設的 :class:`JSONDecoder`。其他未使用到的關鍵字參數將繼續傳" +"入給 :class:`JSONDecoder` 的建構函數使用。" #: ../../library/json.rst:274 ../../library/json.rst:292 #: ../../library/json.rst:371 @@ -377,14 +383,16 @@ msgid "" "If the data being deserialized is not a valid JSON document, a :exc:" "`JSONDecodeError` will be raised." msgstr "" -"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引發 :exc:`JSONDecodeError` 例外。" +"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引發 :exc:" +"`JSONDecodeError` 例外。" #: ../../library/json.rst:280 msgid "" "*fp* can now be a :term:`binary file`. The input encoding should be UTF-8, " "UTF-16 or UTF-32." msgstr "" -"現在,*fp* 可以是一個\\ :term:`二進位檔案 `\\ ,前提是其編碼格式為 UTF-8、UTF-16 或 UTF-32。" +"現在,*fp* 可以是一個\\ :term:`二進位檔案 `\\ ,前提是其編碼格式" +"為 UTF-8、UTF-16 或 UTF-32。" #: ../../library/json.rst:286 msgid "" @@ -392,8 +400,9 @@ msgid "" "instance containing a JSON document) to a Python object using this :ref:" "`conversion table `." msgstr "" -"使用\\ :ref:`轉換表 `\\ 將 *s* (一個含有 JSON 文件的 :class:`str`\\ 、\\ :class:`bytes` 或 :class:`bytearray` " -"的實例(instance))去序列化(deserialize)為一個 Python 物件" +"使用\\ :ref:`轉換表 `\\ 將 *s* (一個含有 JSON 文件的 :" +"class:`str`\\ 、\\ :class:`bytes` 或 :class:`bytearray` 的實例(instance))" +"去序列化(deserialize)為一個 Python 物件" #: ../../library/json.rst:290 msgid "The other arguments have the same meaning as in :func:`load`." @@ -404,7 +413,8 @@ msgid "" "*s* can now be of type :class:`bytes` or :class:`bytearray`. The input " "encoding should be UTF-8, UTF-16 or UTF-32." msgstr "" -"現在,*s* 可以是一個\\ :term:`二進位檔案 `\\ ,前提是其編碼格式為 UTF-8、UTF-16 或 UTF-32。" +"現在,*s* 可以是一個\\ :term:`二進位檔案 `\\ ,前提是其編碼格式" +"為 UTF-8、UTF-16 或 UTF-32。" #: ../../library/json.rst:299 msgid "The keyword argument *encoding* has been removed." @@ -499,7 +509,8 @@ msgid "" "It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their " "corresponding ``float`` values, which is outside the JSON spec." msgstr "" -"雖然 ``NaN``、``Infinity`` 和 ``-Infinity`` 並不符合 JSON 規範,解碼器依然能正確的將其對應到相應的 Python ``float`` 值。" +"雖然 ``NaN``、``Infinity`` 和 ``-Infinity`` 並不符合 JSON 規範,解碼器依然能" +"正確的將其對應到相應的 Python ``float`` 值。" #: ../../library/json.rst:337 msgid "" @@ -508,10 +519,10 @@ msgid "" "class:`dict`. This can be used to provide custom deserializations (e.g. to " "support `JSON-RPC `_ class hinting)." msgstr "" -"*object_hook* 是一個可選參數,其接受一個函數作為輸入。原始的字串解碼結果(一個 :class:" -"`dict`\\ )將被傳入這個函數、並使用 *object_hook* 的回傳值來取代原先的 :class:`dict` 輸出。此功" -"能可用於實作自訂義解碼器(例如 `JSON-RPC `_ 類別提" -"示)。" +"*object_hook* 是一個可選參數,其接受一個函數作為輸入。原始的字串解碼結果(一" +"個 :class:`dict`\\ )將被傳入這個函數、並使用 *object_hook* 的回傳值來取代原" +"先的 :class:`dict` 輸出。此功能可用於實作自訂義解碼器(例如 `JSON-RPC " +"`_ 類別提示)。" #: ../../library/json.rst:342 msgid "" @@ -521,11 +532,10 @@ msgid "" "can be used to implement custom decoders. If *object_hook* is also defined, " "the *object_pairs_hook* takes priority." msgstr "" -"*object_pairs_hook* 是一個可選參數,其接受一個函數作為輸入。原始的有序對列表(ordered list of pairs)解碼" -"結果將被傳入這個函數、並使用 *object_pairs_hook* 的回傳值來取代原先的 :class:`dict` 輸出。此" -"功能可用於實作自訂義解碼器。如果也同時給定了 *object_hook*,則 *object_pairs_hook* " -"優先。" - +"*object_pairs_hook* 是一個可選參數,其接受一個函數作為輸入。原始的有序對列表" +"(ordered list of pairs)解碼結果將被傳入這個函數、並使用 " +"*object_pairs_hook* 的回傳值來取代原先的 :class:`dict` 輸出。此功能可用於實作" +"自訂義解碼器。如果也同時給定了 *object_hook*,則 *object_pairs_hook* 優先。" #: ../../library/json.rst:366 msgid "" @@ -534,18 +544,22 @@ msgid "" "with character codes in the 0--31 range, including ``'\\t'`` (tab), " "``'\\n'``, ``'\\r'`` and ``'\\0'``." msgstr "" -"如果 *strict* 被設為 false(預設值為 ``True``),那麼字串中將允許控制字元。此語境中的控制字元指的是 ASCII 字元編碼在 0~31 範圍內的字元,包括 ``'\\t'``(tab 鍵)、``'\\n'``、``'\\r'`` 和 ``'\\0'``。" +"如果 *strict* 被設為 false(預設值為 ``True``),那麼字串中將允許控制字元。此" +"語境中的控制字元指的是 ASCII 字元編碼在 0~31 範圍內的字元,包括 ``'\\t'``" +"(tab 鍵)、``'\\n'``、``'\\r'`` 和 ``'\\0'``。" #: ../../library/json.rst:374 ../../library/json.rst:475 msgid "All parameters are now :ref:`keyword-only `." -msgstr "所有可選參數現在都是\\ :ref:`僅限關鍵字 `\\ 參數了。" +msgstr "" +"所有可選參數現在都是\\ :ref:`僅限關鍵字 `\\ 參數了。" #: ../../library/json.rst:379 msgid "" "Return the Python representation of *s* (a :class:`str` instance containing " "a JSON document)." msgstr "" -"返回用 Python 方式表達的 *s*(一個含有 JSON 文件的 :class:`str` 實例(instance))" +"返回用 Python 方式表達的 *s*(一個含有 JSON 文件的 :class:`str` 實例" +"(instance))" #: ../../library/json.rst:382 msgid "" @@ -559,14 +573,14 @@ msgid "" "document) and return a 2-tuple of the Python representation and the index in " "*s* where the document ended." msgstr "" -"將 *s* (一個開頭部分含有合格 JSON 文件的 :class:`str`) 解碼,並將 JSON 文件結束點的索引值(index)和解碼結果合併為一個二元組(2-tuple)後回傳。" +"將 *s* (一個開頭部分含有合格 JSON 文件的 :class:`str`) 解碼,並將 JSON 文件" +"結束點的索引值(index)和解碼結果合併為一個二元組(2-tuple)後回傳。" #: ../../library/json.rst:391 msgid "" "This can be used to decode a JSON document from a string that may have " "extraneous data at the end." -msgstr "" -"這個方法可以用來解碼尾段可能帶有 JSON 以外資料的文字。" +msgstr "這個方法可以用來解碼尾段可能帶有 JSON 以外資料的文字。" #: ../../library/json.rst:397 msgid "Extensible JSON encoder for Python data structures." @@ -599,8 +613,9 @@ msgid "" "serializable object for ``o`` if possible, otherwise it should call the " "superclass implementation (to raise :exc:`TypeError`)." msgstr "" -"若要擴充此功能來識別其他物件,請繼承並實作一個 :meth:`~JSONEncoder.default` 方法。" -"此方法應回傳一個可序列化的 ``o`` 物件,否則此方法應呼叫父類別的 :meth:`~JSONEncoder.default` 方法(以拋出 :exc:`TypeError` 例外)。" +"若要擴充此功能來識別其他物件,請繼承並實作一個 :meth:`~JSONEncoder.default` " +"方法。此方法應回傳一個可序列化的 ``o`` 物件,否則此方法應呼叫父類別的 :meth:" +"`~JSONEncoder.default` 方法(以拋出 :exc:`TypeError` 例外)。" #: ../../library/json.rst:429 msgid "" From 4bd577d92ee45842b7784b20caa8a8377f46e0bc Mon Sep 17 00:00:00 2001 From: "Raynor@GullU" Date: Thu, 8 Aug 2024 22:49:10 +0800 Subject: [PATCH 09/18] editing json.po, up to line 663. --- library/json.po | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/library/json.po b/library/json.po index bebc540ece..64996b6872 100644 --- a/library/json.po +++ b/library/json.po @@ -623,6 +623,10 @@ msgid "" "trying to encode keys that are not :class:`str`, :class:`int`, :class:" "`float` or ``None``. If *skipkeys* is true, such items are simply skipped." msgstr "" +"若 *skipkeys* 為 false(預設值),則當在編碼不是 :class:`str`,:class:`int`," +":class:`float` 或 ``None`` 的鍵值時,將引發 :exc:`TypeError`。如果 *skipkeys* " +"為 true,這些項目將直接被跳過。" + #: ../../library/json.rst:437 msgid "" @@ -631,6 +635,10 @@ msgid "" "prevent an infinite recursion (which would cause a :exc:`RecursionError`). " "Otherwise, no such check takes place." msgstr "" +"如果 *check_circular* 為 true(預設值),則會在編碼期間檢查列表(list)、字典(dict)" +"和自定義編碼物件的循環參照,以防止無限遞迴(一個會導致 :exc:`RecursionError` 例外的問題)。" +"否則不會進行此類檢查。" + #: ../../library/json.rst:442 msgid "" @@ -639,6 +647,10 @@ msgid "" "compliant, but is consistent with most JavaScript based encoders and " "decoders. Otherwise, it will be a :exc:`ValueError` to encode such floats." msgstr "" +"如果 *allow_nan* 為 true(預設值),則 ``NaN``、``Infinity`` 和 ``-Infinity`` 將按" +"照原樣進行編碼。請記得此行為不符合標準 JSON 規範,但的確與大多數基於 JavaScript 的編碼器和解" +"碼器一致。否則若設為 false,嘗試對這些浮點數進行編碼將引發 :exc:`ValueError` 例外。" + #: ../../library/json.rst:448 msgid "" @@ -646,6 +658,9 @@ msgid "" "will be sorted by key; this is useful for regression tests to ensure that " "JSON serializations can be compared on a day-to-day basis." msgstr "" +"如果 *sort_keys* 為 true(預設值:``False``),則 dictionary(字典)的輸出將按鍵值排序。" +"這項功能可確保 JSON 序列化的結果能被互相比較,能讓回歸測試的檢查變得方便。" + #: ../../library/json.rst:481 msgid "" From 9c4d3acf35073d2cf1113acc98e17e5ff7488ce8 Mon Sep 17 00:00:00 2001 From: "Raynor@GullU" Date: Thu, 8 Aug 2024 23:33:18 +0800 Subject: [PATCH 10/18] editing json.po, up to line 731. --- library/json.po | 56 +++++++++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/library/json.po b/library/json.po index 64996b6872..7ff1ef2c2e 100644 --- a/library/json.po +++ b/library/json.po @@ -623,10 +623,9 @@ msgid "" "trying to encode keys that are not :class:`str`, :class:`int`, :class:" "`float` or ``None``. If *skipkeys* is true, such items are simply skipped." msgstr "" -"若 *skipkeys* 為 false(預設值),則當在編碼不是 :class:`str`,:class:`int`," -":class:`float` 或 ``None`` 的鍵值時,將引發 :exc:`TypeError`。如果 *skipkeys* " -"為 true,這些項目將直接被跳過。" - +"若 *skipkeys* 為 false(預設值),則當在編碼不是 :class:`str`,:class:" +"`int`,:class:`float` 或 ``None`` 的鍵值時,將引發 :exc:`TypeError`。如果 " +"*skipkeys* 為 true,這些項目將直接被跳過。" #: ../../library/json.rst:437 msgid "" @@ -635,10 +634,9 @@ msgid "" "prevent an infinite recursion (which would cause a :exc:`RecursionError`). " "Otherwise, no such check takes place." msgstr "" -"如果 *check_circular* 為 true(預設值),則會在編碼期間檢查列表(list)、字典(dict)" -"和自定義編碼物件的循環參照,以防止無限遞迴(一個會導致 :exc:`RecursionError` 例外的問題)。" -"否則不會進行此類檢查。" - +"如果 *check_circular* 為 true(預設值),則會在編碼期間檢查列表(list)、字典" +"(dict)和自定義編碼物件的循環參照,以防止無限遞迴(一個會導致 :exc:" +"`RecursionError` 例外的問題)。否則不會進行此類檢查。" #: ../../library/json.rst:442 msgid "" @@ -647,10 +645,10 @@ msgid "" "compliant, but is consistent with most JavaScript based encoders and " "decoders. Otherwise, it will be a :exc:`ValueError` to encode such floats." msgstr "" -"如果 *allow_nan* 為 true(預設值),則 ``NaN``、``Infinity`` 和 ``-Infinity`` 將按" -"照原樣進行編碼。請記得此行為不符合標準 JSON 規範,但的確與大多數基於 JavaScript 的編碼器和解" -"碼器一致。否則若設為 false,嘗試對這些浮點數進行編碼將引發 :exc:`ValueError` 例外。" - +"如果 *allow_nan* 為 true(預設值),則 ``NaN``、``Infinity`` 和 ``-" +"Infinity`` 將按照原樣進行編碼。請記得此行為不符合標準 JSON 規範,但的確與大多" +"數基於 JavaScript 的編碼器和解碼器一致。否則若設為 false,嘗試對這些浮點數進" +"行編碼將引發 :exc:`ValueError` 例外。" #: ../../library/json.rst:448 msgid "" @@ -658,9 +656,9 @@ msgid "" "will be sorted by key; this is useful for regression tests to ensure that " "JSON serializations can be compared on a day-to-day basis." msgstr "" -"如果 *sort_keys* 為 true(預設值:``False``),則 dictionary(字典)的輸出將按鍵值排序。" -"這項功能可確保 JSON 序列化的結果能被互相比較,能讓回歸測試的檢查變得方便。" - +"如果 *sort_keys* 為 true(預設值:``False``),則 dictionary(字典)的輸出將" +"按鍵值排序。這項功能可確保 JSON 序列化的結果能被互相比較,能讓日常的回歸測試" +"檢查變得方便一些。" #: ../../library/json.rst:481 msgid "" @@ -668,56 +666,68 @@ msgid "" "object for *o*, or calls the base implementation (to raise a :exc:" "`TypeError`)." msgstr "" +"在任意一個子類別裡實作這個方法時須讓其回傳一個可串列化的物件 *o* ,或呼叫原始" +"的實作以引發 :exc:`TypeError` 例外。" #: ../../library/json.rst:485 msgid "" "For example, to support arbitrary iterators, you could implement :meth:" "`~JSONEncoder.default` like this::" msgstr "" +"舉例來說,想要讓編碼器支援任意疊代器(iterator),你可以實作這樣子的 :meth:" +"`~JSONEncoder.default`::" #: ../../library/json.rst:501 msgid "" "Return a JSON string representation of a Python data structure, *o*. For " "example::" -msgstr "" +msgstr "回傳一個 Python 資料結構物件 *o* 的 JSON 的字串表示。例如::" #: ../../library/json.rst:510 msgid "" "Encode the given object, *o*, and yield each string representation as " "available. For example::" msgstr "" +"將物件 *o* 編碼,並將結果統整為一個能依序產生(yield)各結果字串的生成器物件" +"(generator)。如下例::" +# 執行下列程式後能證明他的回傳物件是generator +# >>> import json +# >>> bigobject = list(range(100000)) +# >>> x = json.JSONEncoder().iterencode(bigobject) +# >>> print(x) +# ._iterencode at 0x7293c4b48bc0> #: ../../library/json.rst:518 msgid "Exceptions" msgstr "例外" #: ../../library/json.rst:522 msgid "Subclass of :exc:`ValueError` with the following additional attributes:" -msgstr "" +msgstr ":exc:`ValueError` 的子類別具有下列額外屬性:" #: ../../library/json.rst:526 msgid "The unformatted error message." -msgstr "" +msgstr "未格式化的錯誤訊息。" #: ../../library/json.rst:530 msgid "The JSON document being parsed." -msgstr "" +msgstr "正在被剖析的 JSON 文件。" #: ../../library/json.rst:534 msgid "The start index of *doc* where parsing failed." -msgstr "" +msgstr "*doc* 剖析失敗處的起始點的索引值。" #: ../../library/json.rst:538 msgid "The line corresponding to *pos*." -msgstr "" +msgstr "*pos* 所在的行數。" #: ../../library/json.rst:542 msgid "The column corresponding to *pos*." -msgstr "" +msgstr "*pos* 所在的列(column)數。" #: ../../library/json.rst:548 msgid "Standard Compliance and Interoperability" -msgstr "" +msgstr "標準守則與互通性" #: ../../library/json.rst:550 msgid "" From ad4fff0ad256db5fb55807c1b2e688312805faae Mon Sep 17 00:00:00 2001 From: "Raynor@GullU" Date: Fri, 9 Aug 2024 00:13:56 +0800 Subject: [PATCH 11/18] editing json.po, up to line 816. --- library/json.po | 60 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 21 deletions(-) diff --git a/library/json.po b/library/json.po index 7ff1ef2c2e..cc3facb835 100644 --- a/library/json.po +++ b/library/json.po @@ -104,7 +104,7 @@ msgstr "" "JSON 語法是 `YAML `_ 1.2 語法的一種子集合。所以如果使用預" "設的設定的話(準確來說,使用預設的 *separators* 分隔符設定的話),這個模組的" "輸出也符合 YAML 1.0 和 1.1 的子集合規範。因此你也可以利用這個模組來當作 YAML " -"的串聯化工具(serializer)。" +"的串列化工具(serializer)。" #: ../../library/json.rst:130 msgid "" @@ -124,7 +124,7 @@ msgid "" "supporting :term:`file-like object`) using this :ref:`conversion table `." msgstr "" -"參考這個\\ :ref:`轉換表 `\\ 將 *obj* 串聯化為符合 JSON 格式" +"參考這個\\ :ref:`轉換表 `\\ 將 *obj* 串列化為符合 JSON 格式" "的字串流,並寫入到 *fp* (一個支援 ``.write()`` 方法的 :term:`file-like " "object`)" @@ -173,7 +173,7 @@ msgid "" "*allow_nan* is true, their JavaScript equivalents (``NaN``, ``Infinity``, ``-" "Infinity``) will be used." msgstr "" -"如果 *allow_nan* 為 false(預設值:``True``\\ ),則串聯化超出嚴格 JSON 規範" +"如果 *allow_nan* 為 false(預設值:``True``\\ ),則串列化超出嚴格 JSON 規範" "之範圍的 :class:`float` 值 (``nan``, ``inf``, ``-inf``) 會引發 :exc:" "`ValueError`。如果 *allow_nan* 為 true,則將使用它們的 JavaScript 等效項 " "(``NaN``, ``Infinity``, ``-Infinity``)。" @@ -219,7 +219,7 @@ msgid "" "version of the object or raise a :exc:`TypeError`. If not specified, :exc:" "`TypeError` is raised." msgstr "" -"如果有指定本參數,*default* 應該是一個為無法串聯化的物件呼叫的函式。它應該傳" +"如果有指定本參數,*default* 應該是一個為無法串列化的物件呼叫的函式。它應該傳" "回物件的 JSON 可編碼版本或引發 :exc:`TypeError`。如果未指定,則會引發 :exc:" "`TypeError`。" @@ -237,7 +237,7 @@ msgid "" "it with the *cls* kwarg; otherwise :class:`JSONEncoder` is used." msgstr "" "若要使用自訂 :class:`JSONEncoder` 子類別(例如覆寫 :meth:`~JSONEncoder." -"default` 方法來串聯化其他型別的子類別),請使用關鍵字參數 *cls* 指定它;否則" +"default` 方法來串列化其他型別的子類別),請使用關鍵字參數 *cls* 指定它;否則" "使用 :class:`JSONEncoder`。" #: ../../library/json.rst:198 ../../library/json.rst:277 @@ -253,7 +253,7 @@ msgid "" "using the same *fp* will result in an invalid JSON file." msgstr "" "與 :mod:`pickle` 和 :mod:`marshal` 不同,JSON 沒有二進位分框的協定,因此嘗試" -"重複呼叫 :func:`dump` 來串聯化多個物件到同一個 *fp* 裡將導致無效的 JSON 檔" +"重複呼叫 :func:`dump` 來串列化多個物件到同一個 *fp* 裡將導致無效的 JSON 檔" "案。" # SkyLull: 我想這裡的 "framed protocol" 指的是 https://peps.python.org/pep-3154/#framing @@ -263,7 +263,7 @@ msgid "" "table `. The arguments have the same meaning as in :func:" "`dump`." msgstr "" -"使用此\\ :ref:`轉換表 `\\ 來將 *obj* 串聯化為 JSON 格式 :" +"使用此\\ :ref:`轉換表 `\\ 來將 *obj* 串列化為 JSON 格式 :" "class:`str`。這個參數的作用與 :func:`dump` 中的同名參數意義相同。" #: ../../library/json.rst:218 @@ -287,7 +287,7 @@ msgid "" msgstr "" "使用此\\ :ref:`轉換表 `\\ 來將 *fp*\\ (一個支援 ``." "read()``、包含 JSON 文件的\\ :term:`文字檔案 `\\ 或\\ :term:`二進" -"位檔案 `\\ )去序列化為 Python 物件。" +"位檔案 `\\ )去串列化為 Python 物件。" #: ../../library/json.rst:231 msgid "" @@ -383,7 +383,7 @@ msgid "" "If the data being deserialized is not a valid JSON document, a :exc:" "`JSONDecodeError` will be raised." msgstr "" -"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引發 :exc:" +"如果被去串列化(deserialized)的資料不符合 JSON 格式,將會引發 :exc:" "`JSONDecodeError` 例外。" #: ../../library/json.rst:280 @@ -402,7 +402,7 @@ msgid "" msgstr "" "使用\\ :ref:`轉換表 `\\ 將 *s* (一個含有 JSON 文件的 :" "class:`str`\\ 、\\ :class:`bytes` 或 :class:`bytearray` 的實例(instance))" -"去序列化(deserialize)為一個 Python 物件" +"去串列化(deserialize)為一個 Python 物件" #: ../../library/json.rst:290 msgid "The other arguments have the same meaning as in :func:`load`." @@ -683,6 +683,12 @@ msgid "" "example::" msgstr "回傳一個 Python 資料結構物件 *o* 的 JSON 的字串表示。例如::" +# 執行下列程式後能證明他的回傳物件是generator +# >>> import json +# >>> bigobject = list(range(100000)) +# >>> x = json.JSONEncoder().iterencode(bigobject) +# >>> print(x) +# ._iterencode at 0x7293c4b48bc0> #: ../../library/json.rst:510 msgid "" "Encode the given object, *o*, and yield each string representation as " @@ -691,12 +697,6 @@ msgstr "" "將物件 *o* 編碼,並將結果統整為一個能依序產生(yield)各結果字串的生成器物件" "(generator)。如下例::" -# 執行下列程式後能證明他的回傳物件是generator -# >>> import json -# >>> bigobject = list(range(100000)) -# >>> x = json.JSONEncoder().iterencode(bigobject) -# >>> print(x) -# ._iterencode at 0x7293c4b48bc0> #: ../../library/json.rst:518 msgid "Exceptions" msgstr "例外" @@ -707,7 +707,7 @@ msgstr ":exc:`ValueError` 的子類別具有下列額外屬性:" #: ../../library/json.rst:526 msgid "The unformatted error message." -msgstr "未格式化的錯誤訊息。" +msgstr "未受格式化的錯誤訊息。" #: ../../library/json.rst:530 msgid "The JSON document being parsed." @@ -727,7 +727,7 @@ msgstr "*pos* 所在的列(column)數。" #: ../../library/json.rst:548 msgid "Standard Compliance and Interoperability" -msgstr "標準守則與互通性" +msgstr "合規性與互通性" #: ../../library/json.rst:550 msgid "" @@ -737,22 +737,28 @@ msgid "" "simplicity, :class:`JSONEncoder` and :class:`JSONDecoder` subclasses, and " "parameters other than those explicitly mentioned, are not considered." msgstr "" +"JSON 格式是由 :rfc:`7159` 和 `ECMA-404 ` 規範的。本節詳細說明了本模組" +"對 RFC 的遵循程度。簡單起見,:class:`JSONEncoder` 和 :class:`JSONDecoder` 子" +"類別以及未明確提及的參數將不予考慮。" #: ../../library/json.rst:556 msgid "" "This module does not comply with the RFC in a strict fashion, implementing " "some extensions that are valid JavaScript but not valid JSON. In particular:" msgstr "" +"這個模組的部份實作並未非常嚴格地遵循 RFC 規範。準確來說,下列實際實作符合 " +"JavaScript 語法格式,但並不符合 JSON 格式:" #: ../../library/json.rst:559 msgid "Infinite and NaN number values are accepted and output;" -msgstr "" +msgstr "無限(Infinite)和非數字(NaN)值會被接受。" #: ../../library/json.rst:560 msgid "" "Repeated names within an object are accepted, and only the value of the last " "name-value pair is used." -msgstr "" +msgstr "同一個物件內可以有重複的名稱,但只有最後一個同名物件是有效的。" #: ../../library/json.rst:563 msgid "" @@ -760,10 +766,12 @@ msgid "" "not RFC-compliant, this module's deserializer is technically RFC-compliant " "under default settings." msgstr "" +"不過 RFC 准許遵循 RFC 的剖析器接受不合規的文字輸入,所以技術上來說若以預設設" +"定運作,本模組的去串列化器是符合 RFC 規範的。" #: ../../library/json.rst:568 msgid "Character Encodings" -msgstr "" +msgstr "字元編碼格式" #: ../../library/json.rst:570 msgid "" @@ -771,6 +779,8 @@ msgid "" "UTF-32, with UTF-8 being the recommended default for maximum " "interoperability." msgstr "" +"RFC 規定要求 JSON 必須以 UTF-8、UTF-16 或 UTF-32 格式編碼。並推薦以 UTF-8 編" +"碼以達成最良好的互通性。" #: ../../library/json.rst:573 msgid "" @@ -778,6 +788,8 @@ msgid "" "*ensure_ascii=True* by default, thus escaping the output so that the " "resulting strings only contain ASCII characters." msgstr "" +"RFC 准許但並不要求編碼器的 *ensure_ascii=True* 是預設值,但本模組依然實作了此" +"一選項作為預設,因此本模組會轉義所有非 ASCII 字元。" #: ../../library/json.rst:577 msgid "" @@ -786,6 +798,8 @@ msgid "" "`, and thus does not otherwise directly address the issue of character " "encodings." msgstr "" +"除了 *ensure_ascii* 選項之外,本模組嚴格遵循 Python 物件與 :class:`Unicode " +"strings ` 之間的轉換規範,因此並不另外處理字元編碼的問題。" #: ../../library/json.rst:582 msgid "" @@ -795,6 +809,10 @@ msgid "" "in their input. This module's deserializer raises a :exc:`ValueError` when " "an initial BOM is present." msgstr "" +"RFC 禁止在文件的開頭加上端序記號(BOM),因此本模組的串列化器(serializer)也" +"不會在輸出中加入端序記號。RFC 允許但不強制 JSON 去串列化器(deserializer)忽" +"略文件初始的端序記號,因此本模組的去串列化器將在遭遇端序記號時引發 :exc:" +"`ValueError` 例外。" #: ../../library/json.rst:588 msgid "" From b097b0fada06f9e22540fa0be132994e362ba712 Mon Sep 17 00:00:00 2001 From: "Raynor@GullU" Date: Fri, 9 Aug 2024 23:08:42 +0800 Subject: [PATCH 12/18] editing json.po, up to line 832 --- library/json.po | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/library/json.po b/library/json.po index cc3facb835..d4eec4b921 100644 --- a/library/json.po +++ b/library/json.po @@ -68,11 +68,11 @@ msgstr "對基本 Python 物件階層進行編碼: ::" #: ../../library/json.rst:48 msgid "Compact encoding::" -msgstr "改用緊湊型編碼方式::" +msgstr "改用緊湊型編碼方式: ::" #: ../../library/json.rst:54 msgid "Pretty printing::" -msgstr "美化輸出:" +msgstr "美化輸出: ::" #: ../../library/json.rst:63 msgid "Decoding JSON::" @@ -80,11 +80,11 @@ msgstr "JSON 解碼: ::" #: ../../library/json.rst:75 msgid "Specializing JSON object decoding::" -msgstr "自訂特殊的 JSON 解碼方式::" +msgstr "自訂特殊的 JSON 解碼方式: ::" #: ../../library/json.rst:90 msgid "Extending :class:`JSONEncoder`::" -msgstr "在 :class:`JSONEncoder` 裡自行擴充額外的編碼方法::" +msgstr "在 :class:`JSONEncoder` 裡自行擴充額外的編碼方法: ::" #: ../../library/json.rst:108 msgid "Using :mod:`json.tool` from the shell to validate and pretty-print:" @@ -675,13 +675,13 @@ msgid "" "`~JSONEncoder.default` like this::" msgstr "" "舉例來說,想要讓編碼器支援任意疊代器(iterator),你可以實作這樣子的 :meth:" -"`~JSONEncoder.default`::" +"`~JSONEncoder.default`: ::" #: ../../library/json.rst:501 msgid "" "Return a JSON string representation of a Python data structure, *o*. For " "example::" -msgstr "回傳一個 Python 資料結構物件 *o* 的 JSON 的字串表示。例如::" +msgstr "回傳一個 Python 資料結構物件 *o* 的 JSON 的字串表示。例如: ::" # 執行下列程式後能證明他的回傳物件是generator # >>> import json @@ -695,7 +695,7 @@ msgid "" "available. For example::" msgstr "" "將物件 *o* 編碼,並將結果統整為一個能依序產生(yield)各結果字串的生成器物件" -"(generator)。如下例::" +"(generator)。如下例: ::" #: ../../library/json.rst:518 msgid "Exceptions" @@ -767,7 +767,7 @@ msgid "" "under default settings." msgstr "" "不過 RFC 准許遵循 RFC 的剖析器接受不合規的文字輸入,所以技術上來說若以預設設" -"定運作,本模組的去串列化器是符合 RFC 規範的。" +"定運作,本模組的去串列化器(deserializer)是符合 RFC 規範的。" #: ../../library/json.rst:568 msgid "Character Encodings" @@ -779,8 +779,8 @@ msgid "" "UTF-32, with UTF-8 being the recommended default for maximum " "interoperability." msgstr "" -"RFC 規定要求 JSON 必須以 UTF-8、UTF-16 或 UTF-32 格式編碼。並推薦以 UTF-8 編" -"碼以達成最良好的互通性。" +"RFC 要求 JSON 必須以 UTF-8、UTF-16 或 UTF-32 格式編碼。並推薦以 UTF-8 編" +"碼以達成最佳的互通性。" #: ../../library/json.rst:573 msgid "" @@ -788,8 +788,8 @@ msgid "" "*ensure_ascii=True* by default, thus escaping the output so that the " "resulting strings only contain ASCII characters." msgstr "" -"RFC 准許但並不要求編碼器的 *ensure_ascii=True* 是預設值,但本模組依然實作了此" -"一選項作為預設,因此本模組會轉義所有非 ASCII 字元。" +"RFC 准許但並不強制編碼器的 *ensure_ascii=True* 行為是預設值,但本模組依然實作了此" +"一選項作為預設,因此本模組預設會轉義所有非 ASCII 字元。" #: ../../library/json.rst:577 msgid "" @@ -811,7 +811,7 @@ msgid "" msgstr "" "RFC 禁止在文件的開頭加上端序記號(BOM),因此本模組的串列化器(serializer)也" "不會在輸出中加入端序記號。RFC 允許但不強制 JSON 去串列化器(deserializer)忽" -"略文件初始的端序記號,因此本模組的去串列化器將在遭遇端序記號時引發 :exc:" +"略文件初始的端序記號,因此本模組的去串列化器將在遭遇位於文件開頭的端序記號時引發 :exc:" "`ValueError` 例外。" #: ../../library/json.rst:588 @@ -822,10 +822,13 @@ msgid "" "By default, this module accepts and outputs (when present in the original :" "class:`str`) code points for such sequences." msgstr "" +"RFC 並未明確禁止 JSON 文件包含無法對應有效 Unicode 字元的位元組序列(例如未配對的 UTF-16 代理對(surrogate " +"pairs)),但這個特性的確可能會引起相容性問題。預設情況下,當原始輸入的 :class:`str` " +"中存在此類序列時,該模組將接受並輸出這些序列的編碼位置(code points)。" #: ../../library/json.rst:596 msgid "Infinite and NaN Number Values" -msgstr "" +msgstr "正負無限與非數值" #: ../../library/json.rst:598 msgid "" From 9d0513c17374b316bcf9fb898bd456cd1cb4e478 Mon Sep 17 00:00:00 2001 From: "Raynor@GullU" Date: Fri, 9 Aug 2024 23:49:09 +0800 Subject: [PATCH 13/18] first iteration of json.po done. --- library/json.po | 86 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 58 insertions(+), 28 deletions(-) diff --git a/library/json.po b/library/json.po index d4eec4b921..5961aae2fa 100644 --- a/library/json.po +++ b/library/json.po @@ -256,7 +256,8 @@ msgstr "" "重複呼叫 :func:`dump` 來串列化多個物件到同一個 *fp* 裡將導致無效的 JSON 檔" "案。" -# SkyLull: 我想這裡的 "framed protocol" 指的是 https://peps.python.org/pep-3154/#framing +# SkyLull: 我想這裡的 "framed protocol" 指的是 +# https://peps.python.org/pep-3154/#framing #: ../../library/json.rst:212 msgid "" "Serialize *obj* to a JSON formatted :class:`str` using this :ref:`conversion " @@ -474,7 +475,7 @@ msgstr "int" #: ../../library/json.rst:325 msgid "number (real)" -msgstr "" +msgstr "number (實數)" #: ../../library/json.rst:325 msgid "float" @@ -779,8 +780,8 @@ msgid "" "UTF-32, with UTF-8 being the recommended default for maximum " "interoperability." msgstr "" -"RFC 要求 JSON 必須以 UTF-8、UTF-16 或 UTF-32 格式編碼。並推薦以 UTF-8 編" -"碼以達成最佳的互通性。" +"RFC 要求 JSON 必須以 UTF-8、UTF-16 或 UTF-32 格式編碼。並推薦以 UTF-8 編碼以" +"達成最佳的互通性。" #: ../../library/json.rst:573 msgid "" @@ -788,8 +789,8 @@ msgid "" "*ensure_ascii=True* by default, thus escaping the output so that the " "resulting strings only contain ASCII characters." msgstr "" -"RFC 准許但並不強制編碼器的 *ensure_ascii=True* 行為是預設值,但本模組依然實作了此" -"一選項作為預設,因此本模組預設會轉義所有非 ASCII 字元。" +"RFC 准許但並不強制編碼器的 *ensure_ascii=True* 行為是預設值,但本模組依然實作" +"了此一選項作為預設,因此本模組預設會轉義所有非 ASCII 字元。" #: ../../library/json.rst:577 msgid "" @@ -811,8 +812,8 @@ msgid "" msgstr "" "RFC 禁止在文件的開頭加上端序記號(BOM),因此本模組的串列化器(serializer)也" "不會在輸出中加入端序記號。RFC 允許但不強制 JSON 去串列化器(deserializer)忽" -"略文件初始的端序記號,因此本模組的去串列化器將在遭遇位於文件開頭的端序記號時引發 :exc:" -"`ValueError` 例外。" +"略文件初始的端序記號,因此本模組的去串列化器將在遭遇位於文件開頭的端序記號時" +"引發 :exc:`ValueError` 例外。" #: ../../library/json.rst:588 msgid "" @@ -822,9 +823,10 @@ msgid "" "By default, this module accepts and outputs (when present in the original :" "class:`str`) code points for such sequences." msgstr "" -"RFC 並未明確禁止 JSON 文件包含無法對應有效 Unicode 字元的位元組序列(例如未配對的 UTF-16 代理對(surrogate " -"pairs)),但這個特性的確可能會引起相容性問題。預設情況下,當原始輸入的 :class:`str` " -"中存在此類序列時,該模組將接受並輸出這些序列的編碼位置(code points)。" +"RFC 並未明確禁止 JSON 文件包含無法對應有效 Unicode 字元的位元組序列(例如未配" +"對的 UTF-16 代理對(surrogate pairs)),但這個特性的確可能會引起相容性問題。" +"預設情況下,當原始輸入的 :class:`str` 中存在此類序列時,該模組將接受並輸出這" +"些序列的編碼位置(code points)。" #: ../../library/json.rst:596 msgid "Infinite and NaN Number Values" @@ -836,6 +838,8 @@ msgid "" "Despite that, by default, this module accepts and outputs ``Infinity``, ``-" "Infinity``, and ``NaN`` as if they were valid JSON number literal values::" msgstr "" +"RFC 不允許表現無限大或非數值(NaN)。但預設情況下,這個模組仍接受並輸出 " +"``Infinity``、``-Infinity`` 和 ``NaN``,如同它們是有效的 JSON 數值字面值: ::" #: ../../library/json.rst:613 msgid "" @@ -843,10 +847,12 @@ msgid "" "behavior. In the deserializer, the *parse_constant* parameter can be used " "to alter this behavior." msgstr "" +"在串列化器中,*allow_nan* 參數可以改變這個行為。在去串列化器中," +"*parse_constant* 參數可以改變這個行為。" #: ../../library/json.rst:619 msgid "Repeated Names Within an Object" -msgstr "" +msgstr "物件內重複的鍵值名稱" #: ../../library/json.rst:621 msgid "" @@ -855,14 +861,17 @@ msgid "" "default, this module does not raise an exception; instead, it ignores all " "but the last name-value pair for a given name::" msgstr "" +"RFC 規範僅表明 JSON 物件中的名字應該是唯一的,但沒有強制要求如何處理重複的名" +"字。預設情況下,這個模組不會引發例外;相反的,它會忽略該名字的所有重複鍵值" +"對,只保留最後一個: ::" #: ../../library/json.rst:630 msgid "The *object_pairs_hook* parameter can be used to alter this behavior." -msgstr "*object_parts_hook* 參數可以被使用來改變此行為。" +msgstr "*object_parts_hook* 參數可以改變這個行為。" #: ../../library/json.rst:634 msgid "Top-level Non-Object, Non-Array Values" -msgstr "" +msgstr "位於頂層的非物件及非列表值" #: ../../library/json.rst:636 msgid "" @@ -873,42 +882,48 @@ msgid "" "this module does not and has never implemented that restriction in either " "its serializer or its deserializer." msgstr "" +"由已廢棄的 :rfc:`4627` 規範的舊版 JSON 要求 JSON 文字的頂層值必須是 JSON 物件" +"或陣列(Python :class:`dict` 或 :class:`list`),而且不能是 JSON 的 null、" +"boolean、數字或字串值。 :rfc:`7159` 移除了這個限制,而此模組在其串列化器或去" +"串列化器中也未曾實施過該限制。" #: ../../library/json.rst:643 msgid "" "Regardless, for maximum interoperability, you may wish to voluntarily adhere " "to the restriction yourself." -msgstr "" +msgstr "如果想要最大限度地保留互通性,你可能還是會想要自行施加這個限制。" #: ../../library/json.rst:648 msgid "Implementation Limitations" -msgstr "" +msgstr "實作限制" #: ../../library/json.rst:650 msgid "Some JSON deserializer implementations may set limits on:" -msgstr "" +msgstr "某些 JSON 去串列化器的實作可能會造成下列限制:" #: ../../library/json.rst:652 msgid "the size of accepted JSON texts" -msgstr "" +msgstr "JSON 文件長度上限" #: ../../library/json.rst:653 msgid "the maximum level of nesting of JSON objects and arrays" -msgstr "" +msgstr "JSON 物件或陣列的最大巢狀層數(level of nesting)限制" #: ../../library/json.rst:654 msgid "the range and precision of JSON numbers" -msgstr "" +msgstr "數字的精準度或範圍" #: ../../library/json.rst:655 msgid "the content and maximum length of JSON strings" -msgstr "" +msgstr "JSON 字串長度上限" #: ../../library/json.rst:657 msgid "" "This module does not impose any such limits beyond those of the relevant " "Python datatypes themselves or the Python interpreter itself." msgstr "" +"這個模組本身不會設定任何此類限制,除了 Python 資料型態本身或 Python 直譯器本" +"身的限制。" #: ../../library/json.rst:660 msgid "" @@ -920,6 +935,10 @@ msgid "" "magnitude, or when serializing instances of \"exotic\" numerical types such " "as :class:`decimal.Decimal`." msgstr "" +"串列化為 JSON 時,要注意可能會使用該 JSON 的應用程式中的相關限制。特別要注意" +"的是,JSON 數字常會被去串列化為 IEEE 754 雙精度浮點數(double),並因而受到其" +"表示範圍和精度限制的影響。這在序列化極大的 Python :class:`int` 數值、或是序列" +"化特殊數字型別(例如 :class:`decimal.Decimal`)實例時尤其重要。" #: ../../library/json.rst:673 msgid "Command Line Interface" @@ -934,18 +953,23 @@ msgid "" "The :mod:`json.tool` module provides a simple command line interface to " "validate and pretty-print JSON objects." msgstr "" +":mod:`json.tool` 模組提供了一個簡易的命令列界面以供校驗與美化呈現 JSON 物件。" #: ../../library/json.rst:685 msgid "" "If the optional ``infile`` and ``outfile`` arguments are not specified, :" "data:`sys.stdin` and :data:`sys.stdout` will be used respectively:" msgstr "" +"如果沒有指定可選參數 ``infile`` 和 ``outfile`` ,則 :data:`sys.stdin` 和 :" +"data:`sys.stdout` 各自為預設值。" #: ../../library/json.rst:697 msgid "" "The output is now in the same order as the input. Use the :option:`--sort-" "keys` option to sort the output of dictionaries alphabetically by key." msgstr "" +"現在開始輸出和輸入的資料順序會是相同的。傳入 :option:`--sort-keys` 參數以按照" +"鍵值的字母順序對輸出進行排序。" #: ../../library/json.rst:704 msgid "Command line options" @@ -953,39 +977,41 @@ msgstr "命令列選項" #: ../../library/json.rst:708 msgid "The JSON file to be validated or pretty-printed:" -msgstr "" +msgstr "被用於校驗或美化呈現的 JSON 文件:" #: ../../library/json.rst:724 msgid "If *infile* is not specified, read from :data:`sys.stdin`." -msgstr "" +msgstr "如果沒有指定 *infile* 則會從 :data:`sys.stdin` 讀取輸入。" #: ../../library/json.rst:728 msgid "" "Write the output of the *infile* to the given *outfile*. Otherwise, write it " "to :data:`sys.stdout`." msgstr "" +"將 *infile* 的結果寫入到給定的 *outfile*。若未提供則寫入到:data:`sys." +"stdout`。" #: ../../library/json.rst:733 msgid "Sort the output of dictionaries alphabetically by key." -msgstr "" +msgstr "按照鍵值的字母順序對輸出字典進行排序。" #: ../../library/json.rst:739 msgid "" "Disable escaping of non-ascii characters, see :func:`json.dumps` for more " "information." -msgstr "" +msgstr "關閉非 ASCII 字元的自動轉義功能。詳情請參照 :func:`json.dumps`。" #: ../../library/json.rst:745 msgid "Parse every input line as separate JSON object." -msgstr "" +msgstr "將每一行輸入都單獨輸出為一個 JSON 物件。" #: ../../library/json.rst:751 msgid "Mutually exclusive options for whitespace control." -msgstr "" +msgstr "互斥的空白字元控制選項。" #: ../../library/json.rst:757 msgid "Show the help message." -msgstr "" +msgstr "顯示說明訊息。" #: ../../library/json.rst:761 msgid "Footnotes" @@ -998,3 +1024,7 @@ msgid "" "and U+2029 (PARAGRAPH SEPARATOR) characters in strings, whereas JavaScript " "(as of ECMAScript Edition 5.1) does not." msgstr "" +"如 `RFC 7159 更正 `_ " +"所述,JSON 允許字串中出現 U+2028(行分隔符)和 U+2029(段落分隔符)字元,而 " +"JavaScript(截至 ECMAScript 5.1 版)則不允許。\n" +"`" From dad189851b7e87202e5929184a7cd9e1ad8b16fc Mon Sep 17 00:00:00 2001 From: "Raynor@GullU" Date: Sat, 10 Aug 2024 01:37:51 +0800 Subject: [PATCH 14/18] docs(library/json.po): Completly translated and refined closes #942 --- library/json.po | 131 ++++++++++++++++++++++++------------------------ 1 file changed, 65 insertions(+), 66 deletions(-) diff --git a/library/json.po b/library/json.po index 5961aae2fa..5daddf1ba3 100644 --- a/library/json.po +++ b/library/json.po @@ -84,11 +84,11 @@ msgstr "自訂特殊的 JSON 解碼方式: ::" #: ../../library/json.rst:90 msgid "Extending :class:`JSONEncoder`::" -msgstr "在 :class:`JSONEncoder` 裡自行擴充額外的編碼方法: ::" +msgstr "繼承 :class:`JSONEncoder` 類別並自行擴充額外的編碼方法: ::" #: ../../library/json.rst:108 msgid "Using :mod:`json.tool` from the shell to validate and pretty-print:" -msgstr "在命令列介面裡使用 :mod:`json.tool` 來驗證 JSON 語法和美化" +msgstr "在命令列介面裡使用 :mod:`json.tool` 來驗證 JSON 語法和美化呈現方式:" #: ../../library/json.rst:119 msgid "See :ref:`json-commandline` for detailed documentation." @@ -112,7 +112,7 @@ msgid "" "default. Order is only lost if the underlying containers are unordered." msgstr "" "這個模組的編、解碼器預設會保存輸入與輸出資料的順序關係,除非一開始的輸入本身" -"就是無序的。(例如集合 :class:`set`)" +"就是無序的。(例如集合)" #: ../../library/json.rst:135 msgid "Basic Usage" @@ -136,7 +136,7 @@ msgid "" msgstr "" "如果 *skipkeys* 被設為 true(預設值:``False``),那麼非基本型別(:class:" "`str`,:class:`int`,:class:`float`,:class:`bool`,``None``)的 dictionary" -"(字典)鍵值將被略過,而不會引發 :exc:`TypeError`。" +"(字典)鍵值將被略過而不會引發 :exc:`TypeError`。" #: ../../library/json.rst:150 msgid "" @@ -144,7 +144,7 @@ msgid "" "`bytes` objects. Therefore, ``fp.write()`` must support :class:`str` input." msgstr "" ":mod:`json` 模組總是產生 :class:`str` 物件,而非 :class:`bytes` 物件。因此," -"``fp.write()`` 必須支援 :class:`str` 的輸入。" +"``fp.write()`` 必須支援 :class:`str` 輸入。" #: ../../library/json.rst:154 ../../library/json.rst:433 msgid "" @@ -162,7 +162,7 @@ msgid "" "will result in a :exc:`RecursionError` (or worse)." msgstr "" "如果 *check_circular* 設為 false(預設是 ``True``),則針對不同容器型別的循環" -"參照 (circular reference) 的檢查將會被跳過,若有循環參照則最後將引發 :exc:" +"參照 (circular reference) 檢查將會被跳過,若有循環參照則最後將引發 :exc:" "`RecursionError` (或其他更糟的錯誤)。" #: ../../library/json.rst:162 @@ -173,9 +173,9 @@ msgid "" "*allow_nan* is true, their JavaScript equivalents (``NaN``, ``Infinity``, ``-" "Infinity``) will be used." msgstr "" -"如果 *allow_nan* 為 false(預設值:``True``\\ ),則串列化超出嚴格 JSON 規範" -"之範圍的 :class:`float` 值 (``nan``, ``inf``, ``-inf``) 會引發 :exc:" -"`ValueError`。如果 *allow_nan* 為 true,則將使用它們的 JavaScript 等效項 " +"如果 *allow_nan* 為 false(預設值:``True``\\ ),則串列化不符合嚴格 JSON 規" +"範的 :class:`float` 值 (``nan``, ``inf``, ``-inf``) 會引發 :exc:" +"`ValueError`。如果 *allow_nan* 為 true,則將使用它們的 JavaScript 等效表示 " "(``NaN``, ``Infinity``, ``-Infinity``)。" #: ../../library/json.rst:168 ../../library/json.rst:452 @@ -188,9 +188,9 @@ msgid "" "``\"\\t\"``), that string is used to indent each level." msgstr "" "如果 *indent* 是非負整數或字串,則 JSON 陣列元素和物件成員將使用該縮排等級進" -"行漂亮列印。縮排等級 0、負數或 ``\"\"`` 只會插入換行符號。``None``\\ (預設" -"值)選擇最緊湊的表示法。使用正整數縮排可以在每層縮排數量相同的空格。如果 " -"*indent* 是一個字串(例如 ``\"\\t\"``\\ ),則該字串用於縮排每個層級。" +"行格式美化。縮排等級 0、負數或 ``\"\"`` 只會插入換行符號。``None``\\ (預設" +"值)等於是選擇最緊湊的表示法。使用正整數縮排可以在每層縮排數量相同的空格。如" +"果 *indent* 是一個字串(例如 ``\"\\t\"``\\ ),則該字串用於縮排每個層級。" #: ../../library/json.rst:175 ../../library/json.rst:459 msgid "Allow strings for *indent* in addition to integers." @@ -204,13 +204,13 @@ msgid "" "specify ``(',', ':')`` to eliminate whitespace." msgstr "" "如果有指定本參數,*separators* 應該是一個 ``(item_separator, " -"key_separator)`` 元組。如果 *indent* 為 ``None`` 則預設為 ``(', ', ': ')``," -"否則預設為 ``(',', ': ')``。想要獲得最緊湊的 JSON 表示形式,你應該指定 " -"``(',', ':')`` 來消除空格。" +"key_separator)`` 二元組。如果 *indent* 為 ``None`` 則預設為 ``(', ', ': " +"')``,否則預設為 ``(',', ': ')``。想要獲得最緊湊的 JSON 表示形式,你可以改成" +"指定 ``(',', ':')`` 來消除尾隨的空格。" #: ../../library/json.rst:183 ../../library/json.rst:467 msgid "Use ``(',', ': ')`` as default if *indent* is not ``None``." -msgstr "如果 *indent* 不是 ``None``,則使用 ``(',', ': ')`` 當預設值" +msgstr "如果 *indent* 不是 ``None``,則使用 ``(',', ': ')`` 作為預設值" #: ../../library/json.rst:186 ../../library/json.rst:470 msgid "" @@ -219,16 +219,16 @@ msgid "" "version of the object or raise a :exc:`TypeError`. If not specified, :exc:" "`TypeError` is raised." msgstr "" -"如果有指定本參數,*default* 應該是一個為無法串列化的物件呼叫的函式。它應該傳" -"回物件的 JSON 可編碼版本或引發 :exc:`TypeError`。如果未指定,則會引發 :exc:" -"`TypeError`。" +"如果有指定本參數,*default* 會是一個遭遇無法串列化的物件時會被呼叫的函式。它" +"應該傳回該物件的 JSON 可編碼版本或引發 :exc:`TypeError`。如果未指定,則會直接" +"引發 :exc:`TypeError`。" #: ../../library/json.rst:191 msgid "" "If *sort_keys* is true (default: ``False``), then the output of dictionaries " "will be sorted by key." msgstr "" -"如果 *sort_keys* 為 true(預設值:``False``),則字典的輸出將按鍵排序。" +"如果 *sort_keys* 為 true(預設值:``False``),則字典的輸出將按鍵值排序。" #: ../../library/json.rst:194 msgid "" @@ -236,9 +236,9 @@ msgid "" "meth:`~JSONEncoder.default` method to serialize additional types), specify " "it with the *cls* kwarg; otherwise :class:`JSONEncoder` is used." msgstr "" -"若要使用自訂 :class:`JSONEncoder` 子類別(例如覆寫 :meth:`~JSONEncoder." -"default` 方法來串列化其他型別的子類別),請使用關鍵字參數 *cls* 指定它;否則" -"使用 :class:`JSONEncoder`。" +"若要使用繼承自 :class:`JSONEncoder` 的自訂子類別(例如覆寫 :meth:" +"`~JSONEncoder.default` 方法來串列化其他型別的一個子類別物件),請使用關鍵字參" +"數 *cls* 指定該類別物件;否則預設使用 :class:`JSONEncoder`。" #: ../../library/json.rst:198 ../../library/json.rst:277 msgid "" @@ -246,18 +246,18 @@ msgid "" msgstr "" "所有可選參數現在都是\\ :ref:`僅限關鍵字 `\\ 參數了。" +# SkyLull: 我想這裡的 "framed protocol" 指的是 +# https://peps.python.org/pep-3154/#framing #: ../../library/json.rst:203 msgid "" "Unlike :mod:`pickle` and :mod:`marshal`, JSON is not a framed protocol, so " "trying to serialize multiple objects with repeated calls to :func:`dump` " "using the same *fp* will result in an invalid JSON file." msgstr "" -"與 :mod:`pickle` 和 :mod:`marshal` 不同,JSON 沒有二進位分框的協定,因此嘗試" -"重複呼叫 :func:`dump` 來串列化多個物件到同一個 *fp* 裡將導致無效的 JSON 檔" -"案。" +"與 :mod:`pickle` 和 :mod:`marshal` 不同,JSON 不具有二進位分框(binary " +"framed)的協定,因此嘗試重複呼叫 :func:`dump` 來串列化多個物件到同一個 *fp* " +"裡將導致無效的 JSON 檔案。" -# SkyLull: 我想這裡的 "framed protocol" 指的是 -# https://peps.python.org/pep-3154/#framing #: ../../library/json.rst:212 msgid "" "Serialize *obj* to a JSON formatted :class:`str` using this :ref:`conversion " @@ -349,9 +349,9 @@ msgid "" "integer string via the interpreter's :ref:`integer string conversion length " "limitation ` to help avoid denial of service attacks." msgstr "" -":func:`int` 預設的 *parse_int* 現在有限制整數字串的長度上限了,限制由直譯器的" -"\\ :ref:`整數字串轉換長度限制 `\\ 機制來達成,這能防止阻" -"斷服務攻擊 (denial of service attacks)。" +"預設 *parse_int* 使用的 :func:`int` 函數現在有限制整數字串的長度上限了,限制" +"由直譯器的\\ :ref:`整數字串轉換長度限制 `\\ 機制來達成," +"這能防止阻斷服務攻擊 (Denial of Service attacks)。" #: ../../library/json.rst:262 ../../library/json.rst:361 msgid "" @@ -359,14 +359,15 @@ msgid "" "strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``. This can be used to " "raise an exception if invalid JSON numbers are encountered." msgstr "" -"如有給定 *parse_constant* 的話,在解碼時若遭遇以下字串 ``'-Infinity'``、" +"如有給定 *parse_constant* 的話,在解碼時若遭遇字串 ``'-Infinity'``、" "``'Infinity'`` 或 ``'NaN'`` 其中之一則會改用這個參數給定的函數來進行解碼。這" "也可用於使解碼過程中遇到無效的 JSON 數字時引發一個例外。" #: ../../library/json.rst:267 msgid "*parse_constant* doesn't get called on 'null', 'true', 'false' anymore." msgstr "" -"遭遇 'null'、 'true'、 'false' 時不再以 *parse_constant* 給定的函數來處理了。" +"遭遇 'null'、 'true' 或 'false' 時不再以 *parse_constant* 給定的函數來處理" +"了。" #: ../../library/json.rst:270 msgid "" @@ -376,7 +377,7 @@ msgid "" msgstr "" "若想要使用自定義的 :class:`JSONDecoder` 子類別物件,請以 ``cls`` 關鍵字參數指" "定之,否則將使用預設的 :class:`JSONDecoder`。其他未使用到的關鍵字參數將繼續傳" -"入給 :class:`JSONDecoder` 的建構函數使用。" +"入給 JSONDecoder 的建構函數使用。" #: ../../library/json.rst:274 ../../library/json.rst:292 #: ../../library/json.rst:371 @@ -414,8 +415,8 @@ msgid "" "*s* can now be of type :class:`bytes` or :class:`bytearray`. The input " "encoding should be UTF-8, UTF-16 or UTF-32." msgstr "" -"現在,*s* 可以是一個\\ :term:`二進位檔案 `\\ ,前提是其編碼格式" -"為 UTF-8、UTF-16 或 UTF-32。" +"現在,*s* 可以是一個二進位檔案如 :class:`bytes` 或 :class:`bytearray`,前提是" +"其編碼格式為 UTF-8、UTF-16 或 UTF-32。" #: ../../library/json.rst:299 msgid "The keyword argument *encoding* has been removed." @@ -467,7 +468,7 @@ msgstr "str" #: ../../library/json.rst:323 msgid "number (int)" -msgstr "number (int)" +msgstr "number (整數)" #: ../../library/json.rst:323 msgid "int" @@ -510,8 +511,8 @@ msgid "" "It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their " "corresponding ``float`` values, which is outside the JSON spec." msgstr "" -"雖然 ``NaN``、``Infinity`` 和 ``-Infinity`` 並不符合 JSON 規範,解碼器依然能" -"正確的將其對應到相應的 Python ``float`` 值。" +"雖然 ``NaN``、``Infinity`` 和 ``-Infinity`` 並不符合 JSON 規範,但解碼器依然" +"能正確地將其轉換到相應的 Python ``float`` 值。" #: ../../library/json.rst:337 msgid "" @@ -522,8 +523,8 @@ msgid "" msgstr "" "*object_hook* 是一個可選參數,其接受一個函數作為輸入。原始的字串解碼結果(一" "個 :class:`dict`\\ )將被傳入這個函數、並使用 *object_hook* 的回傳值來取代原" -"先的 :class:`dict` 輸出。此功能可用於實作自訂義解碼器(例如 `JSON-RPC " -"`_ 類別提示)。" +"先的 dict 輸出。此功能可用於實作自訂義解碼器(例如 `JSON-RPC `_ 類別提示)。" #: ../../library/json.rst:342 msgid "" @@ -559,8 +560,7 @@ msgid "" "Return the Python representation of *s* (a :class:`str` instance containing " "a JSON document)." msgstr "" -"返回用 Python 方式表達的 *s*(一個含有 JSON 文件的 :class:`str` 實例" -"(instance))" +"返回用 Python 型式表達的 *s* (一個含有 JSON 文件的 :class:`str` 實例)。" #: ../../library/json.rst:382 msgid "" @@ -615,8 +615,8 @@ msgid "" "superclass implementation (to raise :exc:`TypeError`)." msgstr "" "若要擴充此功能來識別其他物件,請繼承並實作一個 :meth:`~JSONEncoder.default` " -"方法。此方法應回傳一個可序列化的 ``o`` 物件,否則此方法應呼叫父類別的 :meth:" -"`~JSONEncoder.default` 方法(以拋出 :exc:`TypeError` 例外)。" +"方法。此方法應回傳一個可序列化的 ``o`` 物件,否則此方法應呼叫父類別的 " +"JSONEncoder.default 方法(以拋出 :exc:`TypeError` 例外)。" #: ../../library/json.rst:429 msgid "" @@ -739,9 +739,9 @@ msgid "" "parameters other than those explicitly mentioned, are not considered." msgstr "" "JSON 格式是由 :rfc:`7159` 和 `ECMA-404 ` 規範的。本節詳細說明了本模組" -"對 RFC 的遵循程度。簡單起見,:class:`JSONEncoder` 和 :class:`JSONDecoder` 子" -"類別以及未明確提及的參數將不予考慮。" +"publications-and-standards/standards/ecma-404/>`_ 規範的。本節詳細說明了本模" +"組對 RFC 的遵循程度。簡單起見,:class:`JSONEncoder` 和 :class:`JSONDecoder` " +"子類別以及未明確提及的參數將不予討論。" #: ../../library/json.rst:556 msgid "" @@ -862,8 +862,8 @@ msgid "" "but the last name-value pair for a given name::" msgstr "" "RFC 規範僅表明 JSON 物件中的名字應該是唯一的,但沒有強制要求如何處理重複的名" -"字。預設情況下,這個模組不會引發例外;相反的,它會忽略該名字的所有重複鍵值" -"對,只保留最後一個: ::" +"字。預設情況下,本模組不會因此引發例外;相反的,它會忽略該名字的所有重複鍵值" +"對,並只保留最後一個: ::" #: ../../library/json.rst:630 msgid "The *object_pairs_hook* parameter can be used to alter this behavior." @@ -882,10 +882,10 @@ msgid "" "this module does not and has never implemented that restriction in either " "its serializer or its deserializer." msgstr "" -"由已廢棄的 :rfc:`4627` 規範的舊版 JSON 要求 JSON 文字的頂層值必須是 JSON 物件" -"或陣列(Python :class:`dict` 或 :class:`list`),而且不能是 JSON 的 null、" -"boolean、數字或字串值。 :rfc:`7159` 移除了這個限制,而此模組在其串列化器或去" -"串列化器中也未曾實施過該限制。" +"由已廢棄的 :rfc:`4627` 所規範的舊版 JSON 要求 JSON 文字的頂層值必須是 JSON 物" +"件或陣列(Python :class:`dict` 或 :class:`list`),而且不能是 JSON 的 null、" +"boolean、數字或字串值。 :rfc:`7159` 移除了這個限制,而本模組的串列化器或去串" +"列化器中未曾實施過該限制。" #: ../../library/json.rst:643 msgid "" @@ -922,8 +922,8 @@ msgid "" "This module does not impose any such limits beyond those of the relevant " "Python datatypes themselves or the Python interpreter itself." msgstr "" -"這個模組本身不會設定任何此類限制,除了 Python 資料型態本身或 Python 直譯器本" -"身的限制。" +"本模組除了 Python 資料型態本身或 Python 直譯器本身的限制以外,不會設定任何此" +"類限制。" #: ../../library/json.rst:660 msgid "" @@ -935,10 +935,10 @@ msgid "" "magnitude, or when serializing instances of \"exotic\" numerical types such " "as :class:`decimal.Decimal`." msgstr "" -"串列化為 JSON 時,要注意可能會使用該 JSON 的應用程式中的相關限制。特別要注意" -"的是,JSON 數字常會被去串列化為 IEEE 754 雙精度浮點數(double),並因而受到其" -"表示範圍和精度限制的影響。這在序列化極大的 Python :class:`int` 數值、或是序列" -"化特殊數字型別(例如 :class:`decimal.Decimal`)實例時尤其重要。" +"將資料串列化為 JSON 時,要注意可能會使用該 JSON 輸出的應用程式中的相關限制。" +"特別要注意的是,JSON 數字常會被去串列化為 IEEE 754 雙精度浮點數(double),並" +"因而受到其表示範圍和精度限制的影響。這在序列化極大的 Python :class:`int` 數" +"值、或是序列化特殊數字型別的實例時(例如 :class:`decimal.Decimal`)尤其重要。" #: ../../library/json.rst:673 msgid "Command Line Interface" @@ -961,7 +961,7 @@ msgid "" "data:`sys.stdin` and :data:`sys.stdout` will be used respectively:" msgstr "" "如果沒有指定可選參數 ``infile`` 和 ``outfile`` ,則 :data:`sys.stdin` 和 :" -"data:`sys.stdout` 各自為預設值。" +"data:`sys.stdout` 將各自做為輸入和輸出的預設值。" #: ../../library/json.rst:697 msgid "" @@ -977,7 +977,7 @@ msgstr "命令列選項" #: ../../library/json.rst:708 msgid "The JSON file to be validated or pretty-printed:" -msgstr "被用於校驗或美化呈現的 JSON 文件:" +msgstr "將被用於校驗或美化呈現的 JSON 文件:" #: ../../library/json.rst:724 msgid "If *infile* is not specified, read from :data:`sys.stdin`." @@ -988,8 +988,8 @@ msgid "" "Write the output of the *infile* to the given *outfile*. Otherwise, write it " "to :data:`sys.stdout`." msgstr "" -"將 *infile* 的結果寫入到給定的 *outfile*。若未提供則寫入到:data:`sys." -"stdout`。" +"將 *infile* 的結果寫入到給定的 *outfile*。若未提供則寫入到 :data:`sys." +"stdout`\\ 。" #: ../../library/json.rst:733 msgid "Sort the output of dictionaries alphabetically by key." @@ -1026,5 +1026,4 @@ msgid "" msgstr "" "如 `RFC 7159 更正 `_ " "所述,JSON 允許字串中出現 U+2028(行分隔符)和 U+2029(段落分隔符)字元,而 " -"JavaScript(截至 ECMAScript 5.1 版)則不允許。\n" -"`" +"JavaScript(截至 ECMAScript 5.1 版)則不允許。" From f8211d2acbc7d4fea05c117152e599e382ae8fcc Mon Sep 17 00:00:00 2001 From: "Raynor@GullU" Date: Sat, 10 Aug 2024 23:39:30 +0800 Subject: [PATCH 15/18] docs(library/json.po): part of the review1 fixes --- library/json.po | 72 ++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/library/json.po b/library/json.po index 5daddf1ba3..51a5d9f0af 100644 --- a/library/json.po +++ b/library/json.po @@ -104,7 +104,7 @@ msgstr "" "JSON 語法是 `YAML `_ 1.2 語法的一種子集合。所以如果使用預" "設的設定的話(準確來說,使用預設的 *separators* 分隔符設定的話),這個模組的" "輸出也符合 YAML 1.0 和 1.1 的子集合規範。因此你也可以利用這個模組來當作 YAML " -"的串列化工具(serializer)。" +"的序列化工具(serializer)。" #: ../../library/json.rst:130 msgid "" @@ -112,7 +112,7 @@ msgid "" "default. Order is only lost if the underlying containers are unordered." msgstr "" "這個模組的編、解碼器預設會保存輸入與輸出資料的順序關係,除非一開始的輸入本身" -"就是無序的。(例如集合)" +"就是無序的。" #: ../../library/json.rst:135 msgid "Basic Usage" @@ -124,8 +124,8 @@ msgid "" "supporting :term:`file-like object`) using this :ref:`conversion table `." msgstr "" -"參考這個\\ :ref:`轉換表 `\\ 將 *obj* 串列化為符合 JSON 格式" -"的字串流,並寫入到 *fp* (一個支援 ``.write()`` 方法的 :term:`file-like " +"參考這個\\ :ref:`轉換表 `\\ 將 *obj* 序列化為符合 JSON 格式" +"的串流,並寫入到 *fp* (一個支援 ``.write()`` 方法的 :term:`file-like " "object`)" #: ../../library/json.rst:146 @@ -135,7 +135,7 @@ msgid "" "``None``) will be skipped instead of raising a :exc:`TypeError`." msgstr "" "如果 *skipkeys* 被設為 true(預設值:``False``),那麼非基本型別(:class:" -"`str`,:class:`int`,:class:`float`,:class:`bool`,``None``)的 dictionary" +"`str`、:class:`int`、:class:`float`、:class:`bool`、``None``)的 dictionary" "(字典)鍵值將被略過而不會引發 :exc:`TypeError`。" #: ../../library/json.rst:150 @@ -173,7 +173,7 @@ msgid "" "*allow_nan* is true, their JavaScript equivalents (``NaN``, ``Infinity``, ``-" "Infinity``) will be used." msgstr "" -"如果 *allow_nan* 為 false(預設值:``True``\\ ),則串列化不符合嚴格 JSON 規" +"如果 *allow_nan* 為 false(預設值:``True``\\ ),則序列化不符合嚴格 JSON 規" "範的 :class:`float` 值 (``nan``, ``inf``, ``-inf``) 會引發 :exc:" "`ValueError`。如果 *allow_nan* 為 true,則將使用它們的 JavaScript 等效表示 " "(``NaN``, ``Infinity``, ``-Infinity``)。" @@ -203,7 +203,7 @@ msgid "" "': ')`` otherwise. To get the most compact JSON representation, you should " "specify ``(',', ':')`` to eliminate whitespace." msgstr "" -"如果有指定本參數,*separators* 應該是一個 ``(item_separator, " +"如果有指定本引數內容,*separators* 應該是一個 ``(item_separator, " "key_separator)`` 二元組。如果 *indent* 為 ``None`` 則預設為 ``(', ', ': " "')``,否則預設為 ``(',', ': ')``。想要獲得最緊湊的 JSON 表示形式,你可以改成" "指定 ``(',', ':')`` 來消除尾隨的空格。" @@ -219,8 +219,8 @@ msgid "" "version of the object or raise a :exc:`TypeError`. If not specified, :exc:" "`TypeError` is raised." msgstr "" -"如果有指定本參數,*default* 會是一個遭遇無法串列化的物件時會被呼叫的函式。它" -"應該傳回該物件的 JSON 可編碼版本或引發 :exc:`TypeError`。如果未指定,則會直接" +"如果有指定本參數,*default* 會是一個遭遇無法序列化的物件時會被呼叫的函式。它" +"應該回傳該物件的 JSON 可編碼版本或引發 :exc:`TypeError`。如果未指定,則會直接" "引發 :exc:`TypeError`。" #: ../../library/json.rst:191 @@ -237,7 +237,7 @@ msgid "" "it with the *cls* kwarg; otherwise :class:`JSONEncoder` is used." msgstr "" "若要使用繼承自 :class:`JSONEncoder` 的自訂子類別(例如覆寫 :meth:" -"`~JSONEncoder.default` 方法來串列化其他型別的一個子類別物件),請使用關鍵字參" +"`~JSONEncoder.default` 方法來序列化其他型別的一個子類別物件),請使用關鍵字參" "數 *cls* 指定該類別物件;否則預設使用 :class:`JSONEncoder`。" #: ../../library/json.rst:198 ../../library/json.rst:277 @@ -255,7 +255,7 @@ msgid "" "using the same *fp* will result in an invalid JSON file." msgstr "" "與 :mod:`pickle` 和 :mod:`marshal` 不同,JSON 不具有二進位分框(binary " -"framed)的協定,因此嘗試重複呼叫 :func:`dump` 來串列化多個物件到同一個 *fp* " +"framed)的協定,因此嘗試重複呼叫 :func:`dump` 來序列化多個物件到同一個 *fp* " "裡將導致無效的 JSON 檔案。" #: ../../library/json.rst:212 @@ -264,8 +264,8 @@ msgid "" "table `. The arguments have the same meaning as in :func:" "`dump`." msgstr "" -"使用此\\ :ref:`轉換表 `\\ 來將 *obj* 串列化為 JSON 格式 :" -"class:`str`。這個參數的作用與 :func:`dump` 中的同名參數意義相同。" +"使用此\\ :ref:`轉換表 `\\ 來將 *obj* 序列化為 JSON 格式 :" +"class:`str`。這個引數的作用與 :func:`dump` 中的同名引數意義相同。" #: ../../library/json.rst:218 msgid "" @@ -288,7 +288,7 @@ msgid "" msgstr "" "使用此\\ :ref:`轉換表 `\\ 來將 *fp*\\ (一個支援 ``." "read()``、包含 JSON 文件的\\ :term:`文字檔案 `\\ 或\\ :term:`二進" -"位檔案 `\\ )去串列化為 Python 物件。" +"位檔案 `\\ )去序列化為 Python 物件。" #: ../../library/json.rst:231 msgid "" @@ -311,7 +311,7 @@ msgid "" "`dict`. This feature can be used to implement custom decoders. If " "*object_hook* is also defined, the *object_pairs_hook* takes priority." msgstr "" -"*object_pairs_hook* 是一個可選參數,其接受一個函數作為輸入。原始的有序對列表" +"*object_pairs_hook* 是一個可選參數,其接受一個函數作為輸入。原始的有序對串列" "(ordered list of pairs)解碼結果將被傳入這個函數、並使用 " "*object_pairs_hook* 的回傳值來取代原先的 :class:`dict` 輸出。此功能可用於實作" "自訂義解碼器。如果也同時給定了 *object_hook*,則 *object_pairs_hook* 優先。" @@ -375,7 +375,7 @@ msgid "" "kwarg; otherwise :class:`JSONDecoder` is used. Additional keyword arguments " "will be passed to the constructor of the class." msgstr "" -"若想要使用自定義的 :class:`JSONDecoder` 子類別物件,請以 ``cls`` 關鍵字參數指" +"若想要使用自定義的 :class:`JSONDecoder` 子類別物件,請以 ``cls`` 關鍵字引數指" "定之,否則將使用預設的 :class:`JSONDecoder`。其他未使用到的關鍵字參數將繼續傳" "入給 JSONDecoder 的建構函數使用。" @@ -385,7 +385,7 @@ msgid "" "If the data being deserialized is not a valid JSON document, a :exc:" "`JSONDecodeError` will be raised." msgstr "" -"如果被去串列化(deserialized)的資料不符合 JSON 格式,將會引發 :exc:" +"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引發 :exc:" "`JSONDecodeError` 例外。" #: ../../library/json.rst:280 @@ -404,11 +404,11 @@ msgid "" msgstr "" "使用\\ :ref:`轉換表 `\\ 將 *s* (一個含有 JSON 文件的 :" "class:`str`\\ 、\\ :class:`bytes` 或 :class:`bytearray` 的實例(instance))" -"去串列化(deserialize)為一個 Python 物件" +"去序列化(deserialize)為一個 Python 物件" #: ../../library/json.rst:290 msgid "The other arguments have the same meaning as in :func:`load`." -msgstr "其餘參數的使用方式與意義和 :func:`load` 的相同。" +msgstr "其餘引數的使用方式與意義和 :func:`load` 的相同。" #: ../../library/json.rst:295 msgid "" @@ -420,7 +420,7 @@ msgstr "" #: ../../library/json.rst:299 msgid "The keyword argument *encoding* has been removed." -msgstr "刪除關鍵字參數 *encoding*。" +msgstr "刪除關鍵字引數 *encoding*。" #: ../../library/json.rst:304 msgid "Encoders and Decoders" @@ -534,7 +534,7 @@ msgid "" "can be used to implement custom decoders. If *object_hook* is also defined, " "the *object_pairs_hook* takes priority." msgstr "" -"*object_pairs_hook* 是一個可選參數,其接受一個函數作為輸入。原始的有序對列表" +"*object_pairs_hook* 是一個可選參數,其接受一個函數作為輸入。原始的有序對串列" "(ordered list of pairs)解碼結果將被傳入這個函數、並使用 " "*object_pairs_hook* 的回傳值來取代原先的 :class:`dict` 輸出。此功能可用於實作" "自訂義解碼器。如果也同時給定了 *object_hook*,則 *object_pairs_hook* 優先。" @@ -635,7 +635,7 @@ msgid "" "prevent an infinite recursion (which would cause a :exc:`RecursionError`). " "Otherwise, no such check takes place." msgstr "" -"如果 *check_circular* 為 true(預設值),則會在編碼期間檢查列表(list)、字典" +"如果 *check_circular* 為 true(預設值),則會在編碼期間檢查串列(list)、字典" "(dict)和自定義編碼物件的循環參照,以防止無限遞迴(一個會導致 :exc:" "`RecursionError` 例外的問題)。否則不會進行此類檢查。" @@ -667,7 +667,7 @@ msgid "" "object for *o*, or calls the base implementation (to raise a :exc:" "`TypeError`)." msgstr "" -"在任意一個子類別裡實作這個方法時須讓其回傳一個可串列化的物件 *o* ,或呼叫原始" +"在任意一個子類別裡實作這個方法時須讓其回傳一個可序列化的物件 *o* ,或呼叫原始" "的實作以引發 :exc:`TypeError` 例外。" #: ../../library/json.rst:485 @@ -768,7 +768,7 @@ msgid "" "under default settings." msgstr "" "不過 RFC 准許遵循 RFC 的剖析器接受不合規的文字輸入,所以技術上來說若以預設設" -"定運作,本模組的去串列化器(deserializer)是符合 RFC 規範的。" +"定運作,本模組的去序列化器(deserializer)是符合 RFC 規範的。" #: ../../library/json.rst:568 msgid "Character Encodings" @@ -799,8 +799,8 @@ msgid "" "`, and thus does not otherwise directly address the issue of character " "encodings." msgstr "" -"除了 *ensure_ascii* 選項之外,本模組嚴格遵循 Python 物件與 :class:`Unicode " -"strings ` 之間的轉換規範,因此並不另外處理字元編碼的問題。" +"除了 *ensure_ascii* 選項參數之外,本模組嚴格遵循 Python 物件與 :class:" +"`Unicode strings ` 之間的轉換規範,因此並不另外處理字元編碼的問題。" #: ../../library/json.rst:582 msgid "" @@ -810,9 +810,9 @@ msgid "" "in their input. This module's deserializer raises a :exc:`ValueError` when " "an initial BOM is present." msgstr "" -"RFC 禁止在文件的開頭加上端序記號(BOM),因此本模組的串列化器(serializer)也" -"不會在輸出中加入端序記號。RFC 允許但不強制 JSON 去串列化器(deserializer)忽" -"略文件初始的端序記號,因此本模組的去串列化器將在遭遇位於文件開頭的端序記號時" +"RFC 禁止在文件的開頭加上端序記號(BOM),因此本模組的序列化器(serializer)也" +"不會在輸出中加入端序記號。RFC 允許但不強制 JSON 去序列化器(deserializer)忽" +"略文件初始的端序記號,因此本模組的去序列化器將在遭遇位於文件開頭的端序記號時" "引發 :exc:`ValueError` 例外。" #: ../../library/json.rst:588 @@ -847,7 +847,7 @@ msgid "" "behavior. In the deserializer, the *parse_constant* parameter can be used " "to alter this behavior." msgstr "" -"在串列化器中,*allow_nan* 參數可以改變這個行為。在去串列化器中," +"在序列化器中,*allow_nan* 參數可以改變這個行為。在去序列化器中," "*parse_constant* 參數可以改變這個行為。" #: ../../library/json.rst:619 @@ -884,7 +884,7 @@ msgid "" msgstr "" "由已廢棄的 :rfc:`4627` 所規範的舊版 JSON 要求 JSON 文字的頂層值必須是 JSON 物" "件或陣列(Python :class:`dict` 或 :class:`list`),而且不能是 JSON 的 null、" -"boolean、數字或字串值。 :rfc:`7159` 移除了這個限制,而本模組的串列化器或去串" +"boolean、數字或字串值。 :rfc:`7159` 移除了這個限制,而本模組的序列化器或去串" "列化器中未曾實施過該限制。" #: ../../library/json.rst:643 @@ -899,7 +899,7 @@ msgstr "實作限制" #: ../../library/json.rst:650 msgid "Some JSON deserializer implementations may set limits on:" -msgstr "某些 JSON 去串列化器的實作可能會造成下列限制:" +msgstr "某些 JSON 去序列化器的實作可能會造成下列限制:" #: ../../library/json.rst:652 msgid "the size of accepted JSON texts" @@ -935,8 +935,8 @@ msgid "" "magnitude, or when serializing instances of \"exotic\" numerical types such " "as :class:`decimal.Decimal`." msgstr "" -"將資料串列化為 JSON 時,要注意可能會使用該 JSON 輸出的應用程式中的相關限制。" -"特別要注意的是,JSON 數字常會被去串列化為 IEEE 754 雙精度浮點數(double),並" +"將資料序列化為 JSON 時,要注意可能會使用該 JSON 輸出的應用程式中的相關限制。" +"特別要注意的是,JSON 數字常會被去序列化為 IEEE 754 雙精度浮點數(double),並" "因而受到其表示範圍和精度限制的影響。這在序列化極大的 Python :class:`int` 數" "值、或是序列化特殊數字型別的實例時(例如 :class:`decimal.Decimal`)尤其重要。" @@ -960,7 +960,7 @@ msgid "" "If the optional ``infile`` and ``outfile`` arguments are not specified, :" "data:`sys.stdin` and :data:`sys.stdout` will be used respectively:" msgstr "" -"如果沒有指定可選參數 ``infile`` 和 ``outfile`` ,則 :data:`sys.stdin` 和 :" +"如果沒有指定可選引數 ``infile`` 和 ``outfile`` ,則 :data:`sys.stdin` 和 :" "data:`sys.stdout` 將各自做為輸入和輸出的預設值。" #: ../../library/json.rst:697 @@ -968,7 +968,7 @@ msgid "" "The output is now in the same order as the input. Use the :option:`--sort-" "keys` option to sort the output of dictionaries alphabetically by key." msgstr "" -"現在開始輸出和輸入的資料順序會是相同的。傳入 :option:`--sort-keys` 參數以按照" +"現在開始輸出和輸入的資料順序會是相同的。傳入 :option:`--sort-keys` 引數以按照" "鍵值的字母順序對輸出進行排序。" #: ../../library/json.rst:704 From 3658dc6bd6e0131448700809225a6f8e2a22d942 Mon Sep 17 00:00:00 2001 From: "Raynor@GullU" Date: Tue, 13 Aug 2024 11:34:11 +0800 Subject: [PATCH 16/18] docs(library/json.po): part of review 1 fixes --- library/json.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/json.po b/library/json.po index 51a5d9f0af..11621d69d5 100644 --- a/library/json.po +++ b/library/json.po @@ -206,7 +206,7 @@ msgstr "" "如果有指定本引數內容,*separators* 應該是一個 ``(item_separator, " "key_separator)`` 二元組。如果 *indent* 為 ``None`` 則預設為 ``(', ', ': " "')``,否則預設為 ``(',', ': ')``。想要獲得最緊湊的 JSON 表示形式,你可以改成" -"指定 ``(',', ':')`` 來消除尾隨的空格。" +"指定 ``(',', ':')`` 來消除空格。" #: ../../library/json.rst:183 ../../library/json.rst:467 msgid "Use ``(',', ': ')`` as default if *indent* is not ``None``." @@ -237,7 +237,7 @@ msgid "" "it with the *cls* kwarg; otherwise :class:`JSONEncoder` is used." msgstr "" "若要使用繼承自 :class:`JSONEncoder` 的自訂子類別(例如覆寫 :meth:" -"`~JSONEncoder.default` 方法來序列化其他型別的一個子類別物件),請使用關鍵字參" +"`~JSONEncoder.default` 方法來序列化其他型別的一個子類別物件),請使用關鍵字引" "數 *cls* 指定該類別物件;否則預設使用 :class:`JSONEncoder`。" #: ../../library/json.rst:198 ../../library/json.rst:277 @@ -376,7 +376,7 @@ msgid "" "will be passed to the constructor of the class." msgstr "" "若想要使用自定義的 :class:`JSONDecoder` 子類別物件,請以 ``cls`` 關鍵字引數指" -"定之,否則將使用預設的 :class:`JSONDecoder`。其他未使用到的關鍵字參數將繼續傳" +"定之,否則將使用預設的 :class:`JSONDecoder`。其他未使用到的關鍵字引數將繼續傳" "入給 JSONDecoder 的建構函數使用。" #: ../../library/json.rst:274 ../../library/json.rst:292 From 558305c93c6a672475c5053bc0183d4b777c5082 Mon Sep 17 00:00:00 2001 From: "Raynor@GullU" Date: Tue, 13 Aug 2024 14:30:24 +0800 Subject: [PATCH 17/18] docs(library/json.po): part of review 2 fixes --- library/json.po | 91 ++++++++++++++++++++++++------------------------- 1 file changed, 45 insertions(+), 46 deletions(-) diff --git a/library/json.po b/library/json.po index 11621d69d5..c1de230ff4 100644 --- a/library/json.po +++ b/library/json.po @@ -298,10 +298,10 @@ msgid "" "be used to implement custom decoders (e.g. `JSON-RPC `_ class hinting)." msgstr "" -"*object_hook* 是一個可選參數,其接受一個函數作為輸入。原始的字串解碼結果(一" -"個 :class:`dict`\\ )將被傳入這個函數、並使用 *object_hook* 的回傳值來取代原" -"先的 :class:`dict` 輸出。此功能可用於實作自訂義解碼器(例如 `JSON-RPC " -"`_ 類別提示)。" +"*object_hook* 是一個可選引數,其接受一個函式作為輸入。原始的字串解碼結果(一" +"個 :class:`dict`\\ )將被傳入這個函式、並使用 *object_hook* 的回傳值來取代原" +"先的 :class:`dict` 輸出。此功能可用於實作自訂解碼器(例如 `JSON-RPC `_ 類別提示)。" #: ../../library/json.rst:237 msgid "" @@ -311,10 +311,10 @@ msgid "" "`dict`. This feature can be used to implement custom decoders. If " "*object_hook* is also defined, the *object_pairs_hook* takes priority." msgstr "" -"*object_pairs_hook* 是一個可選參數,其接受一個函數作為輸入。原始的有序對串列" -"(ordered list of pairs)解碼結果將被傳入這個函數、並使用 " +"*object_pairs_hook* 是一個可選引數,其接受一個函式作為輸入。原始的有序對串列" +"(ordered list of pairs)解碼結果將被傳入這個函式、並使用 " "*object_pairs_hook* 的回傳值來取代原先的 :class:`dict` 輸出。此功能可用於實作" -"自訂義解碼器。如果也同時給定了 *object_hook*,則 *object_pairs_hook* 優先。" +"自訂解碼器。如果也同時給定了 *object_hook*,則 *object_pairs_hook* 優先。" #: ../../library/json.rst:243 ../../library/json.rst:348 msgid "Added support for *object_pairs_hook*." @@ -328,7 +328,7 @@ msgid "" "class:`decimal.Decimal`)." msgstr "" "如有給定 *parse_float* 的話,每個要被解碼的 JSON 浮點數字串都會改用這個參數給" -"定的函數來進行解碼。預設情況的浮點數剖析器等效於 ``float(num_str)``。這個參數" +"定的函式來進行解碼。預設情況的浮點數剖析器等效於 ``float(num_str)``。這個參數" "可用於將 JSON 中的浮點數解碼或剖析為另一種資料型別(例如 :class:`decimal." "Decimal`\\ )。" @@ -340,7 +340,7 @@ msgid "" "`float`)." msgstr "" "如有給定 *parse_int* 的話,每個要被解碼的 JSON 整數字串都會改用這個參數給定的" -"函數來進行解碼。預設情況的整數剖析器等效於 ``int(num_str)``。這個參數可用於" +"函式來進行解碼。預設情況的整數剖析器等效於 ``int(num_str)``。這個參數可用於" "將 JSON 中的整數解碼或剖析為另一種資料型別(例如 :class:`float`\\ )。" #: ../../library/json.rst:256 @@ -349,7 +349,7 @@ msgid "" "integer string via the interpreter's :ref:`integer string conversion length " "limitation ` to help avoid denial of service attacks." msgstr "" -"預設 *parse_int* 使用的 :func:`int` 函數現在有限制整數字串的長度上限了,限制" +"預設 *parse_int* 使用的 :func:`int` 函式現在有限制整數字串的長度上限了,限制" "由直譯器的\\ :ref:`整數字串轉換長度限制 `\\ 機制來達成," "這能防止阻斷服務攻擊 (Denial of Service attacks)。" @@ -360,14 +360,13 @@ msgid "" "raise an exception if invalid JSON numbers are encountered." msgstr "" "如有給定 *parse_constant* 的話,在解碼時若遭遇字串 ``'-Infinity'``、" -"``'Infinity'`` 或 ``'NaN'`` 其中之一則會改用這個參數給定的函數來進行解碼。這" +"``'Infinity'`` 或 ``'NaN'`` 其中之一則會改用這個參數給定的函式來進行解碼。這" "也可用於使解碼過程中遇到無效的 JSON 數字時引發一個例外。" #: ../../library/json.rst:267 msgid "*parse_constant* doesn't get called on 'null', 'true', 'false' anymore." msgstr "" -"遭遇 'null'、 'true' 或 'false' 時不再以 *parse_constant* 給定的函數來處理" -"了。" +"遭遇 'null'、'true' 或 'false' 時不再以 *parse_constant* 給定的函式來處理了。" #: ../../library/json.rst:270 msgid "" @@ -375,9 +374,9 @@ msgid "" "kwarg; otherwise :class:`JSONDecoder` is used. Additional keyword arguments " "will be passed to the constructor of the class." msgstr "" -"若想要使用自定義的 :class:`JSONDecoder` 子類別物件,請以 ``cls`` 關鍵字引數指" +"若想要使用自訂的 :class:`JSONDecoder` 子類別物件,請以 ``cls`` 關鍵字引數指" "定之,否則將使用預設的 :class:`JSONDecoder`。其他未使用到的關鍵字引數將繼續傳" -"入給 JSONDecoder 的建構函數使用。" +"入給 JSONDecoder 的建構函式使用。" #: ../../library/json.rst:274 ../../library/json.rst:292 #: ../../library/json.rst:371 @@ -393,8 +392,8 @@ msgid "" "*fp* can now be a :term:`binary file`. The input encoding should be UTF-8, " "UTF-16 or UTF-32." msgstr "" -"現在,*fp* 可以是一個\\ :term:`二進位檔案 `\\ ,前提是其編碼格式" -"為 UTF-8、UTF-16 或 UTF-32。" +"現在,*fp* 可以是一個\\ :term:`二進位檔案 `,前提是其編碼格式為 " +"UTF-8、UTF-16 或 UTF-32。" #: ../../library/json.rst:286 msgid "" @@ -403,8 +402,8 @@ msgid "" "`conversion table `." msgstr "" "使用\\ :ref:`轉換表 `\\ 將 *s* (一個含有 JSON 文件的 :" -"class:`str`\\ 、\\ :class:`bytes` 或 :class:`bytearray` 的實例(instance))" -"去序列化(deserialize)為一個 Python 物件" +"class:`str`、:class:`bytes` 或 :class:`bytearray` 的實例(instance))去序列" +"化(deserialize)為一個 Python 物件" #: ../../library/json.rst:290 msgid "The other arguments have the same meaning as in :func:`load`." @@ -521,10 +520,10 @@ msgid "" "class:`dict`. This can be used to provide custom deserializations (e.g. to " "support `JSON-RPC `_ class hinting)." msgstr "" -"*object_hook* 是一個可選參數,其接受一個函數作為輸入。原始的字串解碼結果(一" -"個 :class:`dict`\\ )將被傳入這個函數、並使用 *object_hook* 的回傳值來取代原" -"先的 dict 輸出。此功能可用於實作自訂義解碼器(例如 `JSON-RPC `_ 類別提示)。" +"*object_hook* 是一個可選引數,其接受一個函式作為輸入。原始的字串解碼結果(一" +"個 :class:`dict`\\ )將被傳入這個函式、並使用 *object_hook* 的回傳值來取代原" +"先的 dict 輸出。此功能可用於實作自訂的去序列化功能(例如 `JSON-RPC `_ 類別提示)。" #: ../../library/json.rst:342 msgid "" @@ -534,10 +533,10 @@ msgid "" "can be used to implement custom decoders. If *object_hook* is also defined, " "the *object_pairs_hook* takes priority." msgstr "" -"*object_pairs_hook* 是一個可選參數,其接受一個函數作為輸入。原始的有序對串列" -"(ordered list of pairs)解碼結果將被傳入這個函數、並使用 " +"*object_pairs_hook* 是一個可選引數,其接受一個函式作為輸入。原始的有序對串列" +"(ordered list of pairs)解碼結果將被傳入這個函式、並使用 " "*object_pairs_hook* 的回傳值來取代原先的 :class:`dict` 輸出。此功能可用於實作" -"自訂義解碼器。如果也同時給定了 *object_hook*,則 *object_pairs_hook* 優先。" +"自訂解碼器。如果也同時給定了 *object_hook*,則 *object_pairs_hook* 優先。" #: ../../library/json.rst:366 msgid "" @@ -548,19 +547,19 @@ msgid "" msgstr "" "如果 *strict* 被設為 false(預設值為 ``True``),那麼字串中將允許控制字元。此" "語境中的控制字元指的是 ASCII 字元編碼在 0~31 範圍內的字元,包括 ``'\\t'``" -"(tab 鍵)、``'\\n'``、``'\\r'`` 和 ``'\\0'``。" +"(tab)、``'\\n'``、``'\\r'`` 和 ``'\\0'``。" #: ../../library/json.rst:374 ../../library/json.rst:475 msgid "All parameters are now :ref:`keyword-only `." msgstr "" -"所有可選參數現在都是\\ :ref:`僅限關鍵字 `\\ 參數了。" +"所有參數現在都是\\ :ref:`僅限關鍵字參數 `\\ 了。" #: ../../library/json.rst:379 msgid "" "Return the Python representation of *s* (a :class:`str` instance containing " "a JSON document)." msgstr "" -"返回用 Python 型式表達的 *s* (一個含有 JSON 文件的 :class:`str` 實例)。" +"回傳用 Python 型式表達的 *s* (一個含有 JSON 文件的 :class:`str` 實例)。" #: ../../library/json.rst:382 msgid "" @@ -605,7 +604,7 @@ msgstr "number" #: ../../library/json.rst:421 msgid "Added support for int- and float-derived Enum classes." -msgstr "增加整數(int)和浮點數(float)格式的列舉序數(Enums)的支援性。" +msgstr "增加整數(int)和浮點數(float)格式的列舉序數(Enums)類別的支援性。" #: ../../library/json.rst:424 msgid "" @@ -616,7 +615,7 @@ msgid "" msgstr "" "若要擴充此功能來識別其他物件,請繼承並實作一個 :meth:`~JSONEncoder.default` " "方法。此方法應回傳一個可序列化的 ``o`` 物件,否則此方法應呼叫父類別的 " -"JSONEncoder.default 方法(以拋出 :exc:`TypeError` 例外)。" +"JSONEncoder.default 方法(以引發 :exc:`TypeError` 例外)。" #: ../../library/json.rst:429 msgid "" @@ -624,8 +623,8 @@ msgid "" "trying to encode keys that are not :class:`str`, :class:`int`, :class:" "`float` or ``None``. If *skipkeys* is true, such items are simply skipped." msgstr "" -"若 *skipkeys* 為 false(預設值),則當在編碼不是 :class:`str`,:class:" -"`int`,:class:`float` 或 ``None`` 的鍵值時,將引發 :exc:`TypeError`。如果 " +"若 *skipkeys* 為 false(預設值),則當在編碼不是 :class:`str`、:class:" +"`int`、:class:`float` 或 ``None`` 的鍵值時,將引發 :exc:`TypeError`。如果 " "*skipkeys* 為 true,這些項目將直接被跳過。" #: ../../library/json.rst:437 @@ -636,7 +635,7 @@ msgid "" "Otherwise, no such check takes place." msgstr "" "如果 *check_circular* 為 true(預設值),則會在編碼期間檢查串列(list)、字典" -"(dict)和自定義編碼物件的循環參照,以防止無限遞迴(一個會導致 :exc:" +"(dict)和自訂編碼物件的循環參照,以防止無限遞迴(一個會導致 :exc:" "`RecursionError` 例外的問題)。否則不會進行此類檢查。" #: ../../library/json.rst:442 @@ -695,8 +694,8 @@ msgid "" "Encode the given object, *o*, and yield each string representation as " "available. For example::" msgstr "" -"將物件 *o* 編碼,並將結果統整為一個能依序產生(yield)各結果字串的生成器物件" -"(generator)。如下例: ::" +"將物件 *o* 編碼,並將結果統整為一個能依序產生(yield)各結果字串的物件。如下" +"例: ::" #: ../../library/json.rst:518 msgid "Exceptions" @@ -720,15 +719,15 @@ msgstr "*doc* 剖析失敗處的起始點的索引值。" #: ../../library/json.rst:538 msgid "The line corresponding to *pos*." -msgstr "*pos* 所在的行數。" +msgstr "*pos* 所在的列(line)數。" #: ../../library/json.rst:542 msgid "The column corresponding to *pos*." -msgstr "*pos* 所在的列(column)數。" +msgstr "*pos* 所在的行(column)數。" #: ../../library/json.rst:548 msgid "Standard Compliance and Interoperability" -msgstr "合規性與互通性" +msgstr "合規性與互通性(Interoperability)" #: ../../library/json.rst:550 msgid "" @@ -810,10 +809,10 @@ msgid "" "in their input. This module's deserializer raises a :exc:`ValueError` when " "an initial BOM is present." msgstr "" -"RFC 禁止在文件的開頭加上端序記號(BOM),因此本模組的序列化器(serializer)也" -"不會在輸出中加入端序記號。RFC 允許但不強制 JSON 去序列化器(deserializer)忽" -"略文件初始的端序記號,因此本模組的去序列化器將在遭遇位於文件開頭的端序記號時" -"引發 :exc:`ValueError` 例外。" +"RFC 禁止在文件的開頭加上端序記號(Byte Order Mark),因此本模組的序列化器" +"(serializer)也不會在輸出中加入端序記號。RFC 允許但不強制 JSON 去序列化器" +"(deserializer)忽略文件初始的端序記號,因此本模組的去序列化器將在遭遇位於文" +"件開頭的端序記號時引發 :exc:`ValueError` 例外。" #: ../../library/json.rst:588 msgid "" @@ -852,7 +851,7 @@ msgstr "" #: ../../library/json.rst:619 msgid "Repeated Names Within an Object" -msgstr "物件內重複的鍵值名稱" +msgstr "物件內重複的名稱" #: ../../library/json.rst:621 msgid "" @@ -989,7 +988,7 @@ msgid "" "to :data:`sys.stdout`." msgstr "" "將 *infile* 的結果寫入到給定的 *outfile*。若未提供則寫入到 :data:`sys." -"stdout`\\ 。" +"stdout`\\。" #: ../../library/json.rst:733 msgid "Sort the output of dictionaries alphabetically by key." @@ -1025,5 +1024,5 @@ msgid "" "(as of ECMAScript Edition 5.1) does not." msgstr "" "如 `RFC 7159 更正 `_ " -"所述,JSON 允許字串中出現 U+2028(行分隔符)和 U+2029(段落分隔符)字元,而 " +"所述,JSON 允許字串中出現 U+2028(列分隔符)和 U+2029(段落分隔符)字元,而 " "JavaScript(截至 ECMAScript 5.1 版)則不允許。" From 874387ec35e5e0da3224ea0146edf31dd093e788 Mon Sep 17 00:00:00 2001 From: "Raynor@GullU" Date: Tue, 13 Aug 2024 16:08:26 +0800 Subject: [PATCH 18/18] docs(library/json.po): review 2 fixes --- library/json.po | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/library/json.po b/library/json.po index c1de230ff4..2042792d57 100644 --- a/library/json.po +++ b/library/json.po @@ -374,9 +374,9 @@ msgid "" "kwarg; otherwise :class:`JSONDecoder` is used. Additional keyword arguments " "will be passed to the constructor of the class." msgstr "" -"若想要使用自訂的 :class:`JSONDecoder` 子類別物件,請以 ``cls`` 關鍵字引數指" -"定之,否則將使用預設的 :class:`JSONDecoder`。其他未使用到的關鍵字引數將繼續傳" -"入給 JSONDecoder 的建構函式使用。" +"若想要使用自訂的 :class:`JSONDecoder` 子類別物件,請以 ``cls`` 關鍵字引數指定" +"之,否則將使用預設的 :class:`JSONDecoder`。其他未使用到的關鍵字引數將繼續傳入" +"給 JSONDecoder 的建構函式使用。" #: ../../library/json.rst:274 ../../library/json.rst:292 #: ../../library/json.rst:371 @@ -596,7 +596,8 @@ msgstr "list, tuple" #: ../../library/json.rst:412 msgid "int, float, int- & float-derived Enums" -msgstr "int, float, int 和 float 格式的 Enums" +msgstr "" +"int、float 或可作為整數或浮點數運算的衍生列舉(int- or float-derived Enums)" #: ../../library/json.rst:412 msgid "number" @@ -604,7 +605,9 @@ msgstr "number" #: ../../library/json.rst:421 msgid "Added support for int- and float-derived Enum classes." -msgstr "增加整數(int)和浮點數(float)格式的列舉序數(Enums)類別的支援性。" +msgstr "" +"增加對整數(int)、浮點數(float)或可作為整數或浮點數運算的衍生列舉(int- " +"or float-derived Enums)類別的支援性。" #: ../../library/json.rst:424 msgid "" @@ -683,12 +686,6 @@ msgid "" "example::" msgstr "回傳一個 Python 資料結構物件 *o* 的 JSON 的字串表示。例如: ::" -# 執行下列程式後能證明他的回傳物件是generator -# >>> import json -# >>> bigobject = list(range(100000)) -# >>> x = json.JSONEncoder().iterencode(bigobject) -# >>> print(x) -# ._iterencode at 0x7293c4b48bc0> #: ../../library/json.rst:510 msgid "" "Encode the given object, *o*, and yield each string representation as " @@ -988,7 +985,7 @@ msgid "" "to :data:`sys.stdout`." msgstr "" "將 *infile* 的結果寫入到給定的 *outfile*。若未提供則寫入到 :data:`sys." -"stdout`\\。" +"stdout`。" #: ../../library/json.rst:733 msgid "Sort the output of dictionaries alphabetically by key."