1
- # SOME DESCRIPTIVE TITLE.
2
- # Copyright (C) 2001-2022, Python Software Foundation
1
+ # Copyright (C) 2001-2024, Python Software Foundation
3
2
# This file is distributed under the same license as the Python package.
4
3
#
5
4
# Translators:
5
+ # Matt Wang <mattwang44@gmail.com>, 2024
6
6
msgid ""
7
7
msgstr ""
8
8
"Project-Id-Version : Python 3.12\n "
9
9
"Report-Msgid-Bugs-To : \n "
10
10
"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 "
13
13
"Language-Team : Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
14
14
"tw)\n "
15
15
"Language : zh_TW\n "
@@ -20,7 +20,7 @@ msgstr ""
20
20
21
21
#: ../../library/pkgutil.rst:2
22
22
msgid ":mod:`!pkgutil` --- Package extension utility"
23
- msgstr ""
23
+ msgstr ":mod:`!pkgutil` --- 套件擴充工具程式 "
24
24
25
25
#: ../../library/pkgutil.rst:7
26
26
msgid "**Source code:** :source:`Lib/pkgutil.py`"
@@ -30,17 +30,19 @@ msgstr "**原始碼:**\\ :source:`Lib/pkgutil.py`"
30
30
msgid ""
31
31
"This module provides utilities for the import system, in particular package "
32
32
"support."
33
- msgstr ""
33
+ msgstr "此模組提供了引入系統 (import system) 的工具程式,特別是套件相關支援。 "
34
34
35
35
#: ../../library/pkgutil.rst:16
36
36
msgid "A namedtuple that holds a brief summary of a module's info."
37
- msgstr ""
37
+ msgstr "一個包含模組資訊之簡短摘要的附名元組 (namedtuple)。 "
38
38
39
39
#: ../../library/pkgutil.rst:22
40
40
msgid ""
41
41
"Extend the search path for the modules which comprise a package. Intended "
42
42
"use is to place the following code in a package's :file:`__init__.py`::"
43
43
msgstr ""
44
+ "擴充組成一個套件之模組的搜尋路徑。預期用法是將以下程式碼放入套件的 :file:"
45
+ "`__init__.py`: ::"
44
46
45
47
#: ../../library/pkgutil.rst:28
46
48
msgid ""
@@ -49,6 +51,9 @@ msgid ""
49
51
"This is useful if one wants to distribute different parts of a single "
50
52
"logical package as multiple directories."
51
53
msgstr ""
54
+ "對於 :data:`sys.path` 上具有與套件名稱相符的子目錄的每個目錄,將該子目錄新增"
55
+ "至套件的 :attr:`__path__` 中。如果想要將單一邏輯套件的不同部分給分配到多個目"
56
+ "錄時,這會非常有用。"
52
57
53
58
#: ../../library/pkgutil.rst:33
54
59
msgid ""
@@ -60,13 +65,20 @@ msgid ""
60
65
"pkg` file are added to the path, regardless of whether they exist on the "
61
66
"filesystem. (This is a feature.)"
62
67
msgstr ""
68
+ "它還會尋找 :file:`\\ *.pkg` 檔案,其中開頭的 ``*`` 與 *name* 引數相符。此功能"
69
+ "類似於 :file:`\\ *.pth` 檔案(更多資訊請參閱 :mod:`site` 模組),但他不特別處"
70
+ "理以 ``import`` 為開頭的行。:file:`\\ *.pkg` 檔案從表面上看是受信任的:除了檢"
71
+ "查重複項之外,在 :file:`\\ *.pkg` 檔案中找到的所有條目都將新增到路徑中,無論它"
72
+ "們是否存在於檔案系統。(這是一個功能。)"
63
73
64
74
#: ../../library/pkgutil.rst:41
65
75
msgid ""
66
76
"If the input path is not a list (as is the case for frozen packages) it is "
67
77
"returned unchanged. The input path is not modified; an extended copy is "
68
78
"returned. Items are only appended to the copy at the end."
69
79
msgstr ""
80
+ "如果輸入路徑不是串列(像是凍結套件 (frozen package) 的情況),它將原封不動地"
81
+ "被回傳。輸入路徑不會被修改;而是回傳擴充後的副本。僅將項目附加到副本的尾端。"
70
82
71
83
#: ../../library/pkgutil.rst:45
72
84
msgid ""
@@ -76,10 +88,13 @@ msgid ""
76
88
"may cause this function to raise an exception (in line with :func:`os.path."
77
89
"isdir` behavior)."
78
90
msgstr ""
91
+ ":data:`sys.path` 被假設是一個序列,:data:`sys.path` 中的項目裡,若不是代表現"
92
+ "存目錄的字串則將被忽略。:data:`sys.path` 上用作檔案名稱時導致錯誤的 Unicode "
93
+ "項目可能會導致此函式引發例外(與 :func:`os.path.isdir` 行為一致)。"
79
94
80
95
#: ../../library/pkgutil.rst:53
81
96
msgid "Retrieve a module :term:`loader` for the given *fullname*."
82
- msgstr ""
97
+ msgstr "取得給定之 *fullname* 的模組 :term:`loader`。 "
83
98
84
99
#: ../../library/pkgutil.rst:55
85
100
msgid ""
@@ -88,6 +103,9 @@ msgid ""
88
103
"returns the loader rather than the full :class:`importlib.machinery."
89
104
"ModuleSpec`."
90
105
msgstr ""
106
+ "這是一個 :func:`importlib.util.find_spec` 的向後相容包裝器,它將大多數的失敗"
107
+ "轉換為 :exc:`ImportError` 並且僅回傳載入器而不是完整的 :class:`importlib."
108
+ "machinery.ModuleSpec`。"
91
109
92
110
#: ../../library/pkgutil.rst:60 ../../library/pkgutil.rst:81
93
111
#: ../../library/pkgutil.rst:96 ../../library/pkgutil.rst:120
@@ -96,34 +114,39 @@ msgid ""
96
114
"Updated to be based directly on :mod:`importlib` rather than relying on the "
97
115
"package internal :pep:`302` import emulation."
98
116
msgstr ""
117
+ "更新為直接基於 :mod:`importlib`,而不是依賴套件內部 :pep:`302` 的引入模擬 "
118
+ "(import emulation)。"
99
119
100
120
#: ../../library/pkgutil.rst:64 ../../library/pkgutil.rst:100
101
121
msgid "Updated to be based on :pep:`451`"
102
122
msgstr "基於 :pep:`451` 來更新"
103
123
104
124
#: ../../library/pkgutil.rst:68 ../../library/pkgutil.rst:104
105
125
msgid "Use :func:`importlib.util.find_spec` instead."
106
- msgstr ""
126
+ msgstr "改用 :func:`importlib.util.find_spec`。 "
107
127
108
128
#: ../../library/pkgutil.rst:73
109
129
msgid "Retrieve a :term:`finder` for the given *path_item*."
110
- msgstr ""
130
+ msgstr "取得給定之 *path_item* 的 :term:`finder`。 "
111
131
112
132
#: ../../library/pkgutil.rst:75
113
133
msgid ""
114
134
"The returned finder is cached in :data:`sys.path_importer_cache` if it was "
115
135
"newly created by a path hook."
116
136
msgstr ""
137
+ "如果回傳的尋檢器 (finder) 是由路徑勾點 (path hook) 所新建立的,則它會被快取"
138
+ "在 :data:`sys.path_importer_cache` 中。"
117
139
118
140
#: ../../library/pkgutil.rst:78
119
141
msgid ""
120
142
"The cache (or part of it) can be cleared manually if a rescan of :data:`sys."
121
143
"path_hooks` is necessary."
122
144
msgstr ""
145
+ "如果需要重新掃描 :data:`sys.path_hooks`,可以手動清除快取(或部分快取)。"
123
146
124
147
#: ../../library/pkgutil.rst:88
125
148
msgid "Get a :term:`loader` object for *module_or_name*."
126
- msgstr ""
149
+ msgstr "取得 *module_or_name* 的 :term:`loader` 物件。 "
127
150
128
151
#: ../../library/pkgutil.rst:90
129
152
msgid ""
@@ -133,43 +156,53 @@ msgid ""
133
156
"not already imported, its containing package (if any) is imported, in order "
134
157
"to establish the package ``__path__``."
135
158
msgstr ""
159
+ "如果可以透過正常引入機制存取模組或套件,則回傳該機制相關部分的包裝器。如果找"
160
+ "不到或無法引入模組,則回傳 ``None``。如果指定的模組尚未被引入,則引入其包含的"
161
+ "套件(如有存在)以建立套件 ``__path__``。"
136
162
137
163
#: ../../library/pkgutil.rst:109
138
164
msgid "Yield :term:`finder` objects for the given module name."
139
- msgstr ""
165
+ msgstr "yield 給定模組名稱的 :term:`finder` 物件。 "
140
166
141
167
#: ../../library/pkgutil.rst:111
142
168
msgid ""
143
169
"If fullname contains a ``'.'``, the finders will be for the package "
144
170
"containing fullname, otherwise they will be all registered top level finders "
145
171
"(i.e. those on both :data:`sys.meta_path` and :data:`sys.path_hooks`)."
146
172
msgstr ""
173
+ "如果 fullname 包含 ``'.'``,則尋檢器將針對包含 fullname 的套件,否則它們全部"
174
+ "會是在頂層被註冊的尋檢器(即 :data:`sys.meta_path` 和 :data:`sys.path_hooks` "
175
+ "上的尋檢器)。"
147
176
148
177
#: ../../library/pkgutil.rst:115
149
178
msgid ""
150
179
"If the named module is in a package, that package is imported as a side "
151
180
"effect of invoking this function."
152
181
msgstr ""
182
+ "如果指定的模組位於套件中,則作為呼叫此函式的副作用 (side effect) ,該套件會被"
183
+ "引入。"
153
184
154
185
#: ../../library/pkgutil.rst:118
155
186
msgid "If no module name is specified, all top level finders are produced."
156
- msgstr ""
187
+ msgstr "如果未指定模組名稱,則會產生所有頂層尋檢器。 "
157
188
158
189
#: ../../library/pkgutil.rst:127
159
190
msgid ""
160
191
"Yields :class:`ModuleInfo` for all submodules on *path*, or, if *path* is "
161
192
"``None``, all top-level modules on :data:`sys.path`."
162
193
msgstr ""
194
+ "yield *path* 上所有子模組的 :class:`ModuleInfo`,或者如果 *path* 為 "
195
+ "``None``,則產生 :data:`sys.path` 上的所有頂層模組。"
163
196
164
197
#: ../../library/pkgutil.rst:130 ../../library/pkgutil.rst:151
165
198
msgid ""
166
199
"*path* should be either ``None`` or a list of paths to look for modules in."
167
- msgstr ""
200
+ msgstr "*path* 應該是 ``None`` 或用來尋找模組的路徑串列。 "
168
201
169
202
#: ../../library/pkgutil.rst:132 ../../library/pkgutil.rst:153
170
203
msgid ""
171
204
"*prefix* is a string to output on the front of every module name on output."
172
- msgstr ""
205
+ msgstr "*prefix* 是在輸出的每個模組名稱前面的輸出字串。 "
173
206
174
207
#: ../../library/pkgutil.rst:136 ../../library/pkgutil.rst:175
175
208
msgid ""
@@ -178,19 +211,26 @@ msgid ""
178
211
"for :class:`importlib.machinery.FileFinder` and :class:`zipimport."
179
212
"zipimporter`."
180
213
msgstr ""
214
+ "僅適用於有定義 ``iter_modules()`` 方法的 :term:`finder`。此介面並非是標準的,"
215
+ "因此該模組還提供了 :class:`importlib.machinery.FileFinder` 和 :class:"
216
+ "`zipimport.zipimporter` 的實作。"
181
217
182
218
#: ../../library/pkgutil.rst:148
183
219
msgid ""
184
220
"Yields :class:`ModuleInfo` for all modules recursively on *path*, or, if "
185
221
"*path* is ``None``, all accessible modules."
186
222
msgstr ""
223
+ "為 *path* 上的所有模組遞迴 yield 出 :class:`ModuleInfo`,或如果 *path* 為 "
224
+ "``None`` 則 yield 所有可存取的模組。"
187
225
188
226
#: ../../library/pkgutil.rst:155
189
227
msgid ""
190
228
"Note that this function must import all *packages* (*not* all modules!) on "
191
229
"the given *path*, in order to access the ``__path__`` attribute to find "
192
230
"submodules."
193
231
msgstr ""
232
+ "請注意,此函式必須引入給定之 *path* 上的所有\\ *套件*\\ (*不是*\\ 所有模"
233
+ "組!),以便存取 ``__path__`` 屬性來尋找子模組。"
194
234
195
235
#: ../../library/pkgutil.rst:159
196
236
msgid ""
@@ -200,14 +240,17 @@ msgid ""
200
240
"`ImportError`\\ s are caught and ignored, while all other exceptions are "
201
241
"propagated, terminating the search."
202
242
msgstr ""
243
+ "*onerror* 是一個函式,如果在嘗試引入套件時發生任何例外,則使用一個引數(正在"
244
+ "引入之套件的名稱)來呼叫函式。如果未提供 *onerror* 函式,則會捕獲並忽略 :exc:"
245
+ "`ImportError`,同時傳播所有其他例外並終止搜尋。"
203
246
204
247
#: ../../library/pkgutil.rst:165
205
248
msgid "Examples::"
206
249
msgstr "範例: ::"
207
250
208
251
#: ../../library/pkgutil.rst:187
209
252
msgid "Get a resource from a package."
210
- msgstr ""
253
+ msgstr "從套件中取得資源。 "
211
254
212
255
#: ../../library/pkgutil.rst:189
213
256
msgid ""
@@ -218,18 +261,22 @@ msgid ""
218
261
"separator. The parent directory name ``..`` is not allowed, and nor is a "
219
262
"rooted name (starting with a ``/``)."
220
263
msgstr ""
264
+ "這是 :term:`loader` :meth:`get_data <importlib.abc.ResourceLoader.get_data>` "
265
+ "API 的包裝器。*package* 引數應該是採用標準模組格式 (``foo.bar``) 的套件名稱。"
266
+ "*resource* 引數應為相對檔案名稱的形式,並使用 ``/`` 作為路徑分隔符號。不允許"
267
+ "使用父目錄名稱 ``..``,也不允許使用根目錄名稱(以 ``/`` 開頭)。"
221
268
222
269
#: ../../library/pkgutil.rst:196
223
270
msgid ""
224
271
"The function returns a binary string that is the contents of the specified "
225
272
"resource."
226
- msgstr ""
273
+ msgstr "該函式回傳一個二進位字串,它是指定資源的內容。 "
227
274
228
275
#: ../../library/pkgutil.rst:199
229
276
msgid ""
230
277
"For packages located in the filesystem, which have already been imported, "
231
278
"this is the rough equivalent of::"
232
- msgstr ""
279
+ msgstr "對於位於檔案系統中且已被引入過的套件,這大致相當於: :: "
233
280
234
281
#: ../../library/pkgutil.rst:205
235
282
msgid ""
@@ -239,24 +286,32 @@ msgid ""
239
286
"for :term:`namespace packages <namespace package>` does not support :meth:"
240
287
"`get_data <importlib.abc.ResourceLoader.get_data>`."
241
288
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>`。"
242
293
243
294
#: ../../library/pkgutil.rst:214
244
295
msgid "Resolve a name to an object."
245
- msgstr ""
296
+ msgstr "將名稱解析為物件。 "
246
297
247
298
#: ../../library/pkgutil.rst:216
248
299
msgid ""
249
300
"This functionality is used in numerous places in the standard library (see :"
250
301
"issue:`12915`) - and equivalent functionality is also in widely used third-"
251
302
"party packages such as setuptools, Django and Pyramid."
252
303
msgstr ""
304
+ "標準函式庫中的許多地方都使用了此功能(請參閱 :issue:`12915`),且相同功能也被"
305
+ "用於擁有廣大使用者的第三方套件,如 setuptools、Django 和 Pyramid。"
253
306
254
307
#: ../../library/pkgutil.rst:220
255
308
msgid ""
256
309
"It is expected that *name* will be a string in one of the following formats, "
257
310
"where W is shorthand for a valid Python identifier and dot stands for a "
258
311
"literal period in these pseudo-regexes:"
259
312
msgstr ""
313
+ "*name* 預期要是以下格式之一的字串,其中 W 是有效 Python 識別字的簡寫,而點 "
314
+ "(dot) 代表這些偽正規表示式 (pseudo-regex) 中的字面句點 (literal period):"
260
315
261
316
#: ../../library/pkgutil.rst:224
262
317
msgid "``W(.W)*``"
@@ -275,6 +330,10 @@ msgid ""
275
330
"inferred by inspection, repeated attempts to import must be done with this "
276
331
"form."
277
332
msgstr ""
333
+ "第一種形式僅是為了要向後相容。它假設點名稱 (dotted name) 的某些部分是一個套"
334
+ "件,其餘部分是該套件內某處的物件,其可能巢狀地存在於 (nested) 其他物件內。由"
335
+ "於無法透過檢查 (inspection) 來推斷出套件停止的位置和物件層次結構的開始位置,"
336
+ "因此必須使用此形式來重複嘗試引入。"
278
337
279
338
#: ../../library/pkgutil.rst:234
280
339
msgid ""
@@ -284,23 +343,28 @@ msgid ""
284
343
"hierarchy within that package. Only one import is needed in this form. If it "
285
344
"ends with the colon, then a module object is returned."
286
345
msgstr ""
346
+ "在第二種形式中,呼叫者透過使用一個冒號來明確標明分隔點:冒號左側的點名稱是要"
347
+ "引入的套件,右側的點名稱是該套件內的物件層次結構。這種形式只需要一次引入。如"
348
+ "果它以冒號結尾,則回傳一個模組物件。"
287
349
288
350
#: ../../library/pkgutil.rst:240
289
351
msgid ""
290
352
"The function will return an object (which might be a module), or raise one "
291
353
"of the following exceptions:"
292
- msgstr ""
354
+ msgstr "此函式會回傳一個物件(可能是一個模組),或引發以下其中一個例外: "
293
355
294
356
#: ../../library/pkgutil.rst:243
295
357
msgid ":exc:`ValueError` -- if *name* isn't in a recognised format."
296
- msgstr ""
358
+ msgstr ":exc:`ValueError` -- 如果 *name* 不是可辨識的格式。 "
297
359
298
360
#: ../../library/pkgutil.rst:245
299
361
msgid ":exc:`ImportError` -- if an import failed when it shouldn't have."
300
- msgstr ""
362
+ msgstr ":exc:`ImportError` -- 如果在不應該失敗的情況下引入失敗。 "
301
363
302
364
#: ../../library/pkgutil.rst:247
303
365
msgid ""
304
366
":exc:`AttributeError` -- If a failure occurred when traversing the object "
305
367
"hierarchy within the imported package to get to the desired object."
306
368
msgstr ""
369
+ ":exc:`AttributeError` -- 如果在遍歷引入套件中的物件層次結構以取得所需物件時發"
370
+ "生失敗。"
0 commit comments