Skip to content

Complete translation of library/struct.po to Traditional Chinese #1117

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 12 commits into from
Jul 14, 2025
Merged
Changes from 2 commits
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
42 changes: 39 additions & 3 deletions library/struct.po
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ msgid ""
"connections), or data transfer between the Python application and the C "
"layer."
msgstr ""
"此模組可在 Python 數值與以 Python :class:`bytes` 物件表示的 C 結構之間進行轉換。\\"
"簡潔的\\ :ref:`格式字串 <struct-format-strings>` 描述了與 Python 數值之間預期的轉換。\\"
"此模組的函式和物件可用於兩種截然不同的應用:與外部來源(檔案或網路連線)的資料交換,\\"
"或是 Python 應用程式與 C 層之間的資料傳輸。"

#: ../../library/struct.rst:29
msgid ""
Expand All @@ -48,6 +52,10 @@ msgid ""
"for defining byte ordering and padding between elements. See :ref:`struct-"
"alignment` for details."
msgstr ""
"當未給定前綴字元時,原生模式為預設模式。它會根據建構 Python 直譯器的平台和編譯器來\\"
"打包或解包資料。打包給定 C 結構的結果包含填充位元組,以維持相關 C 型別的正確對齊;\\"
"同樣地,解包時也會考量對齊。相反地,當在外部來源之間傳輸資料時,程式設計師需負責定義\\"
"位元組順序和元素之間的填充。詳情請參見\\ :ref:`struct-alignment`。"

#: ../../library/struct.rst:39
msgid ""
Expand All @@ -59,6 +67,11 @@ msgid ""
"of bytes implement the buffer protocol, so that they can be read/filled "
"without additional copying from a :class:`bytes` object."
msgstr ""
"一些\\ :mod:`struct` 函式(和 :class:`Struct` 的方法)接受一個 *buffer* 引數。\\"
"這是指實作\\ :ref:`bufferobjects` 並提供可讀或可讀寫緩衝區的物件。最常用於此目的的\\"
"型別是\\ :class:`bytes` 和\\ :class:`bytearray`,但許多其他可以視為位元組陣列的\\"
"型別都實作了緩衝區協議,因此它們可以從\\ :class:`bytes` 物件讀取或填入資料而無需\\"
"額外的複製。"

#: ../../library/struct.rst:48
msgid "Functions and Exceptions"
Expand All @@ -73,20 +86,25 @@ msgid ""
"Exception raised on various occasions; argument is a string describing what "
"is wrong."
msgstr ""
"在各種情況下觸發的例外;引數是一個描述錯誤內容的字串。"

#: ../../library/struct.rst:61
msgid ""
"Return a bytes object containing the values *v1*, *v2*, ... packed according "
"to the format string *format*. The arguments must match the values required "
"by the format exactly."
msgstr ""
"回傳一個包含依照格式字串 *format* 打包的數值 *v1*、*v2*、... 的 bytes 物件。\\"
"引數必須完全符合格式所需的數值。"

#: ../../library/struct.rst:68
msgid ""
"Pack the values *v1*, *v2*, ... according to the format string *format* and "
"write the packed bytes into the writable buffer *buffer* starting at "
"position *offset*. Note that *offset* is a required argument."
msgstr ""
"依照格式字串 *format* 打包數值 *v1*、*v2*、...,並將打包後的位元組寫入可寫緩衝區 "
"*buffer* 中從位置 *offset* 開始的地方。請注意 *offset* 是必要的引數。"

#: ../../library/struct.rst:75
msgid ""
Expand All @@ -95,6 +113,9 @@ msgid ""
"contains exactly one item. The buffer's size in bytes must match the size "
"required by the format, as reflected by :func:`calcsize`."
msgstr ""
"根據格式字串 *format* 從緩衝區 *buffer*(推測是由 ``pack(format, ...)`` 打包的)\\"
"解包。結果是一個元組,即使它只包含一個項目。緩衝區的位元組大小必須符合格式所需的\\"
"大小,如\\ :func:`calcsize` 所示。"

#: ../../library/struct.rst:83
msgid ""
Expand All @@ -103,6 +124,9 @@ msgid ""
"item. The buffer's size in bytes, starting at position *offset*, must be at "
"least the size required by the format, as reflected by :func:`calcsize`."
msgstr ""
"根據格式字串 *format* 從 *buffer* 的位置 *offset* 開始解包。結果是一個元組,\\"
"即使它只包含一個項目。緩衝區從位置 *offset* 開始的位元組大小,必須至少達到\\"
"格式所需的大小,如\\ :func:`calcsize` 所示。"

#: ../../library/struct.rst:91
msgid ""
Expand All @@ -112,20 +136,25 @@ msgid ""
"buffer's size in bytes must be a multiple of the size required by the "
"format, as reflected by :func:`calcsize`."
msgstr ""
"根據格式字串 *format* 迭代地從緩衝區 *buffer* 解包。此函式回傳一個迭代器,\\"
"它會從緩衝區讀取等大小的區塊,直到消耗完所有內容。緩衝區的位元組大小必須是\\"
"格式所需大小的倍數,如\\ :func:`calcsize` 所示。"

#: ../../library/struct.rst:97
msgid "Each iteration yields a tuple as specified by the format string."
msgstr ""
msgstr "每次迭代都會產出由格式字串指定的元組。"

#: ../../library/struct.rst:104
msgid ""
"Return the size of the struct (and hence of the bytes object produced by "
"``pack(format, ...)``) corresponding to the format string *format*."
msgstr ""
"回傳對應於格式字串 *format* 的結構大小(因此也是 ``pack(format, ...)`` \\"
"所產生的 bytes 物件的大小)。"

#: ../../library/struct.rst:111
msgid "Format Strings"
msgstr ""
msgstr "格式字串"

#: ../../library/struct.rst:113
msgid ""
Expand All @@ -137,10 +166,14 @@ msgid ""
"which describes the overall properties of the data and one or more format "
"characters which describe the actual data values and padding."
msgstr ""
"格式字串描述了打包和解包資料時的資料配置。它們由\\ :ref:`格式字元<format-characters>` \\"
"組成,這些字元指定了要打包或解包的資料型別。此外,特殊字元控制\\ :ref:`位元組順序、\\"
"大小和對齊<struct-alignment>`。每個格式字串由一個可選的前綴字元組成,描述資料的\\"
"整體屬性,以及一個或多個描述實際資料值和填充的格式字元。"

#: ../../library/struct.rst:125
msgid "Byte Order, Size, and Alignment"
msgstr ""
msgstr "位元組順序、大小和對齊"

#: ../../library/struct.rst:127
msgid ""
Expand All @@ -151,6 +184,9 @@ msgid ""
"corresponding C struct. Whether to use native byte ordering and padding or "
"standard formats depends on the application."
msgstr ""
"預設情況下,C 型別以機器的原生格式和位元組順序表示,並在必要時透過跳過填充位元組\\"
"來正確對齊(根據 C 編譯器所使用的規則)。選擇此行為使得打包結構的位元組完全對應於\\"
"相對應 C 結構的記憶體配置。是否使用原生位元組順序和填充或標準格式取決於應用程式。"

#: ../../library/struct.rst:143
msgid ""
Expand Down