Skip to content

Commit e0ffdb0

Browse files
mattwang44ken71301mindihx
authored
Translate library/pkgutil.po (#836)
Co-authored-by: Payon <ken71301@hotmail.com> Co-authored-by: mindihx <ymhuang.ymh@gmail.com>
1 parent 5334cb2 commit e0ffdb0

File tree

1 file changed

+86
-22
lines changed

1 file changed

+86
-22
lines changed

library/pkgutil.po

+86-22
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 <mattwang44@gmail.com>, 2024
66
msgid ""
77
msgstr ""
88
"Project-Id-Version: Python 3.12\n"
99
"Report-Msgid-Bugs-To: \n"
1010
"POT-Creation-Date: 2024-05-09 00:03+0000\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+
"它還會尋找 :file:`\\*.pkg` 檔案,其中開頭的 ``*`` 與 *name* 引數相符。此功能"
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 package) 的情況),它將原封不動地"
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+
"如果回傳的尋檢器 (finder) 是由路徑勾點 (path hook) 所新建立的,則它會被快取"
138+
"在 :data:`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+
"yield *path* 上所有子模組的 :class:`ModuleInfo`,或者如果 *path* 為 "
195+
"``None``,則產生 :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* 上的所有模組遞迴 yield 出 :class:`ModuleInfo`,或如果 *path* 為 "
224+
"``None`` 則 yield 所有可存取的模組。"
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,14 +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::"
206249
msgstr "範例: ::"
207250

208251
#: ../../library/pkgutil.rst:187
209252
msgid "Get a resource from a package."
210-
msgstr ""
253+
msgstr "從套件中取得資源。"
211254

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

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

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

234281
#: ../../library/pkgutil.rst:205
235282
msgid ""
@@ -239,24 +286,32 @@ msgid ""
239286
"for :term:`namespace packages <namespace package>` does not support :meth:"
240287
"`get_data <importlib.abc.ResourceLoader.get_data>`."
241288
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>`。"
242293

243294
#: ../../library/pkgutil.rst:214
244295
msgid "Resolve a name to an object."
245-
msgstr ""
296+
msgstr "將名稱解析為物件。"
246297

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

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

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

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

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

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

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

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

0 commit comments

Comments
 (0)