Skip to content

docs(howto/sockets.po): 翻譯 Binary DataDisconnecting 區塊 #518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 9, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 33 additions & 3 deletions howto/sockets.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: Python 3.11\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-06-10 00:16+0000\n"
"PO-Revision-Date: 2023-07-19 20:17+0800\n"
"PO-Revision-Date: 2023-08-03 18:11+0800\n"
"Last-Translator: Jay <[email protected]>\n"
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
"tw)\n"
Expand Down Expand Up @@ -417,7 +417,7 @@ msgstr ""

#: ../../howto/sockets.rst:252
msgid "Binary Data"
msgstr ""
msgstr "二進制資料"
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
Contributor Author

Choose a reason for hiding this comment

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

了解,進位感覺比較好。

維基百科(進位制) 也是用進位來表示


#: ../../howto/sockets.rst:254
msgid ""
Expand All @@ -430,6 +430,12 @@ msgid ""
"little-endian, with the least significant byte first - that same ``1`` would "
"be ``01 00``."
msgstr ""
"使用 socket 傳輸二進制資料完全是可行的。最主要的問題在於不同機器使用不同的二"
"進制資料格式。例如,`網路二進制順序 <https://en.wikipedia.org/wiki/"
"Endianness#Networking>`_ 採用的是「大端序 big-endian」最大的位元組排在前面,"
Copy link
Collaborator

Choose a reason for hiding this comment

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

most significant & least significant 翻成「最大」、「最小」好像比較容易誤導成 bytes 大小,看有沒有更好的翻譯(像是「最高」、「最低」?),或者可以補充原文沒有的解釋(e.g. (譯者注:......)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

如果是根據 維基百科 (位元組順序) 中,第三段第一行中的 將一個多位數的低位放在較小的位址處,高位放在較大的位址處,則稱小端序;反之則稱大端序。 這樣來解釋會不會比較清楚?

Copy link
Collaborator

Choose a reason for hiding this comment

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

我覺得這樣 ok,再麻煩你幫忙修改~

"所以一個值為 ``1`` 的 16 位元整數會表示成兩個 16 進位的位元組 ``00 01``。然而"
"大多數常見的處理器 (x86/AMD64,ARM,RISC-V) 採用的是「小端序 little-"
"endian」,最小的位元組排在前面 - 所以相同的 ``1`` 會被表示成 ``01 00``。"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"Endianness#Networking>`_ 採用的是「大端序 big-endian最大的位元組排在前面,"
"所以一個值為 ``1`` 的 16 位元整數會表示成兩個 16 進位的位元組 ``00 01``。然而"
"大多數常見的處理器 (x86/AMD64,ARM,RISC-V) 採用的是「小端序 little-"
"endian,最小的位元組排在前面 - 所以相同的 ``1`` 會被表示成 ``01 00``。"
"Endianness#Networking>`_ 採用的是大端序 (big-endian),最大的位元組排在前面,"
"所以一個值為 ``1`` 的 16 位元整數會表示成兩個 16 進位的位元組 ``00 01``。然而"
"大多數常見的處理器 (x86/AMD64,ARM,RISC-V) 採用的是小端序 (little-"
"endian),最小的位元組排在前面 - 所以相同的 ``1`` 會被表示成 ``01 00``。"


#: ../../howto/sockets.rst:262
msgid ""
Expand All @@ -439,6 +445,10 @@ msgid ""
"these do nothing, but where the machine is byte-reversed, these swap the "
"bytes around appropriately."
msgstr ""
"Socket 函式庫提供了用於轉換 16 位元和 32 位元整數的函式 - ``ntohl, htonl, "
"ntohs, htons``,其中 \"n\" 表示 *網路*,\"h\" 表示 *主機*,\"s\" 表示 "
Copy link
Collaborator

Choose a reason for hiding this comment

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

跟開頭 character 有關,不翻譯比較好理解

Suggested change
"ntohs, htons``,其中 \"n\" 表示 *網路*,\"h\" 表示 *主機*,\"s\" 表示 "
"ntohs, htons``,其中 \"n\" 表示 *network*,\"h\" 表示 *host*,\"s\" 表示 "

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的

"*short*,\"l\" 表示 *long*。當網路的位元組順序和主機位元組順序相同時,這些函"
"式不會做任何操作,但當主機的位元組順序相反時,這些函式會適當的交換位元組順序。"

#: ../../howto/sockets.rst:268
msgid ""
Expand All @@ -449,10 +459,14 @@ msgid ""
"be 8. Of course, this doesn't fit well with fixed-length messages. "
"Decisions, decisions."
msgstr ""
"在現今的 64 位元機器中,二進制資料的 ASCII 表示通常會比二進制表示要小,這是因"
"為在很多情況下,大多數整數的值為 0 或者 1。例如,字串形式的 ``\"0\"`` 是兩個"
"位元組,而完整的 64 位元整數則是 8 個位元組。當然,這對固定長度的訊息來說不太"
"適合,需要自行決定。"

#: ../../howto/sockets.rst:277
msgid "Disconnecting"
msgstr ""
msgstr "結束連線"

#: ../../howto/sockets.rst:279
msgid ""
Expand All @@ -465,6 +479,12 @@ msgid ""
"same as ``shutdown(); close()``. So in most situations, an explicit "
"``shutdown`` is not needed."
msgstr ""
"嚴格來說,在關閉 socket 前,你應該使用 ``shutdown`` 函式。``shutdown`` 函式是"
"發送給 socket 另一端的一個提醒。根據你傳遞的參數,它可以表示「我不會再發送任"
Copy link
Collaborator

Choose a reason for hiding this comment

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

parameter -> 參數
argument -> 引數

Suggested change
"發送給 socket 另一端的一個提醒。根據你傳遞的參數,它可以表示「我不會再發送任"
"發送給 socket 另一端的一個提醒。根據你傳遞的引數,它可以表示「我不會再發送任"

"何訊息了,但我仍然會持續監聽」,或者是「我不會再繼續監聽了,真讚!」。然而,"
"大多數的 socket 函式庫或程式設計師都習慣忽略這種禮節,因為通常情況下 "
"``close`` 跟 ``shutdown(); close()`` 是一樣的。所以在大多數情況下,不需要再特"
"地使用 ``shutdown`` 了。"

#: ../../howto/sockets.rst:287
msgid ""
Expand All @@ -475,6 +495,11 @@ msgid ""
"complete request. The server sends a reply. If the ``send`` completes "
"successfully then, indeed, the client was still receiving."
msgstr ""
"有效使用 ``shutdown`` 的一種方法是在類似 HTTP 的交換中,用戶端發送請求後,然"
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit 為了與 method 的「方法」做區別,我會傾向翻成「方式」

Suggested change
"有效使用 ``shutdown`` 的一種方法是在類似 HTTP 的交換中,用戶端發送請求後,然"
"有效使用 ``shutdown`` 的一種方式是在類似 HTTP 的交換中,用戶端發送請求後,然"

"後使用 ``shutdown(1)``。這告訴伺服器「這個用戶端已經發送完成,但仍可以接"
"收」。伺服器可以通過接收「零位元組」來檢測 \"EOF\"。這樣它就可以確定已經接收到"
"完整的請求。伺服器發送回覆,如果 ``send`` 成功完成,那麼用戶端確實在持續接"
"收。"

#: ../../howto/sockets.rst:294
msgid ""
Expand All @@ -485,6 +510,11 @@ msgid ""
"indefinitely, thinking you're just being slow. *Please* ``close`` your "
"sockets when you're done."
msgstr ""
"Python 更近一步地採取自動關閉的步驟,並且當 socket 被回收機制回收時,如果需要"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"Python 更近一步地採取自動關閉的步驟,並且當 socket 被回收機制回收時,如果需要"
"Python 更進一步地採取自動關閉的步驟,並且當 socket 被垃圾回收機制回收時,如果需要"

"的話,他會自動執行 ``close``。但依賴這個機制是一個非常不好的習慣,如果你的 "
"socket 在沒有 ``close`` 的情況下消失了,那麼另一端的 socket 可能會認為你只是"
"慢了一步,而無期限的等待。*請務必* \\在使用完畢後使用 ``close`` 關閉你的 "
"sockets。"

#: ../../howto/sockets.rst:302
msgid "When Sockets Die"
Expand Down