Skip to content

Conversation

@SkyLull
Copy link
Contributor

@SkyLull SkyLull commented Sep 30, 2024

resolve #949

# 其中表示這名字很可能只是為了隨便找一個p開頭的單字、或原始開發人員的內部玩笑造成的約定俗成。也有人表示醃製黃瓜(pickle-
# ing)的目標就是保存和存放,所以取了這個名字。
# 無論如何似乎沒有一個定論。
# 因為不確定是否與醃漬的這個梗有關,我暫時選擇使用 `封裝` 與 `拆封` 作為譯文,大致保存那個把東西處裡後裝起來的感覺但又不至於太奇怪。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果不翻譯直接使用 pickle & unpickle 原文呢?會不會遇到什麼問題呢?
我覺得這個詞應該只有 Python 這樣使用、沒有通用翻譯,且對於已經理解 pickle 的人翻譯後可能還比較難聯想到原文是什麼,又有與其他詞混淆的可能,那我可能會傾向就不翻譯

Copy link
Contributor Author

@SkyLull SkyLull Oct 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我的主要考量是原文 pickle(或 unpickle) 同時可能被用作名詞或動詞,中文混合不翻譯的原文用詞的話、對於不熟悉英文者應該分辨不出來 pickle, pickled (unpickle, unpickled) 等字語意上的分別(或是分辨上比較吃力)。
我後面翻譯時(如果沒有寫到頭昏的話)大致上是原名詞時用原文,出現其他詞性或衍生字時( (un)picklable:505, pickling:63, pickled:240, pickler:661)用譯文以做出區別。

Copy link
Collaborator

@josix josix Oct 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

確實會容易有混淆的可能性~ 要翻譯的話我會比較傾向保留原始意義 "序列化" 而非 "封裝",不知道你們覺得如何~

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我主要是覺得他後面使用 pickle (作為動詞)的時機跟 serialize 的時機有微妙的差別。
pickle (作為動詞)是指整個模組的運作(包含了內部所有行為),serialize 則專指在二進位層級上的處裡。

例如:

pickle

#: ../../library/pickle.rst:149 msgid "" "Protocol version 2 was introduced in Python 2.3. It provides much more " "efficient pickling of :term:`new-style classes <new-style class>`. Refer " "to :pep:`307` for information about improvements brought by protocol 2." msgstr "" "版本 2 的協定在 Python 2.3 中初次被引入。其可提供更高效率的 :term:`new-style " "classes <new-style class>` 封裝過程。請參閱 :pep:`307` 以了解版本 2 帶來的改" "進。"
#: ../../library/pickle.rst:157 msgid "" "Protocol version 4 was added in Python 3.4. It adds support for very large " "objects, pickling more kinds of objects, and some data format " "optimizations. It is the default protocol starting with Python 3.8. Refer " "to :pep:`3154` for information about improvements brought by protocol 4." msgstr "" "版本 4 的協定在 Python 3.4 被新增。現在能支援超大物件的封裝、更多種型別的物件" "以及針對部份資料格式的儲存進行最佳化。從 Python 3.8 起,預設使用第 4 版協定。" "請參閱 :pep:`3154` 以了解第 4 版協定改進的細節。"
#: ../../library/pickle.rst:275 msgid "" "Common base class for the other pickling exceptions. It inherits from :exc:" "`Exception`." msgstr "" "繼承 :exc:`Exception` 類別。一個在封裝或拆封時遭遇其他例外時通用的基底類別。"

serialize

#: ../../library/pickle.rst:320 msgid "" "If *buffer_callback* is not ``None``, then it can be called any number of " "times with a buffer view. If the callback returns a false value (such as " "``None``), the given buffer is :ref:`out-of-band <pickle-oob>`; otherwise " "the buffer is serialized in-band, i.e. inside the pickle stream." msgstr "" "如果 *buffer_callback* 不是 ``None``,則它可以被多次呼叫並回傳一個緩衝區的視" "圖。如果回呼函式回傳一個假值(例如 ``None``),則所給的緩衝區將被視為 :ref:`" "帶外資料 <pickle-oob>`;否則,該緩衝區將被視為 pickle 串流的帶內資料被序列" "化。"
#: ../../library/pickle.rst:423 msgid "" "If *buffers* is ``None`` (the default), then all data necessary for " "deserialization must be contained in the pickle stream. This means that the " "*buffer_callback* argument was ``None`` when a :class:`Pickler` was " "instantiated (or when :func:`dump` or :func:`dumps` was called)." msgstr "" "如果 *buffers* 是 ``None``\\ (預設值),那麼去序列化所需的所有資料都必須已經" "包含在 pickle 串流中。這意味著當初在建立對應的 :class:`Pickler` 時(或在呼" "叫 :func:`dump` 或 :func:`dumps` 時)*buffer_callback* 引數必須為 ``None``。"
#: ../../library/pickle.rst:1052 msgid "" "But if we pass a *buffer_callback* and then give back the accumulated " "buffers when unserializing, we are able to get back the original object::" msgstr "" "但如果我們傳一個 *buffer_callback* 並在去序列化時正確返回積累的緩衝資料,我們" "就能拿回原始的物件:::"

當然也是有一些微妙的地方沒遵守這個規律

#: ../../library/pickle.rst:1043 msgid "" "On the consumer side, we can pickle those objects the usual way, which when " "unserialized will give us a copy of the original object::" msgstr "" "在使用端,我們可以用一般的方式封裝這些物件,當我們拆封時會得到一個原始物件的" "副本:::"
Copy link
Collaborator

@josix josix Oct 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

嗯嗯我覺得沒問題,搭配上下文的情境並不會誤會這裡的封裝與 OOP 的封裝~

@mattwang44
Copy link
Collaborator

@SkyLull 不好意思,不確定怎麼聯繫你所以只好在這邊岔題一下 🙏🏽
我偶然看到你有另一個 repo 想串 gpt 做機器翻譯,剛好我們也有數個成員想嘗試這個問題,不確定你有沒有興趣加入我們 Discord 討論區跟我們一起討論呢?(不確定你是否已經加入但我搜不到 ID,邀請連結在這邊,目前在這裡討論)

@SkyLull
Copy link
Contributor Author

SkyLull commented Oct 4, 2024

謝謝你的邀請
剛剛加入了!

@mattwang44 mattwang44 requested review from josix and mattwang44 October 7, 2024 17:43
Copy link
Collaborator

@josix josix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finished review for messages before ../../library/pickle.rst:114

# 其中表示這名字很可能只是為了隨便找一個p開頭的單字、或原始開發人員的內部玩笑造成的約定俗成。也有人表示醃製黃瓜(pickle-
# ing)的目標就是保存和存放,所以取了這個名字。
# 無論如何似乎沒有一個定論。
# 因為不確定是否與醃漬的這個梗有關,我暫時選擇使用 `封裝` 與 `拆封` 作為譯文,大致保存那個把東西處裡後裝起來的感覺但又不至於太奇怪。
Copy link
Collaborator

@josix josix Oct 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

確實會容易有混淆的可能性~ 要翻譯的話我會比較傾向保留原始意義 "序列化" 而非 "封裝",不知道你們覺得如何~

Copy link
Collaborator

@josix josix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finished review for translations before ../../library/pickle.rst:181,翻得很順讚讚

Copy link
Collaborator

@josix josix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finished review translations before ../../library/pickle.rst:301

"流。"

# SkyLull: 以下幾個關於 buffer_callback 的翻譯需要進一步的校對。何謂out-of-band? buffer view
# 應作何翻譯?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

前這樣翻我覺得目應該沒有問題~

Copy link
Collaborator

@josix josix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finished review messages before ../../library/pickle.rst:348

Copy link
Collaborator

@josix josix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM🙇🏻‍♂️🙇🏻‍♂️

@josix josix merged commit 82742b5 into python:3.13 Nov 11, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants