From 6ae7453b902585d26cdde99a1f788be94e4f6b5c Mon Sep 17 00:00:00 2001 From: mattwang44 Date: Sun, 7 Jun 2026 00:13:25 +0800 Subject: [PATCH] Translate library/bz2.po Translate the previously-untranslated entries of the bz2 compression module documentation into Traditional Chinese, following project terminology and reST conventions. Co-Authored-By: Claude Opus 4.8 (1M context) --- library/bz2.po | 147 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 112 insertions(+), 35 deletions(-) diff --git a/library/bz2.po b/library/bz2.po index ef7b9ff91ad..cd22486acdf 100644 --- a/library/bz2.po +++ b/library/bz2.po @@ -29,7 +29,7 @@ msgstr "**原始碼:**\\ :source:`Lib/bz2.py`" msgid "" "This module provides a comprehensive interface for compressing and " "decompressing data using the bzip2 compression algorithm." -msgstr "" +msgstr "此模組提供一套完整的介面,用於以 bzip2 壓縮演算法壓縮和解壓縮資料。" #: ../../library/bz2.rst:19 msgid "The :mod:`!bz2` module contains:" @@ -39,19 +39,21 @@ msgstr ":mod:`!bz2` 模組包含:" msgid "" "The :func:`.open` function and :class:`BZ2File` class for reading and " "writing compressed files." -msgstr "" +msgstr "用於讀取和寫入壓縮檔案的 :func:`.open` 函式和 :class:`BZ2File` 類別。" #: ../../library/bz2.rst:23 msgid "" "The :class:`BZ2Compressor` and :class:`BZ2Decompressor` classes for " "incremental (de)compression." msgstr "" +"用於漸進式(解)壓縮的 :class:`BZ2Compressor` 和 :class:`BZ2Decompressor` 類" +"別。" #: ../../library/bz2.rst:25 msgid "" "The :func:`compress` and :func:`decompress` functions for one-shot " "(de)compression." -msgstr "" +msgstr "用於一次性(解)壓縮的 :func:`compress` 和 :func:`decompress` 函式。" #: ../../includes/optional-module.rst:1 msgid "" @@ -60,16 +62,21 @@ msgid "" "provided Python to you). If you are the distributor, see :ref:`optional-" "module-requirements`." msgstr "" +"這是一個\\ :term:`可選模組 `。如果你的 CPython 副本中缺少" +"它,請尋找你的發行方(即向你提供 Python 的人)所提供的文件。如果你就是發行" +"方,請參閱 :ref:`optional-module-requirements`。" #: ../../library/bz2.rst:32 msgid "(De)compression of files" -msgstr "" +msgstr "檔案的(解)壓縮" #: ../../library/bz2.rst:36 msgid "" "Open a bzip2-compressed file in binary or text mode, returning a :term:`file " "object`." msgstr "" +"以二進位或文字模式開啟 bzip2 壓縮檔案,並回傳一個\\ :term:`檔案物件 `。" #: ../../library/bz2.rst:39 msgid "" @@ -77,6 +84,9 @@ msgid "" "an actual filename (a :class:`str` or :class:`bytes` object), or an existing " "file object to read from or write to." msgstr "" +"與 :class:`BZ2File` 的建構函式一樣,*filename* 引數可以是實際的檔案名稱" +"(:class:`str` 或 :class:`bytes` 物件),也可以是用於讀取或寫入的現存檔案物" +"件。" #: ../../library/bz2.rst:43 msgid "" @@ -84,12 +94,17 @@ msgid "" "``'x'``, ``'xb'``, ``'a'`` or ``'ab'`` for binary mode, or ``'rt'``, " "``'wt'``, ``'xt'``, or ``'at'`` for text mode. The default is ``'rb'``." msgstr "" +"*mode* 引數對於二進位模式可以是 ``'r'``、``'rb'``、``'w'``、``'wb'``、" +"``'x'``、``'xb'``、``'a'`` 或 ``'ab'`` 之一,對於文字模式則可以是 ``'rt'``、" +"``'wt'``、``'xt'`` 或 ``'at'``。預設為 ``'rb'``。" #: ../../library/bz2.rst:47 msgid "" "The *compresslevel* argument is an integer from 1 to 9, as for the :class:" "`BZ2File` constructor." msgstr "" +"*compresslevel* 引數是一個從 1 到 9 的整數,與 :class:`BZ2File` 建構函式相" +"同。" #: ../../library/bz2.rst:50 msgid "" @@ -98,6 +113,9 @@ msgid "" "this case, the *encoding*, *errors* and *newline* arguments must not be " "provided." msgstr "" +"對於二進位模式,此函式等價於 :class:`BZ2File` 建構函式:``BZ2File(filename, " +"mode, compresslevel=compresslevel)``。在此情況下,不得提供 *encoding*、" +"*errors* 和 *newline* 引數。" #: ../../library/bz2.rst:55 msgid "" @@ -105,10 +123,12 @@ msgid "" "class:`io.TextIOWrapper` instance with the specified encoding, error " "handling behavior, and line ending(s)." msgstr "" +"對於文字模式,會建立一個 :class:`BZ2File` 物件,並以指定的編碼、錯誤處理行為" +"和列結尾,將其包裝在一個 :class:`io.TextIOWrapper` 實例中。" #: ../../library/bz2.rst:61 ../../library/bz2.rst:177 msgid "The ``'x'`` (exclusive creation) mode was added." -msgstr "" +msgstr "新增了 ``'x'``\\ (獨佔建立)模式。" #: ../../library/bz2.rst:64 ../../library/bz2.rst:184 msgid "Accepts a :term:`path-like object`." @@ -116,7 +136,7 @@ msgstr "接受一個\\ :term:`類路徑物件 `。" #: ../../library/bz2.rst:70 msgid "Open a bzip2-compressed file in binary mode." -msgstr "" +msgstr "以二進位模式開啟 bzip2 壓縮檔案。" #: ../../library/bz2.rst:72 msgid "" @@ -124,6 +144,9 @@ msgid "" "file directly. Otherwise, *filename* should be a :term:`file object`, which " "will be used to read or write the compressed data." msgstr "" +"如果 *filename* 是一個 :class:`str` 或 :class:`bytes` 物件,則直接開啟所指定" +"名稱的檔案。否則,*filename* 應為一個\\ :term:`檔案物件 `,將用" +"於讀取或寫入壓縮資料。" #: ../../library/bz2.rst:76 msgid "" @@ -132,12 +155,17 @@ msgid "" "can equivalently be given as ``'rb'``, ``'wb'``, ``'xb'`` and ``'ab'`` " "respectively." msgstr "" +"*mode* 引數可以是 ``'r'``\\ (讀取,預設)、``'w'``\\ (覆寫)、``'x'``\\ " +"(獨佔建立)或 ``'a'``\\ (附加)。這些也可以分別等價地寫成 ``'rb'``、" +"``'wb'``、``'xb'`` 和 ``'ab'``。" #: ../../library/bz2.rst:81 msgid "" "If *filename* is a file object (rather than an actual file name), a mode of " "``'w'`` does not truncate the file, and is instead equivalent to ``'a'``." msgstr "" +"如果 *filename* 是一個檔案物件(而非實際的檔案名稱),``'w'`` 模式不會截斷檔" +"案,而是等價於 ``'a'``。" #: ../../library/bz2.rst:84 msgid "" @@ -145,12 +173,15 @@ msgid "" "``1`` and ``9`` specifying the level of compression: ``1`` produces the " "least compression, and ``9`` (default) produces the most compression." msgstr "" +"如果 *mode* 是 ``'w'`` 或 ``'a'``,*compresslevel* 可以是一個介於 ``1`` 和 " +"``9`` 之間的整數,用以指定壓縮的等級:``1`` 產生最少的壓縮,而 ``9``\\ (預" +"設)產生最多的壓縮。" #: ../../library/bz2.rst:88 msgid "" "If *mode* is ``'r'``, the input file may be the concatenation of multiple " "compressed streams." -msgstr "" +msgstr "如果 *mode* 是 ``'r'``,輸入檔案可以是多個壓縮串流的串接。" #: ../../library/bz2.rst:91 msgid "" @@ -158,6 +189,9 @@ msgid "" "BufferedIOBase`, except for :meth:`~io.BufferedIOBase.detach` and :meth:`~io." "IOBase.truncate`. Iteration and the :keyword:`with` statement are supported." msgstr "" +":class:`BZ2File` 提供了由 :class:`io.BufferedIOBase` 所指定的所有成員," +"但 :meth:`~io.BufferedIOBase.detach` 和 :meth:`~io.IOBase.truncate` 除外。它" +"支援疊代和 :keyword:`with` 陳述式。" #: ../../library/bz2.rst:96 msgid ":class:`BZ2File` also provides the following methods and attributes:" @@ -169,6 +203,8 @@ msgid "" "of data will be returned (unless at EOF). The exact number of bytes returned " "is unspecified." msgstr "" +"回傳緩衝的資料,但不移動檔案位置。至少會回傳一個位元組的資料(除非位於 " +"EOF)。回傳的確切位元組數未指定。" #: ../../library/bz2.rst:104 msgid "" @@ -177,22 +213,25 @@ msgid "" "the :class:`BZ2File` was constructed by passing a file object for " "*filename*)." msgstr "" +"雖然呼叫 :meth:`peek` 不會改變 :class:`BZ2File` 的檔案位置,但可能會改變底層" +"檔案物件的位置(例如,如果 :class:`BZ2File` 是透過將檔案物件作為 *filename* " +"傳入來建構的)。" #: ../../library/bz2.rst:113 msgid "Return the file descriptor for the underlying file." -msgstr "" +msgstr "回傳底層檔案的檔案描述器。" #: ../../library/bz2.rst:119 msgid "Return whether the file was opened for reading." -msgstr "" +msgstr "回傳檔案是否以讀取模式開啟。" #: ../../library/bz2.rst:125 msgid "Return whether the file supports seeking." -msgstr "" +msgstr "回傳檔案是否支援定位(seeking)。" #: ../../library/bz2.rst:131 msgid "Return whether the file was opened for writing." -msgstr "" +msgstr "回傳檔案是否以寫入模式開啟。" #: ../../library/bz2.rst:137 msgid "" @@ -200,6 +239,8 @@ msgid "" "reads from the underlying stream. Reads up to a buffer's worth of data if " "size is negative." msgstr "" +"讀取至多 *size* 個未壓縮位元組,並盡量避免對底層串流進行多次讀取。如果 size " +"為負,則讀取至多一個緩衝區大小的資料。" #: ../../library/bz2.rst:141 msgid "Returns ``b''`` if the file is at EOF." @@ -207,21 +248,23 @@ msgstr "如果檔案已經到達 EOF 則回傳 ``b''``。" #: ../../library/bz2.rst:147 msgid "Read bytes into *b*." -msgstr "" +msgstr "將位元組讀取到 *b* 中。" #: ../../library/bz2.rst:149 msgid "Returns the number of bytes read (0 for EOF)." -msgstr "" +msgstr "回傳所讀取的位元組數(EOF 時為 0)。" #: ../../library/bz2.rst:155 msgid "``'rb'`` for reading and ``'wb'`` for writing." -msgstr "" +msgstr "``'rb'`` 用於讀取,``'wb'`` 用於寫入。" #: ../../library/bz2.rst:161 msgid "" "The bzip2 file name. Equivalent to the :attr:`~io.FileIO.name` attribute of " "the underlying :term:`file object`." msgstr "" +"bzip2 檔案名稱。等價於底層\\ :term:`檔案物件 `\\ " +"的 :attr:`~io.FileIO.name` 屬性。" #: ../../library/bz2.rst:167 msgid "Support for the :keyword:`with` statement was added." @@ -232,28 +275,32 @@ msgid "" "Support was added for *filename* being a :term:`file object` instead of an " "actual filename." msgstr "" +"新增了對 *filename* 為\\ :term:`檔案物件 `\\ 而非實際檔案名稱的" +"支援。" #: ../../library/bz2.rst:174 msgid "" "The ``'a'`` (append) mode was added, along with support for reading multi-" "stream files." -msgstr "" +msgstr "新增了 ``'a'``\\ (附加)模式,以及對讀取多串流檔案的支援。" #: ../../library/bz2.rst:180 msgid "" "The :meth:`~io.BufferedIOBase.read` method now accepts an argument of " "``None``." -msgstr "" +msgstr ":meth:`~io.BufferedIOBase.read` 方法現在接受 ``None`` 引數。" #: ../../library/bz2.rst:187 msgid "" "The *buffering* parameter has been removed. It was ignored and deprecated " "since Python 3.0. Pass an open file object to control how the file is opened." msgstr "" +"*buffering* 參數已被移除。它自 Python 3.0 起即被忽略並已棄用。請傳入一個已開" +"啟的檔案物件以控制檔案的開啟方式。" #: ../../library/bz2.rst:192 msgid "The *compresslevel* parameter became keyword-only." -msgstr "" +msgstr "*compresslevel* 參數變成僅限關鍵字。" #: ../../library/bz2.rst:194 msgid "" @@ -261,10 +308,12 @@ msgid "" "writers, just like its equivalent classes in :mod:`gzip` and :mod:`lzma` " "have always been." msgstr "" +"此類別在面對多個同時讀取者或寫入者時並非執行緒安全,就如同 :mod:`gzip` " +"和 :mod:`lzma` 中的等價類別一直以來的情況一樣。" #: ../../library/bz2.rst:201 msgid "Incremental (de)compression" -msgstr "" +msgstr "漸進式(解)壓縮" #: ../../library/bz2.rst:205 msgid "" @@ -272,35 +321,41 @@ msgid "" "incrementally. For one-shot compression, use the :func:`compress` function " "instead." msgstr "" +"建立一個新的壓縮器物件。此物件可用於漸進式地壓縮資料。對於一次性壓縮,請改" +"用 :func:`compress` 函式。" #: ../../library/bz2.rst:209 ../../library/bz2.rst:297 msgid "" "*compresslevel*, if given, must be an integer between ``1`` and ``9``. The " "default is ``9``." msgstr "" +"*compresslevel* 如果有給定,必須是一個介於 ``1`` 和 ``9`` 之間的整數。預設為 " +"``9``。" #: ../../library/bz2.rst:214 msgid "" "Provide data to the compressor object. Returns a chunk of compressed data if " "possible, or an empty byte string otherwise." msgstr "" +"將資料提供給壓縮器物件。如果可能,回傳一塊壓縮資料,否則回傳一個空的位元組字" +"串。" #: ../../library/bz2.rst:217 msgid "" "When you have finished providing data to the compressor, call the :meth:" "`flush` method to finish the compression process." -msgstr "" +msgstr "當你完成向壓縮器提供資料後,呼叫 :meth:`flush` 方法以完成壓縮程序。" #: ../../library/bz2.rst:223 msgid "" "Finish the compression process. Returns the compressed data left in internal " "buffers." -msgstr "" +msgstr "完成壓縮程序。回傳留在內部緩衝區中的壓縮資料。" #: ../../library/bz2.rst:226 msgid "" "The compressor object may not be used after this method has been called." -msgstr "" +msgstr "呼叫此方法之後,就不能再使用壓縮器物件。" #: ../../library/bz2.rst:231 msgid "" @@ -308,6 +363,8 @@ msgid "" "incrementally. For one-shot compression, use the :func:`decompress` function " "instead." msgstr "" +"建立一個新的解壓縮器物件。此物件可用於漸進式地解壓縮資料。對於一次性壓縮,請" +"改用 :func:`decompress` 函式。" #: ../../library/bz2.rst:236 msgid "" @@ -316,6 +373,9 @@ msgid "" "need to decompress a multi-stream input with :class:`BZ2Decompressor`, you " "must use a new decompressor for each stream." msgstr "" +"與 :func:`decompress` 和 :class:`BZ2File` 不同,此類別不會透明地處理包含多個" +"壓縮串流的輸入。如果你需要使用 :class:`BZ2Decompressor` 來解壓縮一個多串流輸" +"入,你必須為每個串流使用一個新的解壓縮器。" #: ../../library/bz2.rst:243 msgid "" @@ -324,6 +384,10 @@ msgid "" "to :meth:`decompress`. The returned data should be concatenated with the " "output of any previous calls to :meth:`decompress`." msgstr "" +"解壓縮 *data*\\ (一個\\ :term:`類位元組串物件 `\\ ),並" +"以 bytes 形式回傳解壓縮後的資料。部分 *data* 可能會被內部緩衝,以供後續呼" +"叫 :meth:`decompress` 時使用。回傳的資料應與先前任何 :meth:`decompress` 呼叫" +"的輸出串接在一起。" #: ../../library/bz2.rst:249 msgid "" @@ -333,6 +397,10 @@ msgid "" "this case, the next call to :meth:`~.decompress` may provide *data* as " "``b''`` to obtain more of the output." msgstr "" +"如果 *max_length* 為非負數,則回傳至多 *max_length* 個位元組的解壓縮資料。如" +"果到達此上限且仍能產生進一步的輸出,:attr:`~.needs_input` 屬性會被設定為 " +"``False``。在此情況下,下一次呼叫 :meth:`~.decompress` 時可以將 *data* 提供" +"為 ``b''`` 以取得更多的輸出。" #: ../../library/bz2.rst:256 msgid "" @@ -340,6 +408,9 @@ msgid "" "was less than *max_length* bytes, or because *max_length* was negative), " "the :attr:`~.needs_input` attribute will be set to ``True``." msgstr "" +"如果所有的輸入資料都已被解壓縮並回傳(無論是因為其小於 *max_length* 個位元" +"組,或是因為 *max_length* 為負數),:attr:`~.needs_input` 屬性會被設定為 " +"``True``。" #: ../../library/bz2.rst:261 msgid "" @@ -347,6 +418,8 @@ msgid "" "exc:`EOFError`. Any data found after the end of the stream is ignored and " "saved in the :attr:`~.unused_data` attribute." msgstr "" +"在到達串流結尾後嘗試解壓縮資料會引發 :exc:`EOFError`。在串流結尾之後找到的任" +"何資料都會被忽略,並儲存在 :attr:`~.unused_data` 屬性中。" #: ../../library/bz2.rst:265 msgid "Added the *max_length* parameter." @@ -354,53 +427,55 @@ msgstr "新增 *max_length* 參數。" #: ../../library/bz2.rst:270 msgid "``True`` if the end-of-stream marker has been reached." -msgstr "" +msgstr "如果已到達串流結尾標記則為 ``True``。" #: ../../library/bz2.rst:277 msgid "Data found after the end of the compressed stream." -msgstr "" +msgstr "在壓縮串流結尾之後找到的資料。" #: ../../library/bz2.rst:279 msgid "" "If this attribute is accessed before the end of the stream has been reached, " "its value will be ``b''``." -msgstr "" +msgstr "如果在到達串流結尾之前存取此屬性,其值將為 ``b''``。" #: ../../library/bz2.rst:284 msgid "" "``False`` if the :meth:`.decompress` method can provide more decompressed " "data before requiring new uncompressed input." msgstr "" +"如果 :meth:`.decompress` 方法能在需要新的未壓縮輸入之前提供更多解壓縮的資料," +"則為 ``False``。" #: ../../library/bz2.rst:291 msgid "One-shot (de)compression" -msgstr "" +msgstr "一次性(解)壓縮" #: ../../library/bz2.rst:295 msgid "Compress *data*, a :term:`bytes-like object `." -msgstr "" +msgstr "壓縮 *data*,一個\\ :term:`類位元組串物件 `。" #: ../../library/bz2.rst:300 msgid "For incremental compression, use a :class:`BZ2Compressor` instead." -msgstr "" +msgstr "對於漸進式壓縮,請改用 :class:`BZ2Compressor`。" #: ../../library/bz2.rst:305 msgid "Decompress *data*, a :term:`bytes-like object `." -msgstr "" +msgstr "解壓縮 *data*,一個\\ :term:`類位元組串物件 `。" #: ../../library/bz2.rst:307 msgid "" "If *data* is the concatenation of multiple compressed streams, decompress " "all of the streams." -msgstr "" +msgstr "如果 *data* 是多個壓縮串流的串接,則解壓縮所有的串流。" #: ../../library/bz2.rst:310 msgid "For incremental decompression, use a :class:`BZ2Decompressor` instead." -msgstr "" +msgstr "對於漸進式解壓縮,請改用 :class:`BZ2Decompressor`。" #: ../../library/bz2.rst:312 msgid "Support for multi-stream inputs was added." -msgstr "" +msgstr "新增了對多串流輸入的支援。" #: ../../library/bz2.rst:318 msgid "Examples of usage" @@ -408,17 +483,17 @@ msgstr "用法範例" #: ../../library/bz2.rst:320 msgid "Below are some examples of typical usage of the :mod:`!bz2` module." -msgstr "" +msgstr "以下是 :mod:`!bz2` 模組的一些典型用法範例。" #: ../../library/bz2.rst:322 msgid "" "Using :func:`compress` and :func:`decompress` to demonstrate round-trip " "compression:" -msgstr "" +msgstr "使用 :func:`compress` 和 :func:`decompress` 來示範壓縮與解壓縮的往返:" #: ../../library/bz2.rst:340 msgid "Using :class:`BZ2Compressor` for incremental compression:" -msgstr "" +msgstr "使用 :class:`BZ2Compressor` 進行漸進式壓縮:" #: ../../library/bz2.rst:358 msgid "" @@ -426,7 +501,9 @@ msgid "" "``b\"z\"`` chunks). Random data tends to compress poorly, while ordered, " "repetitive data usually yields a high compression ratio." msgstr "" +"上面的範例使用了一個非常「不隨機」的資料串流(一個由 ``b\"z\"`` 區塊組成的串" +"流)。隨機資料的壓縮效果往往較差,而有序、重複的資料通常會產生很高的壓縮比。" #: ../../library/bz2.rst:362 msgid "Writing and reading a bzip2-compressed file in binary mode:" -msgstr "" +msgstr "以二進位模式寫入和讀取一個 bzip2 壓縮的檔案:"