Skip to content

Commit 9c6ac56

Browse files
committed
docs(library/pickle.po): editing, up to line 362
1 parent e768ebe commit 9c6ac56

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

library/pickle.po

+34-2
Original file line numberDiff line numberDiff line change
@@ -215,16 +215,20 @@ msgid ""
215215
"Unlike pickle, deserializing untrusted JSON does not in itself create an "
216216
"arbitrary code execution vulnerability."
217217
msgstr ""
218+
"去序列化不安全的 JSON 不會產生任意程式執行的風險,但去序列化不安全的 pickle "
219+
"會。"
218220

219221
#: ../../library/pickle.rst:114
220222
msgid ""
221223
"The :mod:`json` module: a standard library module allowing JSON "
222224
"serialization and deserialization."
223225
msgstr ""
226+
":mod:`json` module: 是標準函式庫的一部分,可讓使用者進行 JSON 的序列化與去序"
227+
"列化。"
224228

225229
#: ../../library/pickle.rst:121
226230
msgid "Data stream format"
227-
msgstr ""
231+
msgstr "資料串流格式"
228232

229233
#: ../../library/pickle.rst:126
230234
msgid ""
@@ -234,53 +238,68 @@ msgid ""
234238
"that non-Python programs may not be able to reconstruct pickled Python "
235239
"objects."
236240
msgstr ""
241+
":mod:`pickle` 使用的資料格式是針對 Python 而設計的。好處是他不會受到外部標準"
242+
"(像是 JSON 或 XDR,而 XDR 無法紀錄指標共用)的限制;不過這也代表其他不是 "
243+
"Python 的程式可能無法重建 pickle 封裝的 Python 物件。"
237244

238245
#: ../../library/pickle.rst:131
239246
msgid ""
240247
"By default, the :mod:`pickle` data format uses a relatively compact binary "
241248
"representation. If you need optimal size characteristics, you can "
242249
"efficiently :doc:`compress <archiving>` pickled data."
243250
msgstr ""
251+
"以預設設定來說,:mod:`pickle` 使用相對緊湊的二進位形式來儲存資料。如果你需要"
252+
"盡可能地縮小檔案大小,你可以\\\\ :doc:`壓縮 <archiving>`\\\\ 封裝的資料。"
244253

245254
#: ../../library/pickle.rst:135
246255
msgid ""
247256
"The module :mod:`pickletools` contains tools for analyzing data streams "
248257
"generated by :mod:`pickle`. :mod:`pickletools` source code has extensive "
249258
"comments about opcodes used by pickle protocols."
250259
msgstr ""
260+
":mod:`pickletools` 含有工具可分析 :mod:`pickle` 所產生的資料流。:mod:"
261+
"`pickletools` 的源始碼詳細地記載了所有 pickle 協定的操作碼(opcode)。"
251262

252263
#: ../../library/pickle.rst:139
253264
msgid ""
254265
"There are currently 6 different protocols which can be used for pickling. "
255266
"The higher the protocol used, the more recent the version of Python needed "
256267
"to read the pickle produced."
257268
msgstr ""
269+
"截至目前為止,共有六種不同版本的協定可用於封裝 pickle。數字越大版本代表你需"
270+
"要使用越新的 Python 版本來拆封相應的 pickle 封裝。"
258271

259272
#: ../../library/pickle.rst:143
260273
msgid ""
261274
"Protocol version 0 is the original \"human-readable\" protocol and is "
262275
"backwards compatible with earlier versions of Python."
263276
msgstr ""
277+
"版本 0 的協定是最初「人類可讀」的版本,且可以向前支援早期版本的 Python。"
264278

265279
#: ../../library/pickle.rst:146
266280
msgid ""
267281
"Protocol version 1 is an old binary format which is also compatible with "
268282
"earlier versions of Python."
269-
msgstr ""
283+
msgstr "版本 1 的協定使用舊的二進位格式,一樣能向前支援早期版本的 Python。"
270284

271285
#: ../../library/pickle.rst:149
272286
msgid ""
273287
"Protocol version 2 was introduced in Python 2.3. It provides much more "
274288
"efficient pickling of :term:`new-style classes <new-style class>`. Refer "
275289
"to :pep:`307` for information about improvements brought by protocol 2."
276290
msgstr ""
291+
"版本 2 的協定在 Python 2.3 中初次被引入。其可提供更高效率的 :term:`new-style "
292+
"classes <new-style class>` 封裝過程。請參閱 :pep:`307` 以了解版本 2 帶來的改"
293+
"進。"
277294

278295
#: ../../library/pickle.rst:153
279296
msgid ""
280297
"Protocol version 3 was added in Python 3.0. It has explicit support for :"
281298
"class:`bytes` objects and cannot be unpickled by Python 2.x. This was the "
282299
"default protocol in Python 3.0--3.7."
283300
msgstr ""
301+
"版本 3 的協定在 Python 3.0 被新增。現在能支援封裝 :class:`bytes` 的物件且無法"
302+
"被 2.x 版本的 Python 拆封。在 3.0~3.7 的 Python 預設使用 3 版協定。"
284303

285304
#: ../../library/pickle.rst:157
286305
msgid ""
@@ -289,6 +308,9 @@ msgid ""
289308
"optimizations. It is the default protocol starting with Python 3.8. Refer "
290309
"to :pep:`3154` for information about improvements brought by protocol 4."
291310
msgstr ""
311+
"版本 4 的協定在 Python 3.4 被新增。現在能支援超大物件的封裝、更多種型別的物件"
312+
"以及針對部份資料格式的儲存進行最佳化。從 Python 3.8 起,預設使用第 4 版協定。"
313+
"請參閱 :pep:`3154` 以了解第 4 版協定改進的細節。"
292314

293315
#: ../../library/pickle.rst:163
294316
msgid ""
@@ -310,6 +332,12 @@ msgid ""
310332
"database. The :mod:`shelve` module provides a simple interface to pickle "
311333
"and unpickle objects on DBM-style database files."
312334
msgstr ""
335+
"資料序列化是一個比資料持久化更早期的概念;雖然 :mod:`pickle` 可以讀寫檔案物"
336+
"件,但它並不處理命名持久物件的問題,也不處理對持久物件並行存取,一個更棘手的"
337+
"問題。:mod:`pickle` 模組可以將複雜物件轉換成位元組串流,也可以將位元組串流轉"
338+
"換回具有相同原始內部結構的物件。對這些位元組串流最明顯的處理方式大概是將它們"
339+
"寫入檔案中,但也可能將它們透過網路傳送或儲存在一個資料庫中。:mod:`shelve` 模"
340+
"組提供了一個簡單的介面來在 DBM 風格的資料庫檔案中進行物件的封裝和拆封的操作。"
313341

314342
#: ../../library/pickle.rst:181
315343
msgid "Module Interface"
@@ -323,6 +351,10 @@ msgid ""
323351
"de-serialization, you can create a :class:`Pickler` or an :class:`Unpickler` "
324352
"object, respectively."
325353
msgstr ""
354+
"想要序列化一個物件,你只需要呼叫 :func:`dumps` 函數。而當你想要去序列化一個資"
355+
"料流時,你只需要呼叫 :func:`loads` 即可。不過,若你希望能各自對序列化和去序列"
356+
"化的過程中有更多的掌控度,你可以自訂一個 :class:`Pickler` 或 :class:"
357+
"`Unpickler` 物件。"
326358

327359
#: ../../library/pickle.rst:188
328360
msgid "The :mod:`pickle` module provides the following constants:"

0 commit comments

Comments
 (0)