diff --git a/library/pathlib.po b/library/pathlib.po index c635055b50..40136b2459 100644 --- a/library/pathlib.po +++ b/library/pathlib.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-12-09 00:03+0000\n" -"PO-Revision-Date: 2023-07-11 01:08+0800\n" +"PO-Revision-Date: 2023-12-30 18:12+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -16,11 +16,11 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.3.1\n" +"X-Generator: Poedit 3.4.2\n" #: ../../library/pathlib.rst:3 msgid ":mod:`pathlib` --- Object-oriented filesystem paths" -msgstr "" +msgstr ":mod:`pathlib` --- 物件導向檔案系統路徑" #: ../../library/pathlib.rst:10 msgid "**Source code:** :source:`Lib/pathlib.py`" @@ -34,6 +34,10 @@ msgid "" "operations without I/O, and :ref:`concrete paths `, which " "inherit from pure paths but also provide I/O operations." msgstr "" +"此模組提供代表檔案系統路徑的類別,能適用不同作業系統的語意。路徑類別分成兩" +"種,一種是\\ :ref:`純路徑 (pure paths) `,提供沒有 I/O 的單純計算" +"操作,另一種是\\ :ref:`實體路徑 (concrete paths) `,繼承自純" +"路徑但也提供 IO 操作。" #: ../../library/pathlib.rst:26 msgid "" @@ -42,10 +46,13 @@ msgid "" "instantiates a :ref:`concrete path ` for the platform the " "code is running on." msgstr "" +"如果你之前從未使用過此模組或不確定哪個類別適合你的任務,那你需要的最有可能" +"是 :class:`Path`。它針對程式執行所在的平台實例化一個\\ :ref:`實體路徑 " +"`。" #: ../../library/pathlib.rst:30 msgid "Pure paths are useful in some special cases; for example:" -msgstr "" +msgstr "純路徑在某些特殊情境下是有用的,例如:" #: ../../library/pathlib.rst:32 msgid "" @@ -53,6 +60,8 @@ msgid "" "You cannot instantiate a :class:`WindowsPath` when running on Unix, but you " "can instantiate :class:`PureWindowsPath`." msgstr "" +"如果你想在 Unix 機器上處理 Windows 路徑(或反過來),你無法在 Unix 上實例化 :" +"class:`WindowsPath`,但你可以實例化 :class:`PureWindowsPath`。" #: ../../library/pathlib.rst:35 msgid "" @@ -60,44 +69,46 @@ msgid "" "accessing the OS. In this case, instantiating one of the pure classes may be " "useful since those simply don't have any OS-accessing operations." msgstr "" +"你想確保你的程式在操作路徑的時候不會真的存取到 OS。在這個情況下,實例化其中一" +"種純路徑類別可能是有用的,因為它們不會有任何存取 OS 的操作。" #: ../../library/pathlib.rst:40 msgid ":pep:`428`: The pathlib module -- object-oriented filesystem paths." -msgstr "" +msgstr ":pep:`428`:pathlib 模組 -- 物件導向檔案系統路徑。" #: ../../library/pathlib.rst:43 msgid "" "For low-level path manipulation on strings, you can also use the :mod:`os." "path` module." -msgstr "" +msgstr "針對字串上的底層路徑操作,你也可以使用 :mod:`os.path` 模組。" #: ../../library/pathlib.rst:48 msgid "Basic use" -msgstr "" +msgstr "基本用法" #: ../../library/pathlib.rst:50 msgid "Importing the main class::" -msgstr "" +msgstr "匯入主要類別: ::" #: ../../library/pathlib.rst:54 msgid "Listing subdirectories::" -msgstr "" +msgstr "列出子目錄: ::" #: ../../library/pathlib.rst:61 msgid "Listing Python source files in this directory tree::" -msgstr "" +msgstr "在當前目錄樹下列出 Python 原始碼檔案: ::" #: ../../library/pathlib.rst:68 msgid "Navigating inside a directory tree::" -msgstr "" +msgstr "瀏覽目錄樹內部: ::" #: ../../library/pathlib.rst:77 msgid "Querying path properties::" -msgstr "" +msgstr "查詢路徑屬性: ::" #: ../../library/pathlib.rst:84 msgid "Opening a file::" -msgstr "" +msgstr "開啟檔案: ::" #: ../../library/pathlib.rst:94 msgid "Pure paths" @@ -110,7 +121,7 @@ msgid "" "also call *flavours*:" msgstr "" "純路徑物件提供處理路徑的操作,實際上不會存取檔案系統。有三種方法可以存取這些" -"類別 (class),我們也稱之為\\ *類型*:" +"類別,我們也稱之為\\ *類型 (flavours)*:" #: ../../library/pathlib.rst:102 msgid "" @@ -127,20 +138,20 @@ msgid "" "the :meth:`~os.PathLike.__fspath__` method returns a string, such as another " "path object::" msgstr "" -"*pathsegments* 中的每個元素可以是以下的其中一種:一個表示路徑片段的字串或實作" -"了 :class:`os.PathLike` 介面 (interface) 且 :meth:`~os.PathLike.__fspath__` " -"方法會回傳字串的物件,像是另一個路徑物件: ::" +"*pathsegments* 中的每個元素可以是以下的其中一種:一個表示路徑片段的字串,或一" +"個物件,它實作了 :class:`os.PathLike` 介面且其中的 :meth:`~os.PathLike." +"__fspath__` 方法會回傳字串,就像是另一個路徑物件: ::" #: ../../library/pathlib.rst:118 msgid "When *pathsegments* is empty, the current directory is assumed::" -msgstr "當 *pathsegments* 是空的時候,預設使用目前的目錄: ::" +msgstr "當沒有給 *pathsegments* 的時候,會假設是目前的目錄: ::" #: ../../library/pathlib.rst:123 msgid "" "If a segment is an absolute path, all previous segments are ignored (like :" "func:`os.path.join`)::" msgstr "" -"如果一個片段是絕對路徑,則所有先前的片段將被忽略(類似於 :func:`os.path." +"如果一個片段是絕對路徑,則所有之前的片段會被忽略(類似 :func:`os.path." "join`): ::" #: ../../library/pathlib.rst:131 @@ -168,7 +179,7 @@ msgid "" "another directory)" msgstr "" "(一個使得 ``PurePosixPath('foo/../bar')`` 等同於 ``PurePosixPath('bar')`` 的" -"單純方法,但如果 ``foo`` 是一個目錄的符號連結,這是錯誤的。)" +"單純方法,但如果 ``foo`` 是指到另一個目錄的符號連結,就會是錯誤的。)" #: ../../library/pathlib.rst:154 msgid "" @@ -187,8 +198,7 @@ msgid "" "A subclass of :class:`PurePath`, this path flavour represents non-Windows " "filesystem paths::" msgstr "" -":class:`PurePath` 的一個子類別 (subclass),該路徑類型表示非 Windows 檔案系統" -"的路徑: ::" +":class:`PurePath` 的一個子類別,該路徑類型表示非 Windows 檔案系統的路徑: ::" #: ../../library/pathlib.rst:168 ../../library/pathlib.rst:180 #: ../../library/pathlib.rst:742 ../../library/pathlib.rst:752 @@ -210,11 +220,11 @@ msgid "" "classes, since they don't provide any operation that does system calls." msgstr "" "不論你使用的是什麼系統,你都可以實例化這些類別,因為它們不提供任何涉及系統呼" -"叫 (system calls) 的操作。" +"叫的操作。" #: ../../library/pathlib.rst:189 msgid "General properties" -msgstr "通用特性" +msgstr "通用屬性" #: ../../library/pathlib.rst:191 msgid "" @@ -222,12 +232,12 @@ msgid "" "comparable and orderable. These properties respect the flavour's case-" "folding semantics::" msgstr "" -"路徑物件是不可變 (immutable) 且 :term:`hashable` (可雜湊)的。相同類型的路徑" -"物件可以被比較和排序。這些特性遵守該類型的大小寫規則:" +"路徑物件是不可變 (immutable) 且可雜湊 (:term:`hashable`) 的。相同類型的路徑物" +"件可以被比較和排序。這些屬性遵守該類型的大小寫語意規則: ::" #: ../../library/pathlib.rst:204 msgid "Paths of a different flavour compare unequal and cannot be ordered::" -msgstr "不同類型的路徑物件在比較時視為不相等且無法被排序:" +msgstr "不同類型的路徑物件在比較時視為不相等且無法被排序: ::" #: ../../library/pathlib.rst:215 msgid "Operators" @@ -240,15 +250,16 @@ msgid "" "the drive is not reset when the argument is a rooted relative path (e.g., " "``r'\\foo'``)::" msgstr "" -"斜線運算子(slash operator)用於建立子路徑,就像是 :func:`os.path.join` 函式" -"一樣。如果引數是絕對路徑,則忽略前一個路徑。在 Windows 系統上,當引數是以根目" -"錄為基礎的相對路徑(例如,``r’\\foo’``),磁碟路徑不會被重置:" +"斜線運算子 (slash operator) 用於建立子路徑,就像是 :func:`os.path.join` 函式" +"一樣。如果引數是絕對路徑,則忽略前一個路徑。在 Windows 系統上,當引數是具有根" +"目錄的相對路徑(例如,``r’\\foo’``),磁碟機部分不會被重置: ::" #: ../../library/pathlib.rst:235 msgid "" "A path object can be used anywhere an object implementing :class:`os." "PathLike` is accepted::" -msgstr "路徑物件可以被用在任何可以使用 :class:`os.PathLike` 的地方:" +msgstr "" +"路徑物件可以被用在任何可以接受實作 :class:`os.PathLike` 的物件的地方: ::" #: ../../library/pathlib.rst:243 msgid "" @@ -256,44 +267,50 @@ msgid "" "native form, e.g. with backslashes under Windows), which you can pass to any " "function taking a file path as a string::" msgstr "" +"路徑的字串表示是原始的檔案系統路徑本身(以原生的形式,例如在 Windows 下是反斜" +"線),你可以將其傳入任何將檔案路徑當作字串傳入的函式: ::" #: ../../library/pathlib.rst:254 msgid "" "Similarly, calling :class:`bytes` on a path gives the raw filesystem path as " "a bytes object, as encoded by :func:`os.fsencode`::" msgstr "" +"類似地,對路徑呼叫 :class:`bytes` 會得到原始檔案系統路徑的 bytes 物件,就像使" +"用 :func:`os.fsencode` 編碼過的一樣: ::" #: ../../library/pathlib.rst:261 msgid "" "Calling :class:`bytes` is only recommended under Unix. Under Windows, the " "unicode form is the canonical representation of filesystem paths." msgstr "" +"只建議在 Unix 下呼叫 :class:`bytes`。在 Windows 裡,unicode 形式是檔案系統路" +"徑的權威表示方式。" #: ../../library/pathlib.rst:266 msgid "Accessing individual parts" -msgstr "" +msgstr "對個別組成的存取" #: ../../library/pathlib.rst:268 msgid "" "To access the individual \"parts\" (components) of a path, use the following " "property:" -msgstr "" +msgstr "可以使用下列屬性來存取路徑的個別「組成」(parts, components):" #: ../../library/pathlib.rst:273 msgid "A tuple giving access to the path's various components::" -msgstr "" +msgstr "一個可存取路徑的各組成的元組: ::" #: ../../library/pathlib.rst:283 msgid "(note how the drive and local root are regrouped in a single part)" -msgstr "" +msgstr "(特別注意磁碟機跟本地根目錄是如何被重新組合成一個單一組成)" #: ../../library/pathlib.rst:287 msgid "Methods and properties" -msgstr "方法 (Method) 與特性 (Property)" +msgstr "方法與屬性" #: ../../library/pathlib.rst:293 msgid "Pure paths provide the following methods and properties:" -msgstr "純路徑提供以下方法與特性:" +msgstr "純路徑提供以下方法與屬性:" #: ../../library/pathlib.rst:297 msgid "A string representing the drive letter or name, if any::" @@ -307,7 +324,7 @@ msgstr "UNC shares 也被視為磁碟機: ::" #: ../../library/pathlib.rst:313 msgid "A string representing the (local or global) root, if any::" -msgstr "若存在則為一個表示(局部或全域)根目錄的字串: ::" +msgstr "若存在則為一個表示(本地或全域)根目錄的字串: ::" #: ../../library/pathlib.rst:322 msgid "UNC shares always have a root::" @@ -318,6 +335,8 @@ msgid "" "If the path starts with more than two successive slashes, :class:`~pathlib." "PurePosixPath` collapses them::" msgstr "" +"如果路徑以超過兩個連續的斜線開頭,:class:`~pathlib.PurePosixPath` 會合併它" +"們: ::" #: ../../library/pathlib.rst:339 msgid "" @@ -325,6 +344,9 @@ msgid "" "paragraph `4.11 Pathname Resolution `_:" msgstr "" +"此行為符合 *The Open Group Base Specifications Issue 6*,章節 `4.11 路徑名稱" +"解析 `_:" #: ../../library/pathlib.rst:343 msgid "" @@ -332,33 +354,35 @@ msgid "" "an implementation-defined manner, although more than two leading slashes " "shall be treated as a single slash.\"*" msgstr "" +"*「以兩個連續斜線開頭的路徑名稱可以根據實作定義的方式來解讀,儘管如此,開頭超" +"過兩個斜線應該視為單一斜線。」*" #: ../../library/pathlib.rst:349 msgid "The concatenation of the drive and root::" -msgstr "" +msgstr "磁碟機與根目錄的結合: ::" #: ../../library/pathlib.rst:363 msgid "" "An immutable sequence providing access to the logical ancestors of the path::" -msgstr "" +msgstr "一個不可變的序列,為路徑邏輯上的祖先 (logical ancestors) 提供存取: ::" #: ../../library/pathlib.rst:374 msgid "" "The parents sequence now supports :term:`slices ` and negative index " "values." -msgstr "" +msgstr "父序列現在支援 :term:`slices ` 及負的索引值。" #: ../../library/pathlib.rst:379 msgid "The logical parent of the path::" -msgstr "" +msgstr "邏輯上的父路徑: ::" #: ../../library/pathlib.rst:385 msgid "You cannot go past an anchor, or empty path::" -msgstr "" +msgstr "你不能越過一個 anchor 或空路徑: ::" #: ../../library/pathlib.rst:395 msgid "This is a purely lexical operation, hence the following behaviour::" -msgstr "" +msgstr "這是一個純粹字句上的 (lexical) 運算,因此會有以下行為: ::" #: ../../library/pathlib.rst:401 msgid "" @@ -366,55 +390,62 @@ msgid "" "to first call :meth:`Path.resolve` so as to resolve symlinks and eliminate " "``\"..\"`` components." msgstr "" +"如果你想要沿任意的檔案系統路徑往上走,建議要先呼叫 :meth:`Path.resolve` 來解" +"析符號連結 (symlink) 及去除其中的 ``”..”``。" #: ../../library/pathlib.rst:408 msgid "" "A string representing the final path component, excluding the drive and " "root, if any::" msgstr "" +"最後的路徑組成 (final path component) 的字串表示,不包含任何磁碟機或根目" +"錄: ::" #: ../../library/pathlib.rst:414 msgid "UNC drive names are not considered::" -msgstr "" +msgstr "UNC 磁碟機名稱並沒有算在內: ::" #: ../../library/pathlib.rst:424 msgid "The file extension of the final component, if any::" -msgstr "" +msgstr "若存在則為最後的路徑組成的檔案副檔名: ::" #: ../../library/pathlib.rst:436 msgid "A list of the path's file extensions::" -msgstr "" +msgstr "路徑檔案副檔名的串列: ::" #: ../../library/pathlib.rst:448 msgid "The final path component, without its suffix::" -msgstr "" +msgstr "最後的路徑組成,不包括後綴 (suffix): ::" #: ../../library/pathlib.rst:460 msgid "" "Return a string representation of the path with forward slashes (``/``)::" -msgstr "" +msgstr "回傳一個使用正斜線 (``/``) 的路徑的字串表示: ::" #: ../../library/pathlib.rst:471 msgid "" "Represent the path as a ``file`` URI. :exc:`ValueError` is raised if the " "path isn't absolute." msgstr "" +"以 ``file`` URI 來表示一個路徑。如果不是絕對路徑會引發 :exc:`ValueError`。" #: ../../library/pathlib.rst:484 msgid "" "Return whether the path is absolute or not. A path is considered absolute " "if it has both a root and (if the flavour allows) a drive::" msgstr "" +"回傳一個路徑是否是絕對路徑。一個路徑被視為絕對路徑的條件是它同時有根目錄及" +"(如果該系統類型允許的話)磁碟機: ::" #: ../../library/pathlib.rst:504 msgid "Return whether or not this path is relative to the *other* path." -msgstr "" +msgstr "回傳此路徑是否為 *other* 路徑的相對路徑。" #: ../../library/pathlib.rst:516 msgid "" "Passing additional arguments is deprecated; if supplied, they are joined " "with *other*." -msgstr "" +msgstr "額外引數的傳入已棄用;如果有的話,它們會與 *other* 連接在一起。" #: ../../library/pathlib.rst:521 msgid "" @@ -422,42 +453,49 @@ msgid "" "reserved under Windows, ``False`` otherwise. With :class:`PurePosixPath`, " "``False`` is always returned." msgstr "" +"對 :class:`PureWindowsPath` 來說,當路徑在 Windows 下被視為保留的話會回傳 " +"``True``,否則回傳 ``False``。對 :class:`PurePosixPath` 來說,總是回傳 " +"``False``。" #: ../../library/pathlib.rst:530 msgid "" "File system calls on reserved paths can fail mysteriously or have unintended " "effects." -msgstr "" +msgstr "在保留路徑上的檔案系統呼叫會神秘地失敗或有意外的效果。" #: ../../library/pathlib.rst:536 msgid "" "Calling this method is equivalent to combining the path with each of the " "given *pathsegments* in turn::" -msgstr "" +msgstr "呼叫此方法會依序結合每個所給定的 *pathsegments* 到路徑上: ::" #: ../../library/pathlib.rst:551 msgid "" "Match this path against the provided glob-style pattern. Return ``True`` if " "matching is successful, ``False`` otherwise." msgstr "" +"將路徑與 glob 形式的樣式 (glob-style pattern) 做比對。如果比對成功則回傳 " +"``True``,否則回傳 ``False``。" #: ../../library/pathlib.rst:554 msgid "" "If *pattern* is relative, the path can be either relative or absolute, and " "matching is done from the right::" msgstr "" +"如果 *pattern* 是相對的,則路徑可以是相對或絕對的,而且會從右邊來完成比" +"對: ::" #: ../../library/pathlib.rst:564 msgid "" "If *pattern* is absolute, the path must be absolute, and the whole path must " "match::" -msgstr "" +msgstr "如果 *pattern* 是絕對的,則路徑必須是絕對的,且整個路徑都要比對到: ::" #: ../../library/pathlib.rst:572 msgid "" "The *pattern* may be another path object; this speeds up matching the same " "pattern against multiple files::" -msgstr "" +msgstr "*pattern* 可以是另一個路徑物件;這會加速對多個檔案比對相同的樣式: ::" #: ../../library/pathlib.rst:579 msgid "Accepts an object implementing the :class:`os.PathLike` interface." @@ -465,12 +503,12 @@ msgstr "接受一個有實作 :class:`os.PathLike` 介面的物件。" #: ../../library/pathlib.rst:582 msgid "As with other methods, case-sensitivity follows platform defaults::" -msgstr "" +msgstr "像其它方法一樣,是否區分大小寫會遵循平台的預設行為: ::" #: ../../library/pathlib.rst:589 msgid "" "Set *case_sensitive* to ``True`` or ``False`` to override this behaviour." -msgstr "" +msgstr "將 *case_sensitive* 設定成 ``True`` 或 ``False`` 會覆蓋這個行為。" #: ../../library/pathlib.rst:591 ../../library/pathlib.rst:934 #: ../../library/pathlib.rst:1347 @@ -482,6 +520,8 @@ msgid "" "Compute a version of this path relative to the path represented by *other*. " "If it's impossible, :exc:`ValueError` is raised::" msgstr "" +"計算這個路徑相對於 *other* 所表示路徑的版本。如果做不到會引發 :exc:" +"`ValueError`: ::" #: ../../library/pathlib.rst:612 msgid "" @@ -490,6 +530,9 @@ msgid "" "path. In all other cases, such as the paths referencing different drives, :" "exc:`ValueError` is raised.::" msgstr "" +"當 *walk_up* 是 False(預設值),路徑必須以 *other* 為開始。當此引數是 True," +"可能會加入 ``..`` 以組成相對路徑。在其他情況下,例如路徑參考到不同的磁碟機," +"則會引發 :exc:`ValueError`: ::" #: ../../library/pathlib.rst:627 msgid "" @@ -498,30 +541,37 @@ msgid "" "*walk_up* option as it assumes that no symlinks are present in the path; " "call :meth:`~Path.resolve` first if necessary to resolve symlinks." msgstr "" +"這個函式是 :class:`PurePath` 的一部分且可以在字串上運作。它不會檢查或存取實際" +"的檔案架構。這會影響到 *walk_up* 選項,因為它假設路徑中沒有符號連結;如果需要" +"解析符號連結的話可以先呼叫 :meth:`~Path.resolve`。" #: ../../library/pathlib.rst:633 msgid "" "The *walk_up* parameter was added (old behavior is the same as " "``walk_up=False``)." -msgstr "" +msgstr "加入 *walk_up* 參數(舊的行為和 ``walk_up=False`` 相同)。" #: ../../library/pathlib.rst:638 msgid "" "Passing additional positional arguments is deprecated; if supplied, they are " "joined with *other*." -msgstr "" +msgstr "額外位置引數的傳入已棄用;如果有的話,它們會與 *other* 連接在一起。" #: ../../library/pathlib.rst:643 msgid "" "Return a new path with the :attr:`name` changed. If the original path " "doesn't have a name, ValueError is raised::" msgstr "" +"回傳一個修改 :attr:`name` 後的新路徑。如果原始路徑沒有名稱則引發 " +"ValueError: ::" #: ../../library/pathlib.rst:660 msgid "" "Return a new path with the :attr:`stem` changed. If the original path " "doesn't have a name, ValueError is raised::" msgstr "" +"回傳一個修改 :attr:`stem` 後的新路徑。如果原始路徑沒有名稱則引發 " +"ValueError: ::" #: ../../library/pathlib.rst:684 msgid "" @@ -529,6 +579,8 @@ msgid "" "doesn't have a suffix, the new *suffix* is appended instead. If the " "*suffix* is an empty string, the original suffix is removed::" msgstr "" +"回傳一個修改 :attr:`suffix` 後的新路徑。如果原始路徑沒有後綴,新的 *suffix* " +"會附加在後面。如果 *suffix* 是一個空字串,原來的後綴會被移除: ::" #: ../../library/pathlib.rst:701 msgid "" @@ -537,6 +589,9 @@ msgid "" "such as from :attr:`parent` and :meth:`relative_to`. Subclasses may override " "this method to pass information to derivative paths, for example::" msgstr "" +"透過結合給定的 *pathsegments* 建立一個相同類型的新路徑物件,當一個衍生路徑被" +"建立的時候會呼叫這個方法,例如從 :attr:`parent` 和 :meth:`relative_to` 建立衍" +"生路徑。子類別可以覆寫此方法來傳遞資訊給衍生路徑,例如: ::" #: ../../library/pathlib.rst:727 msgid "Concrete paths"