Skip to content

Commit fec0140

Browse files
committed
feat: translate library/pkgutil.po
1 parent 21ccd8b commit fec0140

File tree

1 file changed

+87
-26
lines changed

1 file changed

+87
-26
lines changed

library/pkgutil.po

Lines changed: 87 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
# SOME DESCRIPTIVE TITLE.
2-
# Copyright (C) 2001-2022, Python Software Foundation
1+
# Copyright (C) 2001-2024, Python Software Foundation
32
# This file is distributed under the same license as the Python package.
43
#
54
# Translators:
5+
# Matt Wang <[email protected]>, 2024
66
msgid ""
77
msgstr ""
88
"Project-Id-Version: Python 3.12\n"
99
"Report-Msgid-Bugs-To: \n"
1010
"POT-Creation-Date: 2023-07-17 17:39+0800\n"
11-
"PO-Revision-Date: 2018-05-23 16:07+0000\n"
12-
"Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n"
11+
"PO-Revision-Date: 2024-03-08 16:07+0000\n"
12+
"Last-Translator: Matt Wang <mattwang44@gmail.com>\n"
1313
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
1414
"tw)\n"
1515
"Language: zh_TW\n"
@@ -20,7 +20,7 @@ msgstr ""
2020

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

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

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

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

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

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

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

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

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

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

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

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

104124
#: ../../library/pkgutil.rst:68 ../../library/pkgutil.rst:104
105125
msgid "Use :func:`importlib.util.find_spec` instead."
106-
msgstr ""
126+
msgstr "改用 :func:`importlib.util.find_spec`。"
107127

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

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

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

124147
#: ../../library/pkgutil.rst:88
125148
msgid "Get a :term:`loader` object for *module_or_name*."
126-
msgstr ""
149+
msgstr "取得 *module_or_name* 的 :term:`loader` 物件。"
127150

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

137163
#: ../../library/pkgutil.rst:109
138164
msgid "Yield :term:`finder` objects for the given module name."
139-
msgstr ""
165+
msgstr "產生 (yield) 給定模組名稱的 :term:`finder` 物件。"
140166

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

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

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

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

164197
#: ../../library/pkgutil.rst:130 ../../library/pkgutil.rst:151
165198
msgid ""
166199
"*path* should be either ``None`` or a list of paths to look for modules in."
167-
msgstr ""
200+
msgstr "*path* 應該是 ``None`` 或用來尋找模組的路徑清單。"
168201

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

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

182218
#: ../../library/pkgutil.rst:148
183219
msgid ""
184220
"Yields :class:`ModuleInfo` for all modules recursively on *path*, or, if "
185221
"*path* is ``None``, all accessible modules."
186222
msgstr ""
223+
"為 *path* 上的所有模組遞迴產生 :class:`ModuleInfo`,或如果 *path* 為 "
224+
"``None`` 則產生所有可存取的模組。"
187225

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

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

204247
#: ../../library/pkgutil.rst:165
205248
msgid "Examples::"
206-
msgstr ""
207-
"範例:\n"
208-
"\n"
209-
"::"
249+
msgstr "範例: ::"
210250

211251
#: ../../library/pkgutil.rst:187
212252
msgid "Get a resource from a package."
213-
msgstr ""
253+
msgstr "從套件中取得資源。"
214254

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

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

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

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

246294
#: ../../library/pkgutil.rst:214
247295
msgid "Resolve a name to an object."
248-
msgstr ""
296+
msgstr "將名稱解析為物件。"
249297

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

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

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

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

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

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

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

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

0 commit comments

Comments
 (0)