diff --git a/library/os.path.po b/library/os.path.po index bf37ceefeb..29ba4e2410 100644 --- a/library/os.path.po +++ b/library/os.path.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-17 17:39+0800\n" -"PO-Revision-Date: 2023-07-13 14:06+0800\n" +"PO-Revision-Date: 2023-07-21 12:35+0800\n" "Last-Translator: Po-Chuan Chen \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -49,8 +49,8 @@ msgid "" "explicitly when an application desires shell-like path expansion. (See also " "the :mod:`glob` module.)" msgstr "" -"與 Unix shell 不同,Python 不會\\ *自動*\\ 進行路徑展開(path expansions)。" -"當應用程式需要進行類似 shell 的路徑展開時,可以明確地呼叫 :func:`expanduser` " +"與 Unix shell 不同,Python 不會\\ *自動*\\ 進行路徑展開 (path expansions)。當" +"應用程式需要進行類似 shell 的路徑展開時,可以明確地呼叫 :func:`expanduser` " "和 :func:`expandvars` 等函式。(另請參閱 :mod:`glob` 模組。)" #: ../../library/os.path.rst:26 @@ -146,7 +146,7 @@ msgid "" "empty. Unlike :func:`commonprefix`, this returns a valid path." msgstr "" "回傳序列 *paths* 中每個路徑名的最長共同子路徑。如果 *paths* 同時包含絕對路徑" -"和相對路徑、*paths* 位於不同的磁碟機或 *paths* 為空,則引發 :exc:" +"和相對路徑、*paths* 位於不同的驅動機或 *paths* 為空,則引發 :exc:" "`ValueError`。與 :func:`commonprefix` 不同,此函式回傳的是有效路徑。" #: ../../library/os.path.rst:88 ../../library/os.path.rst:415 @@ -250,7 +250,7 @@ msgid "" "If the expansion fails or if the path does not begin with a tilde, the path " "is returned unchanged." msgstr "" -"如果展開失敗或路徑不以波浪符號(tilde)開頭,則回傳原始路徑,不做任何變更。" +"如果展開失敗或路徑不以波浪符號 (tilde) 開頭,則回傳原始路徑,不做任何變更。" #: ../../library/os.path.rst:180 msgid "No longer uses :envvar:`HOME` on Windows." @@ -263,12 +263,16 @@ msgid "" "variable *name*. Malformed variable names and references to non-existing " "variables are left unchanged." msgstr "" +"回傳已展開環境變數的引數。形如 ``$name`` 或 ``${name}`` 的子字串會被替換為環" +"境變數 *name* 的值。無效的變數名稱和對不存在變數的引用保持不變。" #: ../../library/os.path.rst:194 msgid "" "On Windows, ``%name%`` expansions are supported in addition to ``$name`` and " "``${name}``." msgstr "" +"在 Windows 上,除了支援 ``$name`` 和 ``${name}`` 形式的展開外,還支援 ``%name" +"%`` 形式的展開。" #: ../../library/os.path.rst:203 msgid "" @@ -277,6 +281,8 @@ msgid "" "`time` module). Raise :exc:`OSError` if the file does not exist or is " "inaccessible." msgstr "" +"回傳 *path* 的最後存取時間。回傳值是一個浮點數,表示自紀元(參見 :mod:`time` " +"模組)以來的秒數。如果檔案不存在或無法存取,則引發 :exc:`OSError`。" #: ../../library/os.path.rst:210 msgid "" @@ -285,6 +291,8 @@ msgid "" "the :mod:`time` module). Raise :exc:`OSError` if the file does not exist or " "is inaccessible." msgstr "" +"回傳 *path* 的最後修改時間。回傳值是一個浮點數,表示自紀元(參見 :mod:`time` " +"模組)以來的秒數。如果檔案不存在或無法存取,則引發 :exc:`OSError`。" #: ../../library/os.path.rst:220 msgid "" @@ -294,12 +302,18 @@ msgid "" "since the epoch (see the :mod:`time` module). Raise :exc:`OSError` if the " "file does not exist or is inaccessible." msgstr "" +"回傳系統的 ctime。在某些系統(如 Unix)上,這是最後一次元數據 (metadata) 更改" +"的時間,在其他系統(如 Windows)上則是 *path* 的建立時間。回傳值是一個浮點" +"數,表示自紀元(參見 :mod:`time` 模組)以來的秒數。如果檔案不存在或無法存" +"取),則引發 :exc:`OSError`。" #: ../../library/os.path.rst:232 msgid "" "Return the size, in bytes, of *path*. Raise :exc:`OSError` if the file does " "not exist or is inaccessible." msgstr "" +"回傳 *path* 的大小(以位元組為單位)。如果檔案不存在或無法存取,則引發 :exc:" +"`OSError`。" #: ../../library/os.path.rst:241 msgid "" @@ -307,6 +321,8 @@ msgid "" "begins with a slash, on Windows that it begins with a (back)slash after " "chopping off a potential drive letter." msgstr "" +"如果 *path* 是絕對路徑名,則回傳 ``True``。在 Unix 上,這表示它以斜線開頭;" +"在 Windows 上,表示在去除可能的驅動機字母後,以(反)斜線開頭。" #: ../../library/os.path.rst:251 msgid "" @@ -314,6 +330,9 @@ msgid "" "follows symbolic links, so both :func:`islink` and :func:`isfile` can be " "true for the same path." msgstr "" +"如果 *path* 是一個\\ :func:`已存在的 `\\ 常規檔案,則回傳 ``True``。" +"這將跟隨符號連結,因此同一個路徑可以同時回傳 :func:`islink` 和 :func:" +"`isfile` 的結果為真。" #: ../../library/os.path.rst:261 msgid "" @@ -321,6 +340,9 @@ msgid "" "follows symbolic links, so both :func:`islink` and :func:`isdir` can be true " "for the same path." msgstr "" +"如果 *path* 是一個\\ :func:`已存在的 `\\ 目錄,則回傳 ``True``。這將" +"跟隨符號連結,因此同一個路徑可以同時回傳 :func:`islink` 和 :func:`isfile` 的" +"結果為真。" #: ../../library/os.path.rst:271 msgid "" @@ -328,6 +350,8 @@ msgid "" "entry that is a junction. Always return ``False`` if junctions are not " "supported on the current platform." msgstr "" +"如果 *path* 是指向\\ :func:`已存在的 `\\ 目錄條目且為聯接點 " +"(junction),則回傳 ``True``。如果目前平台不支援聯接點,則始終返回 ``False``。" #: ../../library/os.path.rst:280 msgid "" @@ -335,6 +359,8 @@ msgid "" "entry that is a symbolic link. Always ``False`` if symbolic links are not " "supported by the Python runtime." msgstr "" +"如果 *path* 是指向\\ :func:`已存在的 `\\ 目錄項目且為符號連結,則回" +"傳 ``True``。如果 Python 執行時不支援符號連結,則始終回傳 ``False``。" #: ../../library/os.path.rst:290 msgid "" @@ -348,10 +374,17 @@ msgid "" "UNC are always mount points, and for any other path ``GetVolumePathName`` is " "called to see if it is different from the input path." msgstr "" +"如果路徑名 *path* 是一個掛載點 (:dfn:`mount point`),則回傳 ``True``:即在檔" +"案系統中掛載了不同的檔案系統。在 POSIX 系統上,該函式檢查 *path* 的父目錄 :" +"file:`{path}/..` 是否位於不同的設備上,或者 :file:`{path}/..` 和 *path* 是否" +"指向同一設備上的相同 i-node --- 這應該能夠檢測出所有 Unix 和 POSIX 變體的掛載" +"點。但無法可靠地檢測出相同檔案系統上的綁定掛載點 (bind mount)。在 Windows " +"上,以驅動機字母開頭的根目錄和 UNC 共享路徑始終是掛載點,對於任何其他路徑,會" +"呼叫 ``GetVolumePathName`` 函式來檢查它是否與輸入路徑不同。" #: ../../library/os.path.rst:300 msgid "Support for detecting non-root mount points on Windows." -msgstr "" +msgstr "支援在 Windows 上檢測非根目錄的掛載點。" #: ../../library/os.path.rst:309 msgid "" @@ -361,6 +394,9 @@ msgid "" "temporary build directories, package caches, and other IO-intensive " "operations." msgstr "" +"如果路徑名 *path* 位於 Windows Dev 驅動機上,則回傳 ``True``。Dev 驅動機針對" +"開發人員場景進行了優化,提供更快的讀寫檔案性能。建議將其用於原始程式碼、臨時" +"建置目錄、封包快取和其他 I/O 密集型操作。" #: ../../library/os.path.rst:315 msgid "" @@ -369,6 +405,9 @@ msgid "" "Dev Drives. See `the Windows documentation `_ for information on enabling and creating Dev Drives." msgstr "" +"可能會對無效的路徑引發錯誤,例如,沒有可識別的驅動機的路徑,但在不支援 Dev 磁" +"碟機的平台上返回 ``False``。請參閱 `Windows 文件 `_\\ 以了解有關啟用和建立 Dev 驅動機的資訊。" #: ../../library/os.path.rst:320 msgid ":ref:`Availability `: Windows." @@ -384,6 +423,10 @@ msgid "" "requires both a drive and a root), then all previous segments are ignored " "and joining continues from the absolute path segment." msgstr "" +"聰明地連接一個或多個路徑段。回傳值是 *path* 和 *\\*paths* 的所有成員的串聯," +"每個非空部分後面都有一個目錄分隔符號,除了最後一個部分。換句話說,如果最後一" +"個部分為空或以分隔符號結尾,結果只會以分隔符號結尾。如果一個段是絕對路徑(在 " +"Windows 上需要驅動機和根),則忽略所有之前的段,並從絕對路徑段繼續連接。" #: ../../library/os.path.rst:335 msgid "" @@ -394,10 +437,15 @@ msgid "" "join(\"c:\", \"foo\")`` represents a path relative to the current directory " "on drive :file:`C:` (:file:`c:foo`), not :file:`c:\\\\foo`." msgstr "" +"在 Windows 上,當遇到根路徑段(例如,``r'\\foo'``)時,驅動機不會被重置。如果" +"一個段位於不同的驅動機上,或者是絕對路徑,則將忽略所有之前的段並重置驅動機。" +"請注意,由於每個驅動機都有當前目錄,``os.path.join(\"c:\", \"foo\")`` 表示相" +"對於驅動機 :file:`C:` 的當前目錄的路徑(即 :file:`c:foo`),而不是 :file:`c:" +"\\\\foo`。" #: ../../library/os.path.rst:342 msgid "Accepts a :term:`path-like object` for *path* and *paths*." -msgstr "" +msgstr "*path* 和 *paths* 接受 :term:`path-like object` 作為參數。" #: ../../library/os.path.rst:348 msgid "" @@ -405,6 +453,8 @@ msgid "" "pathname to lowercase, and also convert forward slashes to backward slashes. " "On other operating systems, return the path unchanged." msgstr "" +"將路徑名的大小寫規範化。在 Windows 上,將路徑名中的所有字元轉換為小寫,並將正" +"斜線轉換為反斜線。在其他作業系統上,回傳原始路徑。" #: ../../library/os.path.rst:358 msgid "" @@ -414,6 +464,10 @@ msgid "" "that contains symbolic links. On Windows, it converts forward slashes to " "backward slashes. To normalize case, use :func:`normcase`." msgstr "" +"通過合併多餘的分隔符號和上層引用來標準化路徑名,使得 ``A//B``、``A/B/``、" +"``A/./B`` 和 ``A/foo/../B`` 都變成 ``A/B``。這種字串操作可能會改變包含符號連" +"結的路徑的含義。在 Windows 上,它將正斜線轉換為反斜線。要標準化大小寫,請使" +"用 :func:`normcase`。" #: ../../library/os.path.rst:365 msgid "" @@ -424,6 +478,11 @@ msgid "" "interpreted in an implementation-defined manner, although more than two " "leading characters shall be treated as a single character." msgstr "" +"在 POSIX 系統中,根據 `IEEE Std 1003.1 2013 版; 4.13 Pathname Resolution " +"`_ 標準,如果一個路徑名恰好以兩個斜線開頭,則在前導字元後的第" +"一個部分可能會以由實作品自行定義的方式解釋,雖然多於兩個前導字元應該被視為單" +"個字元。" #: ../../library/os.path.rst:378 msgid "" @@ -431,6 +490,8 @@ msgid "" "symbolic links encountered in the path (if they are supported by the " "operating system)." msgstr "" +"回傳指定檔案名稱的規範路徑,消除路徑中遇到的所有符號連結(如果作業系統支" +"援)。" #: ../../library/os.path.rst:382 msgid "" @@ -439,6 +500,9 @@ msgid "" "resolved as far as possible and any remainder is appended without checking " "whether it exists." msgstr "" +"如果路徑不存在或遇到符號連結迴圈,且 *strict* 為 ``True``,則引發 :exc:" +"`OSError`。如果 *strict* 為 ``False``,則將路徑盡可能解析,並將任何剩餘部分附" +"加在後面,而不檢查其是否存在。" #: ../../library/os.path.rst:388 msgid "" @@ -446,16 +510,18 @@ msgid "" "canonical, which differs slightly between Windows and UNIX with respect to " "how links and subsequent path components interact." msgstr "" +"此函式模擬作業系統使路徑成為規範的過程,Windows 和 UNIX 之間在鏈接和後續路徑" +"部份交互方式方面略有不同。" #: ../../library/os.path.rst:392 msgid "" "Operating system APIs make paths canonical as needed, so it's not normally " "necessary to call this function." -msgstr "" +msgstr "作業系統的 API 會根據需要自動使路徑正則,因此通常不需要呼叫此函式。" #: ../../library/os.path.rst:398 msgid "Symbolic links and junctions are now resolved on Windows." -msgstr "" +msgstr "在 Windows 上,現在會解析符號連結和連接點。" #: ../../library/os.path.rst:401 msgid "The *strict* parameter was added." @@ -469,10 +535,13 @@ msgid "" "*start*. On Windows, :exc:`ValueError` is raised when *path* and *start* " "are on different drives." msgstr "" +"從當前目錄或可選的 *start* 目錄回傳到 *path* 的相對檔案路徑。這是一個路徑計" +"算:不會訪問檔案系統來確認 *path* 或 *start* 的存在或屬性。在 Windows 上,當 " +"*path* 和 *start* 在不同的驅動機上時,會引發 :exc:`ValueError`。" #: ../../library/os.path.rst:413 msgid "*start* defaults to :attr:`os.curdir`." -msgstr "" +msgstr "*start* 的預設值為 :attr:`os.curdir`。" #: ../../library/os.path.rst:423 msgid "" @@ -480,6 +549,9 @@ msgid "" "directory. This is determined by the device number and i-node number and " "raises an exception if an :func:`os.stat` call on either pathname fails." msgstr "" +"如果兩個路徑名引數指向同一個檔案或目錄,則回傳 ``True``。這是通過設備編號和 " +"i-node 編號來確定的,如果對任一路徑名的 :func:`os.stat` 呼叫失敗,則會引發異" +"常。" #: ../../library/os.path.rst:429 ../../library/os.path.rst:445 #: ../../library/os.path.rst:461 @@ -488,13 +560,13 @@ msgstr "新增對 Windows 的支援。" #: ../../library/os.path.rst:432 msgid "Windows now uses the same implementation as all other platforms." -msgstr "" +msgstr "現在在 Windows 上使用與其他所有平台相同的實作方式。" #: ../../library/os.path.rst:441 msgid "" "Return ``True`` if the file descriptors *fp1* and *fp2* refer to the same " "file." -msgstr "" +msgstr "如果文件描述符 *fp1* 和 *fp2* 指向同一個檔案,則回傳 ``True``。" #: ../../library/os.path.rst:454 msgid "" @@ -503,6 +575,9 @@ msgid "" "lstat`, or :func:`os.stat`. This function implements the underlying " "comparison used by :func:`samefile` and :func:`sameopenfile`." msgstr "" +"如果 stat 值組 *stat1* 和 *stat2* 指向同一個檔案,則回傳 ``True``。這些結構可" +"能由 :func:`os.fstat`、:func:`os.lstat` 或 :func:`os.stat` 回傳。此函式使用 :" +"func:`samefile` 和 :func:`sameopenfile` 實現了底層比較。" #: ../../library/os.path.rst:470 msgid "" @@ -516,6 +591,13 @@ msgid "" "*path* (but the strings may differ). Also see the functions :func:`dirname` " "and :func:`basename`." msgstr "" +"將路徑名 *path* 拆分為 ``(head, tail)`` 一對,其中 *tail* 是最後一個路徑名部" +"份,*head* 是在它之前的所有部分。*tail* 部分不會包含斜線;如果 *path* 以斜線" +"結尾,則 *tail* 將為空。如果 *path* 中沒有斜線,則 *head* 將為空。如果 " +"*path* 為空,則 *head* 和 *tail* 都為空。除非 *head* 是根目錄(僅有一個或多個" +"斜線),否則從 *head* 中刪除尾部的斜線。在所有情況下,``join(head, tail)`` 回" +"傳指向與 *path* 相同位置的路徑(但字串可能不同)。還可以參考函式 :func:" +"`dirname` 和 :func:`basename`。" #: ../../library/os.path.rst:486 msgid "" @@ -524,22 +606,31 @@ msgid "" "specifications, *drive* will always be the empty string. In all cases, " "``drive + tail`` will be the same as *path*." msgstr "" +"將路徑名 *path* 拆分為 ``(drive, tail)`` 一對,其中 *drive* 是掛載點或空字" +"串。在不使用驅動機規範的系統上,*drive* 將始終為空字串。在所有情況下," +"``drive + tail`` 將與 *path* 相同。" #: ../../library/os.path.rst:491 msgid "" "On Windows, splits a pathname into drive/UNC sharepoint and relative path." -msgstr "" +msgstr "在 Windows 上,將路徑名拆分為驅動機或 UNC 共享點以及相對路徑。" #: ../../library/os.path.rst:493 msgid "" "If the path contains a drive letter, drive will contain everything up to and " "including the colon::" msgstr "" +"如果路徑包含驅動機字母,則 *drive* 將包含從頭到冒號(包括冒號)的所有內容:\n" +"\n" +"::" #: ../../library/os.path.rst:499 msgid "" "If the path contains a UNC path, drive will contain the host name and share::" msgstr "" +"如果路徑包含 UNC 路徑,則驅動機將包含主機名和共享名:\n" +"\n" +"::" #: ../../library/os.path.rst:511 msgid "" @@ -549,6 +640,10 @@ msgid "" "may be the empty string. In all cases, ``drive + root + tail`` will be the " "same as *path*." msgstr "" +"將路徑名 *path* 拆分為一個 3 項值組 ``(drive, root, tail)``,其中 *drive* 是" +"設備名稱或掛載點,*root* 是驅動機後的分隔符字串,*tail* 是在根後的所有內容。" +"這些項目中的任何一個都可能是空字串。在所有情況下,``drive + root + tail`` 將" +"與 *path* 相同。" #: ../../library/os.path.rst:517 msgid "" @@ -558,6 +653,13 @@ msgid "" "Pathname Resolution `_.) For example::" msgstr "" +"在 POSIX 系統上,*drive* 始終為空。*root* 可能為空(如果 *path* 是相對路" +"徑),一個斜線(如果 *path* 是絕對路徑),或者兩個斜線(根據 `IEEE Std " +"1003.1-2017; 4.13 Pathname Resolution `_ 的實作定義)。例" +"如:\n" +"\n" +"::" #: ../../library/os.path.rst:530 msgid "" @@ -565,6 +667,10 @@ msgid "" "device name. The *root* may be empty, a forward slash, or a backward slash. " "For example::" msgstr "" +"在 Windows 上,*drive* 可能為空、驅動機名稱、UNC 共享或設備名稱。*root* 可能" +"為空,斜線或反斜線。例如:\n" +"\n" +"::" #: ../../library/os.path.rst:544 msgid "" @@ -572,28 +678,42 @@ msgid "" "ext == path``, and the extension, *ext*, is empty or begins with a period " "and contains at most one period." msgstr "" +"將路徑名 *path* 拆分為一對 ``(root, ext)``,使得 ``root + ext == path``,且副" +"檔名 *ext* 為空或以點開頭且最多包含一個點 (period)。" #: ../../library/os.path.rst:548 msgid "If the path contains no extension, *ext* will be ``''``::" msgstr "" +"如果路徑不包含副檔名,則 *ext* 將為 ``''``:\n" +"\n" +"::" #: ../../library/os.path.rst:553 msgid "" "If the path contains an extension, then *ext* will be set to this extension, " "including the leading period. Note that previous periods will be ignored::" msgstr "" +"如果路徑包含副檔名,則 *ext* 將設置為該副檔名,包括前導的點。請注意,前面的點" +"將被忽略:\n" +"\n" +"::" #: ../../library/os.path.rst:561 msgid "" "Leading periods of the last component of the path are considered to be part " "of the root::" msgstr "" +"路徑的最後一個部份的前導點被認為是根的一部分:\n" +"\n" +"::" #: ../../library/os.path.rst:575 msgid "" "``True`` if arbitrary Unicode strings can be used as file names (within " "limitations imposed by the file system)." msgstr "" +"如果可以使用任意的 Unicode 字串作為檔案名(在檔案系統所施加的限制範圍內),則" +"回傳 ``True``。" #: ../../library/os.path.rst:10 msgid "path"