Skip to content

Commit a67c64b

Browse files
allen91wumattwang44StevenHsuYL
authored
Translate library/queue.po (#187)
* Translate `library/queue.po` * Translate `library/queue.po` * update file from the review * fix typo * Update library/queue.po Co-authored-by: Steven Hsu <hsuhaochun@gmail.com> * Update library/queue.po Co-authored-by: Steven Hsu <hsuhaochun@gmail.com> * remove redundant part Co-authored-by: Wei-Hsiang (Matt) Wang <mattwang44@gmail.com> Co-authored-by: Steven Hsu <hsuhaochun@gmail.com>
1 parent 16d006a commit a67c64b

File tree

1 file changed

+114
-12
lines changed

1 file changed

+114
-12
lines changed

library/queue.po

+114-12
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,28 @@
33
# This file is distributed under the same license as the Python package.
44
#
55
# Translators:
6+
# Adrian Liaw <adrianliaw2000@gmail.com>, 2018
7+
# Allen Wu <allen91.wu@gmail.com>, 2021
8+
#
69
msgid ""
710
msgstr ""
811
"Project-Id-Version: Python 3.10\n"
912
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2022-07-02 00:16+0000\n"
11-
"PO-Revision-Date: 2018-05-23 16:08+0000\n"
12-
"Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n"
13+
"POT-Creation-Date: 2022-04-15 00:13+0000\n"
14+
"PO-Revision-Date: 2022-09-27 00:12+0800\n"
15+
"Last-Translator: Allen Wu <allen91.wu@gmail.com>\n"
1316
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
1417
"tw)\n"
1518
"Language: zh_TW\n"
1619
"MIME-Version: 1.0\n"
1720
"Content-Type: text/plain; charset=UTF-8\n"
1821
"Content-Transfer-Encoding: 8bit\n"
1922
"Plural-Forms: nplurals=1; plural=0;\n"
23+
"X-Generator: Poedit 3.0.1\n"
2024

2125
#: ../../library/queue.rst:2
2226
msgid ":mod:`queue` --- A synchronized queue class"
23-
msgstr ""
27+
msgstr ":mod:`queue` --- 同步佇列 (queue) class(類別)"
2428

2529
#: ../../library/queue.rst:7
2630
msgid "**Source code:** :source:`Lib/queue.py`"
@@ -33,6 +37,9 @@ msgid ""
3337
"exchanged safely between multiple threads. The :class:`Queue` class in this "
3438
"module implements all the required locking semantics."
3539
msgstr ""
40+
":mod:`queue` module(模組)實作多生產者、多消費者佇列。在執行緒程式設計中,必"
41+
"須在多執行緒之間安全地交換資訊時,特別有用。此 module 中的 :class:`Queue` "
42+
"class 實作所有必需的鎖定語義 (locking semantics)。"
3643

3744
#: ../../library/queue.rst:16
3845
msgid ""
@@ -44,24 +51,33 @@ msgid ""
4451
"sorted (using the :mod:`heapq` module) and the lowest valued entry is "
4552
"retrieved first."
4653
msgstr ""
54+
"此 module 實作三種型別的佇列,它們僅在取出條目的順序上有所不同。在 :abbr:"
55+
"`FIFO (first-in, first-out)` 佇列中,先加入的任務是第一個被取出的。在 :abbr:"
56+
"`LIFO (last-in, first-out)` 佇列中,最近被加入的條目是第一個被取出的(像堆疊 "
57+
"(stack) 一樣操作)。使用優先佇列 (priority queue) 時,條目將保持排序狀態(使"
58+
"用 :mod:`heapq` module),並先取出最低值條目。"
4759

4860
#: ../../library/queue.rst:24
4961
msgid ""
5062
"Internally, those three types of queues use locks to temporarily block "
5163
"competing threads; however, they are not designed to handle reentrancy "
5264
"within a thread."
5365
msgstr ""
66+
"在內部,這三種型別的佇列使用鎖 (lock) 來暫時阻塞競爭執行緒;但是,它們並不是"
67+
"被設計來處理執行緒內的 reentrancy(可重入)。"
5468

5569
#: ../../library/queue.rst:28
5670
msgid ""
5771
"In addition, the module implements a \"simple\" :abbr:`FIFO (first-in, first-"
5872
"out)` queue type, :class:`SimpleQueue`, whose specific implementation "
5973
"provides additional guarantees in exchange for the smaller functionality."
6074
msgstr ""
75+
"此外,此 module 實作一個「簡單」的 :abbr:`FIFO (first-in, first-out)` 佇列型"
76+
"別 :class:`SimpleQueue`,其特定的實作是以較少的功能為代價,來提供額外的保證。"
6177

6278
#: ../../library/queue.rst:33
6379
msgid "The :mod:`queue` module defines the following classes and exceptions:"
64-
msgstr ""
80+
msgstr ":mod:`queue` module 定義了以下的 class 和例外:"
6581

6682
#: ../../library/queue.rst:37
6783
msgid ""
@@ -71,6 +87,9 @@ msgid ""
7187
"until queue items are consumed. If *maxsize* is less than or equal to zero, "
7288
"the queue size is infinite."
7389
msgstr ""
90+
":abbr:`FIFO (first-in, first-out)` 佇列的建構子 (constructor)。*maxsize* 是一"
91+
"個整數,用於設置佇列中可放置的項目數的上限。一旦達到此大小,插入將會阻塞,直"
92+
"到佇列中的項目被消耗。如果 *maxsize* 小於或等於零,則佇列大小為無限。"
7493

7594
#: ../../library/queue.rst:45
7695
msgid ""
@@ -80,6 +99,9 @@ msgid ""
8099
"until queue items are consumed. If *maxsize* is less than or equal to zero, "
81100
"the queue size is infinite."
82101
msgstr ""
102+
":abbr:`LIFO (last-in, first-out)` 佇列的建構子。*maxsize* 是一個整數,用於設"
103+
"置佇列中可放置的項目數的上限。一旦達到此大小,插入將被鎖定,到佇列中的項目被"
104+
"消耗。如果 *maxsize* 小於或等於零,則佇列大小為無限。"
83105

84106
#: ../../library/queue.rst:54
85107
msgid ""
@@ -89,54 +111,73 @@ msgid ""
89111
"consumed. If *maxsize* is less than or equal to zero, the queue size is "
90112
"infinite."
91113
msgstr ""
114+
"優先佇列的建構子。*maxsize* 是一個整數,用於設置佇列中可放置的項目數的上限。"
115+
"一旦達到此大小,插入將被阻塞,直到佇列中的項目被消耗。如果 *maxsize* 小於或等"
116+
"於零,則佇列大小為無限。"
92117

93118
#: ../../library/queue.rst:59
94119
msgid ""
95120
"The lowest valued entries are retrieved first (the lowest valued entry is "
96121
"the one returned by ``sorted(list(entries))[0]``). A typical pattern for "
97122
"entries is a tuple in the form: ``(priority_number, data)``."
98123
msgstr ""
124+
"最低值的條目會最先被取出(最低值的條目是被 ``sorted(list(entries))[0]`` 回傳"
125+
"的)。條目的典型模式是格式為 ``(priority_number, data)`` 的 tuple(元組)。"
99126

100127
#: ../../library/queue.rst:63
101128
msgid ""
102129
"If the *data* elements are not comparable, the data can be wrapped in a "
103130
"class that ignores the data item and only compares the priority number::"
104131
msgstr ""
132+
"如果 *data* 元素為不可比較的,則可以將資料包裝在一個 class 中,該 class 忽略"
133+
"資料項目並僅比較優先數:\n"
134+
"\n"
135+
"::"
105136

106137
#: ../../library/queue.rst:76
107138
msgid ""
108139
"Constructor for an unbounded :abbr:`FIFO (first-in, first-out)` queue. "
109140
"Simple queues lack advanced functionality such as task tracking."
110141
msgstr ""
142+
"無界的 :abbr:`FIFO (first-in, first-out)` 佇列的建構子。簡單佇列缺少任務追蹤"
143+
"等進階功能。"
111144

112145
#: ../../library/queue.rst:84
113146
msgid ""
114147
"Exception raised when non-blocking :meth:`~Queue.get` (or :meth:`~Queue."
115148
"get_nowait`) is called on a :class:`Queue` object which is empty."
116149
msgstr ""
150+
"當對一個空的 :class:`Queue` 物件呼叫非阻塞的 (non-blocking) :meth:`~Queue."
151+
"get`\\ (或 :meth:`~Queue.get_nowait`\\ )將引發此例外。"
117152

118153
#: ../../library/queue.rst:91
119154
msgid ""
120155
"Exception raised when non-blocking :meth:`~Queue.put` (or :meth:`~Queue."
121156
"put_nowait`) is called on a :class:`Queue` object which is full."
122157
msgstr ""
158+
"當對一個已滿的 :class:`Queue` 物件呼叫非阻塞的 :meth:`~Queue.put`\\ (或 :"
159+
"meth:`~Queue.put_nowait`\\ )將引發此例外。"
123160

124161
#: ../../library/queue.rst:99
125162
msgid "Queue Objects"
126-
msgstr ""
163+
msgstr "佇列物件"
127164

128165
#: ../../library/queue.rst:101
129166
msgid ""
130167
"Queue objects (:class:`Queue`, :class:`LifoQueue`, or :class:"
131168
"`PriorityQueue`) provide the public methods described below."
132169
msgstr ""
170+
"佇列物件(:class:`Queue`、:class:`LifoQueue`、:class:`PriorityQueue`)提供下"
171+
"面描述的公用 method。"
133172

134173
#: ../../library/queue.rst:107
135174
msgid ""
136175
"Return the approximate size of the queue. Note, qsize() > 0 doesn't "
137176
"guarantee that a subsequent get() will not block, nor will qsize() < maxsize "
138177
"guarantee that put() will not block."
139178
msgstr ""
179+
"回傳佇列的近似大小。注意,qsize() > 0 並不能保證後續的 get() 不會阻塞,"
180+
"qsize() < maxsize 也不會保證 put() 不會阻塞。"
140181

141182
#: ../../library/queue.rst:114
142183
msgid ""
@@ -145,6 +186,9 @@ msgid ""
145186
"not block. Similarly, if empty() returns ``False`` it doesn't guarantee "
146187
"that a subsequent call to get() will not block."
147188
msgstr ""
189+
"如果佇列為空,則回傳 ``True``,否則回傳 ``False``。如果 empty() 回傳 "
190+
"``True``,則不保證後續呼叫 put() 不會阻塞。同樣,如果 empty() 回傳 "
191+
"``False``,則不保證後續呼叫 get() 不會阻塞。"
148192

149193
#: ../../library/queue.rst:122
150194
msgid ""
@@ -153,6 +197,9 @@ msgid ""
153197
"not block. Similarly, if full() returns ``False`` it doesn't guarantee that "
154198
"a subsequent call to put() will not block."
155199
msgstr ""
200+
"如果佇列已滿,則回傳 ``True`` ,否則回傳 ``False``。如果 full() 回傳 "
201+
"``True``,則不保證後續呼叫 get() 不會阻塞。同樣,如果 full() 回傳 ``False``,"
202+
"則不保證後續呼叫 put() 不會阻塞。"
156203

157204
#: ../../library/queue.rst:130
158205
msgid ""
@@ -164,10 +211,15 @@ msgid ""
164211
"is immediately available, else raise the :exc:`Full` exception (*timeout* is "
165212
"ignored in that case)."
166213
msgstr ""
214+
"將 *item* 放入佇列中。如果可選的 args *block* 為 true、*timeout* 為 ``None``"
215+
"\\ (預設值),則在必要時阻塞,直到自由槽 (free slot) 可用。如果 *timeout* 為"
216+
"正數,則最多阻塞 *timeout* 秒,如果該時間內沒有可用的自由槽,則會引發 :exc:"
217+
"`Full` 例外。否則(*block* 為 false),如果自由槽立即可用,則將項目放在佇列"
218+
"中,否則引發 :exc:`Full` 例外(在這種情況下,*timeout* 將被忽略)。"
167219

168220
#: ../../library/queue.rst:141
169221
msgid "Equivalent to ``put(item, block=False)``."
170-
msgstr ""
222+
msgstr "等效於 ``put(item, block=False)``。"
171223

172224
#: ../../library/queue.rst:146
173225
msgid ""
@@ -179,6 +231,11 @@ msgid ""
179231
"immediately available, else raise the :exc:`Empty` exception (*timeout* is "
180232
"ignored in that case)."
181233
msgstr ""
234+
"從佇列中移除並回傳一個項目。如果可選的 args *block* 為 true,且 *timeout* 為 "
235+
"``None``\\ (預設值),則在必要時阻塞,直到有可用的項目。如果 *timeout* 是正"
236+
"數,則最多會阻塞 *timeout* 秒,如果該時間內沒有可用的項目,則會引發 :exc:"
237+
"`Empty` 例外。否則(*block* 為 false),如果立即可用,則回傳一個項目,否則引"
238+
"發 :exc:`Empty` 例外(在這種情況下,*timeout* 將被忽略)。"
182239

183240
#: ../../library/queue.rst:153
184241
msgid ""
@@ -188,40 +245,49 @@ msgid ""
188245
"can occur, and in particular a SIGINT will not trigger a :exc:"
189246
"`KeyboardInterrupt`."
190247
msgstr ""
248+
"在 POSIX 系統的 3.0 版之前,以及 Windows 的所有版本,如果 *block* 為 true 且 "
249+
"*timeout* 為 ``None``,則此操作將在底層鎖上進入不間斷等待。這意味著不會發生例"
250+
"外,特別是 SIGINT(中斷訊號)不會觸發 :exc:`KeyboardInterrupt`。"
191251

192252
#: ../../library/queue.rst:161 ../../library/queue.rst:268
193253
msgid "Equivalent to ``get(False)``."
194-
msgstr ""
254+
msgstr "等效於 ``get(False)``。"
195255

196256
#: ../../library/queue.rst:163
197257
msgid ""
198258
"Two methods are offered to support tracking whether enqueued tasks have been "
199259
"fully processed by daemon consumer threads."
200260
msgstr ""
261+
"有兩個 method 可以支援追蹤放入佇列的任務是否已由常駐消費者執行緒 (daemon "
262+
"consumer threads) 完全處理。"
201263

202264
#: ../../library/queue.rst:169
203265
msgid ""
204266
"Indicate that a formerly enqueued task is complete. Used by queue consumer "
205267
"threads. For each :meth:`get` used to fetch a task, a subsequent call to :"
206268
"meth:`task_done` tells the queue that the processing on the task is complete."
207269
msgstr ""
270+
"表示先前放入佇列的任務已完成。由佇列消費者執行緒使用。對於用來提取任務的每"
271+
"個 :meth:`get`,隨後呼叫 :meth:`task_done` 告訴佇列任務的處理已完成。"
208272

209273
#: ../../library/queue.rst:173
210274
msgid ""
211275
"If a :meth:`join` is currently blocking, it will resume when all items have "
212276
"been processed (meaning that a :meth:`task_done` call was received for every "
213277
"item that had been :meth:`put` into the queue)."
214278
msgstr ""
279+
"如果目前 :meth:`join` 阻塞,它將會在所有項目都已處理完畢後恢復(代表對於以 :"
280+
"meth:`put` 放進佇列的每個項目,都要收到 :meth:`task_done` 的呼叫)。"
215281

216282
#: ../../library/queue.rst:177
217283
msgid ""
218284
"Raises a :exc:`ValueError` if called more times than there were items placed "
219285
"in the queue."
220-
msgstr ""
286+
msgstr "如果呼叫次數超過佇列中放置的項目數量,則引發 :exc:`ValueError`。"
221287

222288
#: ../../library/queue.rst:183
223289
msgid "Blocks until all items in the queue have been gotten and processed."
224-
msgstr ""
290+
msgstr "持續阻塞直到佇列中的所有項目都已被獲取並處理完畢。"
225291

226292
#: ../../library/queue.rst:185
227293
msgid ""
@@ -231,10 +297,16 @@ msgid ""
231297
"complete. When the count of unfinished tasks drops to zero, :meth:`join` "
232298
"unblocks."
233299
msgstr ""
300+
"每當項目被加到佇列中時,未完成任務的計數都會增加。每當消費者執行緒呼叫 :meth:"
301+
"`task_done` 以指示該項目已被取出並且對其的所有工作都已完成時,計數就會下降。"
302+
"當未完成任務的計數降至零時,:meth:`join` 將停止阻塞。"
234303

235304
#: ../../library/queue.rst:191
236305
msgid "Example of how to wait for enqueued tasks to be completed::"
237306
msgstr ""
307+
"如何等待放入佇列的任務完成的範例:\n"
308+
"\n"
309+
"::"
238310

239311
#: ../../library/queue.rst:218
240312
msgid "SimpleQueue Objects"
@@ -243,20 +315,23 @@ msgstr "SimpleQueue 物件"
243315
#: ../../library/queue.rst:220
244316
msgid ""
245317
":class:`SimpleQueue` objects provide the public methods described below."
246-
msgstr ""
318+
msgstr ":class:`SimpleQueue` 物件提供下面描述的公用 method。"
247319

248320
#: ../../library/queue.rst:224
249321
msgid ""
250322
"Return the approximate size of the queue. Note, qsize() > 0 doesn't "
251323
"guarantee that a subsequent get() will not block."
252324
msgstr ""
325+
"傳回佇列的近似大小。注意,qsize() > 0 並不能保證後續的 get() 不會阻塞。"
253326

254327
#: ../../library/queue.rst:230
255328
msgid ""
256329
"Return ``True`` if the queue is empty, ``False`` otherwise. If empty() "
257330
"returns ``False`` it doesn't guarantee that a subsequent call to get() will "
258331
"not block."
259332
msgstr ""
333+
"如果佇列為空,則回傳 ``True``,否則回傳 ``False``。如果 empty() 回傳 "
334+
"``False``,則不保證後續呼叫 get() 不會阻塞。"
260335

261336
#: ../../library/queue.rst:237
262337
msgid ""
@@ -265,12 +340,29 @@ msgid ""
265340
"The optional args *block* and *timeout* are ignored and only provided for "
266341
"compatibility with :meth:`Queue.put`."
267342
msgstr ""
343+
"將 *item* 放入佇列中。此 method 從不阻塞,並且都會成功(除了潛在的低階錯誤,"
344+
"像是分配記憶體失敗)。可選的 args *block* 和 *timeout* 會被忽略,它們僅是為了"
345+
"與 :meth:`Queue.put` 相容才存在。"
346+
347+
#: ../../library/queue.rst:243
348+
msgid ""
349+
"This method has a C implementation which is reentrant. That is, a ``put()`` "
350+
"or ``get()`` call can be interrupted by another ``put()`` call in the same "
351+
"thread without deadlocking or corrupting internal state inside the queue. "
352+
"This makes it appropriate for use in destructors such as ``__del__`` methods "
353+
"or :mod:`weakref` callbacks."
354+
msgstr ""
355+
"此 method 有一個可重入 (reentrant) 的 C 實作。意思就是,一個 ``put()`` 或 "
356+
"``get()`` 呼叫,可以被同一執行緒中的另一個 ``put()`` 呼叫中斷,而不會造成死"
357+
"鎖 (deadlock) 或損壞佇列中的內部狀態。這使得它適合在解構子 (destructor) 中使"
358+
"用,像是 ``__del__`` method 或 :mod:`weakref` 回呼函式 (callback)。"
268359

269360
#: ../../library/queue.rst:252
270361
msgid ""
271362
"Equivalent to ``put(item, block=False)``, provided for compatibility with :"
272363
"meth:`Queue.put_nowait`."
273364
msgstr ""
365+
"等效於 ``put(item, block=False)``,用於與 :meth:`Queue.put_nowait` 相容。"
274366

275367
#: ../../library/queue.rst:258
276368
msgid ""
@@ -282,16 +374,23 @@ msgid ""
282374
"immediately available, else raise the :exc:`Empty` exception (*timeout* is "
283375
"ignored in that case)."
284376
msgstr ""
377+
"從佇列中移除並回傳一個項目。如果可選的 args *block* 為 true,且 *timeout* 為 "
378+
"``None``\\ (預設值),則在必要時阻塞,直到有可用的項目。如果 *timeout* 是正"
379+
"數,則最多會阻塞 *timeout* 秒,如果該時間內沒有可用的項目,則會引發 :exc:"
380+
"`Empty` 例外。否則(*block* 為 false),如果立即可用,則回傳一個項目,否則引"
381+
"發 :exc:`Empty` 例外(在這種情況下,*timeout* 將被忽略)。"
285382

286383
#: ../../library/queue.rst:275
287384
msgid "Class :class:`multiprocessing.Queue`"
288-
msgstr ":class:`multiprocessing.Queue` 類型"
385+
msgstr "Class :class:`multiprocessing.Queue`"
289386

290387
#: ../../library/queue.rst:274
291388
msgid ""
292389
"A queue class for use in a multi-processing (rather than multi-threading) "
293390
"context."
294391
msgstr ""
392+
"用於多行程處理 (multi-processing)(而非多執行緒)情境 (context) 的佇列 "
393+
"class。"
295394

296395
#: ../../library/queue.rst:277
297396
msgid ""
@@ -300,3 +399,6 @@ msgid ""
300399
"`~collections.deque.popleft` operations that do not require locking and also "
301400
"support indexing."
302401
msgstr ""
402+
":class:`collections.deque` 是無界佇列的替代實作,有快速且具原子性 (atomic) "
403+
"的 :meth:`~collections.deque.append` 和 :meth:`~collections.deque.popleft` 操"
404+
"作,這些操作不需要鎖定,並且還支持索引。"

0 commit comments

Comments
 (0)