Skip to content

Commit

Permalink
Translate library/pkgutil.po (#836)
Browse files Browse the repository at this point in the history
Co-authored-by: Payon <ken71301@hotmail.com>
Co-authored-by: mindihx <ymhuang.ymh@gmail.com>
  • Loading branch information
3 people authored Jun 17, 2024
1 parent 5334cb2 commit e0ffdb0
Showing 1 changed file with 86 additions and 22 deletions.
108 changes: 86 additions & 22 deletions library/pkgutil.po
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001-2022, Python Software Foundation
# Copyright (C) 2001-2024, Python Software Foundation
# This file is distributed under the same license as the Python package.
#
# Translators:
# Matt Wang <mattwang44@gmail.com>, 2024
msgid ""
msgstr ""
"Project-Id-Version: Python 3.12\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-05-09 00:03+0000\n"
"PO-Revision-Date: 2018-05-23 16:07+0000\n"
"Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n"
"PO-Revision-Date: 2024-03-08 16:07+0000\n"
"Last-Translator: Matt Wang <mattwang44@gmail.com>\n"
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
"tw)\n"
"Language: zh_TW\n"
Expand All @@ -20,7 +20,7 @@ msgstr ""

#: ../../library/pkgutil.rst:2
msgid ":mod:`!pkgutil` --- Package extension utility"
msgstr ""
msgstr ":mod:`!pkgutil` --- 套件擴充工具程式"

#: ../../library/pkgutil.rst:7
msgid "**Source code:** :source:`Lib/pkgutil.py`"
Expand All @@ -30,17 +30,19 @@ msgstr "**原始碼:**\\ :source:`Lib/pkgutil.py`"
msgid ""
"This module provides utilities for the import system, in particular package "
"support."
msgstr ""
msgstr "此模組提供了引入系統 (import system) 的工具程式,特別是套件相關支援。"

#: ../../library/pkgutil.rst:16
msgid "A namedtuple that holds a brief summary of a module's info."
msgstr ""
msgstr "一個包含模組資訊之簡短摘要的附名元組 (namedtuple)。"

#: ../../library/pkgutil.rst:22
msgid ""
"Extend the search path for the modules which comprise a package. Intended "
"use is to place the following code in a package's :file:`__init__.py`::"
msgstr ""
"擴充組成一個套件之模組的搜尋路徑。預期用法是將以下程式碼放入套件的 :file:"
"`__init__.py`: ::"

#: ../../library/pkgutil.rst:28
msgid ""
Expand All @@ -49,6 +51,9 @@ msgid ""
"This is useful if one wants to distribute different parts of a single "
"logical package as multiple directories."
msgstr ""
"對於 :data:`sys.path` 上具有與套件名稱相符的子目錄的每個目錄,將該子目錄新增"
"至套件的 :attr:`__path__` 中。如果想要將單一邏輯套件的不同部分給分配到多個目"
"錄時,這會非常有用。"

#: ../../library/pkgutil.rst:33
msgid ""
Expand All @@ -60,13 +65,20 @@ msgid ""
"pkg` file are added to the path, regardless of whether they exist on the "
"filesystem. (This is a feature.)"
msgstr ""
"它還會尋找 :file:`\\*.pkg` 檔案,其中開頭的 ``*`` 與 *name* 引數相符。此功能"
"類似於 :file:`\\*.pth` 檔案(更多資訊請參閱 :mod:`site` 模組),但他不特別處"
"理以 ``import`` 為開頭的行。:file:`\\*.pkg` 檔案從表面上看是受信任的:除了檢"
"查重複項之外,在 :file:`\\*.pkg` 檔案中找到的所有條目都將新增到路徑中,無論它"
"們是否存在於檔案系統。(這是一個功能。)"

#: ../../library/pkgutil.rst:41
msgid ""
"If the input path is not a list (as is the case for frozen packages) it is "
"returned unchanged. The input path is not modified; an extended copy is "
"returned. Items are only appended to the copy at the end."
msgstr ""
"如果輸入路徑不是串列(像是凍結套件 (frozen package) 的情況),它將原封不動地"
"被回傳。輸入路徑不會被修改;而是回傳擴充後的副本。僅將項目附加到副本的尾端。"

#: ../../library/pkgutil.rst:45
msgid ""
Expand All @@ -76,10 +88,13 @@ msgid ""
"may cause this function to raise an exception (in line with :func:`os.path."
"isdir` behavior)."
msgstr ""
":data:`sys.path` 被假設是一個序列,:data:`sys.path` 中的項目裡,若不是代表現"
"存目錄的字串則將被忽略。:data:`sys.path` 上用作檔案名稱時導致錯誤的 Unicode "
"項目可能會導致此函式引發例外(與 :func:`os.path.isdir` 行為一致)。"

#: ../../library/pkgutil.rst:53
msgid "Retrieve a module :term:`loader` for the given *fullname*."
msgstr ""
msgstr "取得給定之 *fullname* 的模組 :term:`loader`。"

#: ../../library/pkgutil.rst:55
msgid ""
Expand All @@ -88,6 +103,9 @@ msgid ""
"returns the loader rather than the full :class:`importlib.machinery."
"ModuleSpec`."
msgstr ""
"這是一個 :func:`importlib.util.find_spec` 的向後相容包裝器,它將大多數的失敗"
"轉換為 :exc:`ImportError` 並且僅回傳載入器而不是完整的 :class:`importlib."
"machinery.ModuleSpec`。"

#: ../../library/pkgutil.rst:60 ../../library/pkgutil.rst:81
#: ../../library/pkgutil.rst:96 ../../library/pkgutil.rst:120
Expand All @@ -96,34 +114,39 @@ msgid ""
"Updated to be based directly on :mod:`importlib` rather than relying on the "
"package internal :pep:`302` import emulation."
msgstr ""
"更新為直接基於 :mod:`importlib`,而不是依賴套件內部 :pep:`302` 的引入模擬 "
"(import emulation)。"

#: ../../library/pkgutil.rst:64 ../../library/pkgutil.rst:100
msgid "Updated to be based on :pep:`451`"
msgstr "基於 :pep:`451` 來更新"

#: ../../library/pkgutil.rst:68 ../../library/pkgutil.rst:104
msgid "Use :func:`importlib.util.find_spec` instead."
msgstr ""
msgstr "改用 :func:`importlib.util.find_spec`。"

#: ../../library/pkgutil.rst:73
msgid "Retrieve a :term:`finder` for the given *path_item*."
msgstr ""
msgstr "取得給定之 *path_item* 的 :term:`finder`。"

#: ../../library/pkgutil.rst:75
msgid ""
"The returned finder is cached in :data:`sys.path_importer_cache` if it was "
"newly created by a path hook."
msgstr ""
"如果回傳的尋檢器 (finder) 是由路徑勾點 (path hook) 所新建立的,則它會被快取"
"在 :data:`sys.path_importer_cache` 中。"

#: ../../library/pkgutil.rst:78
msgid ""
"The cache (or part of it) can be cleared manually if a rescan of :data:`sys."
"path_hooks` is necessary."
msgstr ""
"如果需要重新掃描 :data:`sys.path_hooks`,可以手動清除快取(或部分快取)。"

#: ../../library/pkgutil.rst:88
msgid "Get a :term:`loader` object for *module_or_name*."
msgstr ""
msgstr "取得 *module_or_name* 的 :term:`loader` 物件。"

#: ../../library/pkgutil.rst:90
msgid ""
Expand All @@ -133,43 +156,53 @@ msgid ""
"not already imported, its containing package (if any) is imported, in order "
"to establish the package ``__path__``."
msgstr ""
"如果可以透過正常引入機制存取模組或套件,則回傳該機制相關部分的包裝器。如果找"
"不到或無法引入模組,則回傳 ``None``。如果指定的模組尚未被引入,則引入其包含的"
"套件(如有存在)以建立套件 ``__path__``。"

#: ../../library/pkgutil.rst:109
msgid "Yield :term:`finder` objects for the given module name."
msgstr ""
msgstr "yield 給定模組名稱的 :term:`finder` 物件。"

#: ../../library/pkgutil.rst:111
msgid ""
"If fullname contains a ``'.'``, the finders will be for the package "
"containing fullname, otherwise they will be all registered top level finders "
"(i.e. those on both :data:`sys.meta_path` and :data:`sys.path_hooks`)."
msgstr ""
"如果 fullname 包含 ``'.'``,則尋檢器將針對包含 fullname 的套件,否則它們全部"
"會是在頂層被註冊的尋檢器(即 :data:`sys.meta_path` 和 :data:`sys.path_hooks` "
"上的尋檢器)。"

#: ../../library/pkgutil.rst:115
msgid ""
"If the named module is in a package, that package is imported as a side "
"effect of invoking this function."
msgstr ""
"如果指定的模組位於套件中,則作為呼叫此函式的副作用 (side effect) ,該套件會被"
"引入。"

#: ../../library/pkgutil.rst:118
msgid "If no module name is specified, all top level finders are produced."
msgstr ""
msgstr "如果未指定模組名稱,則會產生所有頂層尋檢器。"

#: ../../library/pkgutil.rst:127
msgid ""
"Yields :class:`ModuleInfo` for all submodules on *path*, or, if *path* is "
"``None``, all top-level modules on :data:`sys.path`."
msgstr ""
"yield *path* 上所有子模組的 :class:`ModuleInfo`,或者如果 *path* 為 "
"``None``,則產生 :data:`sys.path` 上的所有頂層模組。"

#: ../../library/pkgutil.rst:130 ../../library/pkgutil.rst:151
msgid ""
"*path* should be either ``None`` or a list of paths to look for modules in."
msgstr ""
msgstr "*path* 應該是 ``None`` 或用來尋找模組的路徑串列。"

#: ../../library/pkgutil.rst:132 ../../library/pkgutil.rst:153
msgid ""
"*prefix* is a string to output on the front of every module name on output."
msgstr ""
msgstr "*prefix* 是在輸出的每個模組名稱前面的輸出字串。"

#: ../../library/pkgutil.rst:136 ../../library/pkgutil.rst:175
msgid ""
Expand All @@ -178,19 +211,26 @@ msgid ""
"for :class:`importlib.machinery.FileFinder` and :class:`zipimport."
"zipimporter`."
msgstr ""
"僅適用於有定義 ``iter_modules()`` 方法的 :term:`finder`。此介面並非是標準的,"
"因此該模組還提供了 :class:`importlib.machinery.FileFinder` 和 :class:"
"`zipimport.zipimporter` 的實作。"

#: ../../library/pkgutil.rst:148
msgid ""
"Yields :class:`ModuleInfo` for all modules recursively on *path*, or, if "
"*path* is ``None``, all accessible modules."
msgstr ""
"為 *path* 上的所有模組遞迴 yield 出 :class:`ModuleInfo`,或如果 *path* 為 "
"``None`` 則 yield 所有可存取的模組。"

#: ../../library/pkgutil.rst:155
msgid ""
"Note that this function must import all *packages* (*not* all modules!) on "
"the given *path*, in order to access the ``__path__`` attribute to find "
"submodules."
msgstr ""
"請注意,此函式必須引入給定之 *path* 上的所有\\ *套件*\\ (*不是*\\ 所有模"
"組!),以便存取 ``__path__`` 屬性來尋找子模組。"

#: ../../library/pkgutil.rst:159
msgid ""
Expand All @@ -200,14 +240,17 @@ msgid ""
"`ImportError`\\s are caught and ignored, while all other exceptions are "
"propagated, terminating the search."
msgstr ""
"*onerror* 是一個函式,如果在嘗試引入套件時發生任何例外,則使用一個引數(正在"
"引入之套件的名稱)來呼叫函式。如果未提供 *onerror* 函式,則會捕獲並忽略 :exc:"
"`ImportError`,同時傳播所有其他例外並終止搜尋。"

#: ../../library/pkgutil.rst:165
msgid "Examples::"
msgstr "範例: ::"

#: ../../library/pkgutil.rst:187
msgid "Get a resource from a package."
msgstr ""
msgstr "從套件中取得資源。"

#: ../../library/pkgutil.rst:189
msgid ""
Expand All @@ -218,18 +261,22 @@ msgid ""
"separator. The parent directory name ``..`` is not allowed, and nor is a "
"rooted name (starting with a ``/``)."
msgstr ""
"這是 :term:`loader` :meth:`get_data <importlib.abc.ResourceLoader.get_data>` "
"API 的包裝器。*package* 引數應該是採用標準模組格式 (``foo.bar``) 的套件名稱。"
"*resource* 引數應為相對檔案名稱的形式,並使用 ``/`` 作為路徑分隔符號。不允許"
"使用父目錄名稱 ``..``,也不允許使用根目錄名稱(以 ``/`` 開頭)。"

#: ../../library/pkgutil.rst:196
msgid ""
"The function returns a binary string that is the contents of the specified "
"resource."
msgstr ""
msgstr "該函式回傳一個二進位字串,它是指定資源的內容。"

#: ../../library/pkgutil.rst:199
msgid ""
"For packages located in the filesystem, which have already been imported, "
"this is the rough equivalent of::"
msgstr ""
msgstr "對於位於檔案系統中且已被引入過的套件,這大致相當於: ::"

#: ../../library/pkgutil.rst:205
msgid ""
Expand All @@ -239,24 +286,32 @@ msgid ""
"for :term:`namespace packages <namespace package>` does not support :meth:"
"`get_data <importlib.abc.ResourceLoader.get_data>`."
msgstr ""
"如果無法定位或載入套件,或者它使用不支援 :meth:`get_data <importlib.abc."
"ResourceLoader.get_data>` 的 :term:`loader` 則回傳 ``None``。特別是\\ :term:`"
"命名空間套件 <namespace package>`\\ 的 :term:`loader` 不支援 :meth:`get_data "
"<importlib.abc.ResourceLoader.get_data>`。"

#: ../../library/pkgutil.rst:214
msgid "Resolve a name to an object."
msgstr ""
msgstr "將名稱解析為物件。"

#: ../../library/pkgutil.rst:216
msgid ""
"This functionality is used in numerous places in the standard library (see :"
"issue:`12915`) - and equivalent functionality is also in widely used third-"
"party packages such as setuptools, Django and Pyramid."
msgstr ""
"標準函式庫中的許多地方都使用了此功能(請參閱 :issue:`12915`),且相同功能也被"
"用於擁有廣大使用者的第三方套件,如 setuptools、Django 和 Pyramid。"

#: ../../library/pkgutil.rst:220
msgid ""
"It is expected that *name* will be a string in one of the following formats, "
"where W is shorthand for a valid Python identifier and dot stands for a "
"literal period in these pseudo-regexes:"
msgstr ""
"*name* 預期要是以下格式之一的字串,其中 W 是有效 Python 識別字的簡寫,而點 "
"(dot) 代表這些偽正規表示式 (pseudo-regex) 中的字面句點 (literal period):"

#: ../../library/pkgutil.rst:224
msgid "``W(.W)*``"
Expand All @@ -275,6 +330,10 @@ msgid ""
"inferred by inspection, repeated attempts to import must be done with this "
"form."
msgstr ""
"第一種形式僅是為了要向後相容。它假設點名稱 (dotted name) 的某些部分是一個套"
"件,其餘部分是該套件內某處的物件,其可能巢狀地存在於 (nested) 其他物件內。由"
"於無法透過檢查 (inspection) 來推斷出套件停止的位置和物件層次結構的開始位置,"
"因此必須使用此形式來重複嘗試引入。"

#: ../../library/pkgutil.rst:234
msgid ""
Expand All @@ -284,23 +343,28 @@ msgid ""
"hierarchy within that package. Only one import is needed in this form. If it "
"ends with the colon, then a module object is returned."
msgstr ""
"在第二種形式中,呼叫者透過使用一個冒號來明確標明分隔點:冒號左側的點名稱是要"
"引入的套件,右側的點名稱是該套件內的物件層次結構。這種形式只需要一次引入。如"
"果它以冒號結尾,則回傳一個模組物件。"

#: ../../library/pkgutil.rst:240
msgid ""
"The function will return an object (which might be a module), or raise one "
"of the following exceptions:"
msgstr ""
msgstr "此函式會回傳一個物件(可能是一個模組),或引發以下其中一個例外:"

#: ../../library/pkgutil.rst:243
msgid ":exc:`ValueError` -- if *name* isn't in a recognised format."
msgstr ""
msgstr ":exc:`ValueError` -- 如果 *name* 不是可辨識的格式。"

#: ../../library/pkgutil.rst:245
msgid ":exc:`ImportError` -- if an import failed when it shouldn't have."
msgstr ""
msgstr ":exc:`ImportError` -- 如果在不應該失敗的情況下引入失敗。"

#: ../../library/pkgutil.rst:247
msgid ""
":exc:`AttributeError` -- If a failure occurred when traversing the object "
"hierarchy within the imported package to get to the desired object."
msgstr ""
":exc:`AttributeError` -- 如果在遍歷引入套件中的物件層次結構以取得所需物件時發"
"生失敗。"

0 comments on commit e0ffdb0

Please sign in to comment.