Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit df2d128

Browse files
committedMay 14, 2024
feat: translate howto/enum.po
1 parent 2501ea7 commit df2d128

File tree

1 file changed

+490
-139
lines changed

1 file changed

+490
-139
lines changed
 

‎howto/enum.po

Lines changed: 490 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,110 @@
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.
4-
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
53
#
6-
#, fuzzy
4+
# Translators:
5+
# CTHua <illiew2470+pythonTW@gmail.com>, 2023
6+
# Matt Wang <mattwang44@gmail.com>, 2024
77
msgid ""
88
msgstr ""
99
"Project-Id-Version: Python 3.12\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2023-11-30 00:03+0000\n"
12-
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13-
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14-
"Language-Team: LANGUAGE <LL@li.org>\n"
11+
"POT-Creation-Date: 2024-02-24 16:01+0800\n"
12+
"PO-Revision-Date: 2024-05-13 19:30+0000\n"
13+
"Last-Translator: Matt Wang <mattwang44@gmail.com>\n"
14+
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
15+
"tw)\n"
1516
"Language: zh_TW\n"
1617
"MIME-Version: 1.0\n"
1718
"Content-Type: text/plain; charset=UTF-8\n"
1819
"Content-Transfer-Encoding: 8bit\n"
20+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
1921

2022
#: ../../howto/enum.rst:3
2123
msgid "Enum HOWTO"
22-
msgstr ""
24+
msgstr "如何使用列舉 (Enum)"
2325

2426
#: ../../howto/enum.rst:9
27+
#, fuzzy
2528
msgid ""
2629
"An :class:`Enum` is a set of symbolic names bound to unique values. They "
2730
"are similar to global variables, but they offer a more useful :func:"
2831
"`repr()`, grouping, type-safety, and a few other features."
2932
msgstr ""
33+
":class:`Enum` 是一組綁定唯一值的符號名稱集合。與全域變數類似,但提供更有用"
34+
"的 :func:`repr()`、分組功能、型別安全以及其他若干特殊功能。"
3035

3136
#: ../../howto/enum.rst:13
37+
#, fuzzy
3238
msgid ""
3339
"They are most useful when you have a variable that can take one of a limited "
3440
"selection of values. For example, the days of the week::"
3541
msgstr ""
42+
"當你有一個變數可以取值為限定的一部分時,最有用。例如:一周中的日期: ::"
3643

3744
#: ../../howto/enum.rst:26
3845
msgid "Or perhaps the RGB primary colors::"
39-
msgstr ""
46+
msgstr "或許是 RGB 主要色彩: ::"
4047

4148
#: ../../howto/enum.rst:34
49+
#, fuzzy
4250
msgid ""
4351
"As you can see, creating an :class:`Enum` is as simple as writing a class "
4452
"that inherits from :class:`Enum` itself."
4553
msgstr ""
54+
"你可以看出來,建立一個:class:`Enum`就像編寫一個從自身繼承的:class:`Enum`類"
55+
"別。"
4656

4757
#: ../../howto/enum.rst:37
4858
msgid "Case of Enum Members"
49-
msgstr ""
59+
msgstr "列舉成員的情況"
5060

5161
#: ../../howto/enum.rst:39
62+
#, fuzzy
5263
msgid ""
5364
"Because Enums are used to represent constants, and to help avoid issues with "
5465
"name clashes between mixin-class methods/attributes and enum names, we "
5566
"strongly recommend using UPPER_CASE names for members, and will be using "
5667
"that style in our examples."
5768
msgstr ""
69+
"由於列舉用於表示常數,我們建議使用大寫命名法,以此命名成員。在我們的範例中也"
70+
"會採用這種風格。"
5871

5972
#: ../../howto/enum.rst:44
73+
#, fuzzy
6074
msgid ""
6175
"Depending on the nature of the enum a member's value may or may not be "
6276
"important, but either way that value can be used to get the corresponding "
6377
"member::"
6478
msgstr ""
79+
"根據 enum 的性質,成員的值可能很重要,也可能不太重要,但無論如何這個值都可以"
80+
"用來取得對應的成員: ::"
6581

6682
#: ../../howto/enum.rst:51
83+
#, fuzzy
6784
msgid ""
6885
"As you can see, the ``repr()`` of a member shows the enum name, the member "
6986
"name, and the value. The ``str()`` of a member shows only the enum name and "
7087
"member name::"
7188
msgstr ""
89+
"你可以看到,一個成員的 ``repr()`` 會顯示列舉名稱、成員名稱和值。而該成員的 "
90+
"``str()`` 僅會顯示列舉名稱和成員名稱: ::"
7291

7392
#: ../../howto/enum.rst:58
93+
#, fuzzy
7494
msgid "The *type* of an enumeration member is the enum it belongs to::"
75-
msgstr ""
95+
msgstr "列舉成員的 *型別* 即其所屬的列舉:注意:保留 rst 格式符號: ::"
7696

7797
#: ../../howto/enum.rst:65
7898
msgid "Enum members have an attribute that contains just their :attr:`name`::"
79-
msgstr ""
99+
msgstr "列舉成員具有一個屬性,其中僅包含它們的 :attr:`name`: ::"
80100

81101
#: ../../howto/enum.rst:70
102+
#, fuzzy
82103
msgid "Likewise, they have an attribute for their :attr:`value`::"
83-
msgstr ""
104+
msgstr "同樣地,它們具有一個屬性用於它們的 :attr:`value` 值: ::"
84105

85106
#: ../../howto/enum.rst:76
107+
#, fuzzy
86108
msgid ""
87109
"Unlike many languages that treat enumerations solely as name/value pairs, "
88110
"Python Enums can have behavior added. For example, :class:`datetime.date` "
@@ -92,226 +114,291 @@ msgid ""
92114
"to the :class:`Weekday` enum to extract the day from the :class:`date` "
93115
"instance and return the matching enum member::"
94116
msgstr ""
117+
"與其他把列舉視為純名稱/值對的語言不同,Python 的 Enums 可添加行為。例如,:"
118+
"class:`datetime.date` 有兩個回傳週幾星期幾的方法::meth:`weekday` 和 :meth:"
119+
"`isoweekday`。差異在於一個從0-6算起,另一個從1-7算起。我們可以新增一個方法到:"
120+
"class:`Weekday` 列舉中 ,以提取日期實例的天數並回傳相應的列舉成員來追蹤它自 "
121+
"己: ::"
95122

96123
#: ../../howto/enum.rst:88
97124
msgid "The complete :class:`Weekday` enum now looks like this::"
98-
msgstr ""
125+
msgstr "完整的 :class:`Weekday` 列舉現在看起來像是這樣: ::"
99126

100127
#: ../../howto/enum.rst:103
101128
msgid "Now we can find out what today is! Observe::"
102-
msgstr ""
129+
msgstr "現在我們可以找出今天是哪一天了!請觀察: ::"
103130

104131
#: ../../howto/enum.rst:109
132+
#, fuzzy
105133
msgid ""
106134
"Of course, if you're reading this on some other day, you'll see that day "
107135
"instead."
108-
msgstr ""
136+
msgstr "當然,如果你是在其他日期閱讀這篇文章,你會看到該天的日期。"
109137

110138
#: ../../howto/enum.rst:111
139+
#, fuzzy
111140
msgid ""
112141
"This :class:`Weekday` enum is great if our variable only needs one day, but "
113142
"what if we need several? Maybe we're writing a function to plot chores "
114143
"during a week, and don't want to use a :class:`list` -- we could use a "
115144
"different type of :class:`Enum`::"
116145
msgstr ""
146+
"這個 :class:`Weekday` 列舉型別對於只需要一天的變數很方便,但如果我們需要多天"
147+
"呢?也許我們正在撰寫一個函式,要在整週繪製家務事項,而不想使用 :class:`list` "
148+
"-- 我們可以使用另一種 :class:`Enum` 型別: ::"
117149

118150
#: ../../howto/enum.rst:126
151+
#, fuzzy
119152
msgid ""
120153
"We've changed two things: we're inherited from :class:`Flag`, and the values "
121154
"are all powers of 2."
122-
msgstr ""
155+
msgstr "我們做了兩件事:一是繼承 :class:`Flag` 類別,二是所有的值都是2的乘方。"
123156

124157
#: ../../howto/enum.rst:129
125158
msgid ""
126159
"Just like the original :class:`Weekday` enum above, we can have a single "
127160
"selection::"
128-
msgstr ""
161+
msgstr "就像原本的 :class:`Weekday` 列舉一樣,我們可以進行單一選擇: ::"
129162

130163
#: ../../howto/enum.rst:135
131164
msgid ""
132165
"But :class:`Flag` also allows us to combine several members into a single "
133166
"variable::"
134-
msgstr ""
167+
msgstr "但是 :class:`Flag` 也允許我們將數個成員結合為一個變數: ::"
135168

136169
#: ../../howto/enum.rst:142
137170
msgid "You can even iterate over a :class:`Flag` variable::"
138-
msgstr ""
171+
msgstr "你甚至可以疊代一個 :class:`Flag` 變數: ::"
139172

140173
#: ../../howto/enum.rst:149
141174
msgid "Okay, let's get some chores set up::"
142-
msgstr ""
175+
msgstr "好的,讓我們進行一些設定: ::"
143176

144177
#: ../../howto/enum.rst:157
178+
#, fuzzy
145179
msgid "And a function to display the chores for a given day::"
146-
msgstr ""
180+
msgstr "以下是給定一個日期的家務事項顯示函式: ::"
147181

148182
#: ../../howto/enum.rst:167
183+
#, fuzzy
149184
msgid ""
150185
"In cases where the actual values of the members do not matter, you can save "
151186
"yourself some work and use :func:`auto()` for the values::"
152187
msgstr ""
188+
"如果成員的實際值不重要,你可以省去一些工作,並使用 :func:`auto()` 替代數"
189+
"值: ::"
153190

154191
#: ../../howto/enum.rst:186
155192
msgid "Programmatic access to enumeration members and their attributes"
156-
msgstr ""
193+
msgstr "可以用程式化的方式存取列舉成員及其屬性"
157194

158195
#: ../../howto/enum.rst:188
196+
#, fuzzy
159197
msgid ""
160198
"Sometimes it's useful to access members in enumerations programmatically (i."
161199
"e. situations where ``Color.RED`` won't do because the exact color is not "
162200
"known at program-writing time). ``Enum`` allows such access::"
163201
msgstr ""
202+
"有時候,以程式方式存取列舉中的成員是很有用且必要的(例如在編寫程式時無法確定"
203+
"正確顏色,因此使用 ``Color.RED`` 就不合適)。在這種情況下,可以利用 ``Enum`` "
204+
"來存取: ::"
164205

165206
#: ../../howto/enum.rst:197
166207
msgid "If you want to access enum members by *name*, use item access::"
167-
msgstr ""
208+
msgstr "如果你想要透過 *name* 存取列舉成員,請使用項目來存取: ::"
168209

169210
#: ../../howto/enum.rst:204
211+
#, fuzzy
170212
msgid "If you have an enum member and need its :attr:`name` or :attr:`value`::"
171213
msgstr ""
214+
"如果你有一個列舉的成員,並需要獲取其 :attr:`name` 或 :attr:`value`屬性: ::"
172215

173216
#: ../../howto/enum.rst:214
174217
msgid "Duplicating enum members and values"
175-
msgstr ""
218+
msgstr "複製列舉成員和值"
176219

177220
#: ../../howto/enum.rst:216
178221
msgid "Having two enum members with the same name is invalid::"
179-
msgstr ""
222+
msgstr "擁有兩個同名的列舉成員是無效的: ::"
180223

181224
#: ../../howto/enum.rst:226
225+
#, fuzzy
182226
msgid ""
183227
"However, an enum member can have other names associated with it. Given two "
184228
"entries ``A`` and ``B`` with the same value (and ``A`` defined first), ``B`` "
185229
"is an alias for the member ``A``. By-value lookup of the value of ``A`` "
186230
"will return the member ``A``. By-name lookup of ``A`` will return the "
187231
"member ``A``. By-name lookup of ``B`` will also return the member ``A``::"
188232
msgstr ""
233+
"然而,列舉成員可以有其它名稱與之相關聯。假設有兩個項目 ``A`` 與 ``B``,且其值"
234+
"相同 (且``A``定義在前面),則 ``B`` 是成員 ``A`` 的別名。透過取得 \"by-"
235+
"value\"屬性來查找 \"A\"的值會回傳成員\"A\"; 透過 \"by-name\"方式查找\"A\"也"
236+
"會回傳成員\"A\";透過 \"by-name\" 方式查找\"B\",同樣也會回傳 成員 ``A``: ::"
189237

190238
#: ../../howto/enum.rst:247
239+
#, fuzzy
191240
msgid ""
192241
"Attempting to create a member with the same name as an already defined "
193242
"attribute (another member, a method, etc.) or attempting to create an "
194243
"attribute with the same name as a member is not allowed."
195244
msgstr ""
245+
"嘗試建立一個與已定義的屬性(另一個成員、方法等)同名的成員,或者嘗試建立一個"
246+
"與成 員同名的屬性是不被允許的。"
196247

197248
#: ../../howto/enum.rst:253
198249
msgid "Ensuring unique enumeration values"
199-
msgstr ""
250+
msgstr "確保列舉值唯一"
200251

201252
#: ../../howto/enum.rst:255
253+
#, fuzzy
202254
msgid ""
203255
"By default, enumerations allow multiple names as aliases for the same value. "
204256
"When this behavior isn't desired, you can use the :func:`unique` decorator::"
205257
msgstr ""
258+
"預設情況下,列舉型別允許使用多個名稱作為相同值的別名。當不希望這種行為時,可"
259+
"以使用 :func:`unique` 裝飾器: ::"
206260

207261
#: ../../howto/enum.rst:272
208262
msgid "Using automatic values"
209-
msgstr ""
263+
msgstr "使用自動產生的值"
210264

211265
#: ../../howto/enum.rst:274
266+
#, fuzzy
212267
msgid "If the exact value is unimportant you can use :class:`auto`::"
213-
msgstr ""
268+
msgstr "如果精確值不重要,可以使用 :class:`auto`: ::"
214269

215270
#: ../../howto/enum.rst:285
271+
#, fuzzy
216272
msgid ""
217273
"The values are chosen by :func:`_generate_next_value_`, which can be "
218274
"overridden::"
219-
msgstr ""
275+
msgstr "值是由 :func:`_generate_next_value_` 決定的,可以被覆寫: ::"
220276

221277
#: ../../howto/enum.rst:304
278+
#, fuzzy
222279
msgid ""
223280
"The :meth:`_generate_next_value_` method must be defined before any members."
224-
msgstr ""
281+
msgstr "在任何成員之前都必須先定義 :meth:`_generate_next_value_` 方法。"
225282

226283
#: ../../howto/enum.rst:307
227284
msgid "Iteration"
228-
msgstr ""
285+
msgstr "疊代"
229286

230287
#: ../../howto/enum.rst:309
288+
#, fuzzy
231289
msgid "Iterating over the members of an enum does not provide the aliases::"
232-
msgstr ""
290+
msgstr "逐一列舉列舉型別的成員時不提供其別名: ::"
233291

234292
#: ../../howto/enum.rst:316
293+
#, fuzzy
235294
msgid ""
236295
"Note that the aliases ``Shape.ALIAS_FOR_SQUARE`` and ``Weekday.WEEKEND`` "
237296
"aren't shown."
238297
msgstr ""
298+
"注意:別名 ``Shape.ALIAS_FOR_SQUARE`` 和 ``Weekday.WEEKEND`` 沒有顯示。"
239299

240300
#: ../../howto/enum.rst:318
301+
#, fuzzy
241302
msgid ""
242303
"The special attribute ``__members__`` is a read-only ordered mapping of "
243304
"names to members. It includes all names defined in the enumeration, "
244305
"including the aliases::"
245306
msgstr ""
307+
"特殊屬性 ``__members__`` 是一個只能讀取的有序映射,從名稱到成員。它包括了列舉"
308+
"中定義的所有名稱,包括別名: ::"
246309

247310
#: ../../howto/enum.rst:330
311+
#, fuzzy
248312
msgid ""
249313
"The ``__members__`` attribute can be used for detailed programmatic access "
250314
"to the enumeration members. For example, finding all the aliases::"
251315
msgstr ""
316+
"``__members__`` 屬性可用於對列舉成員進行詳細的程式設計訪問。例如,查找所有別"
317+
"名: ::"
252318

253319
#: ../../howto/enum.rst:338
320+
#, fuzzy
254321
msgid ""
255322
"Aliases for flags include values with multiple flags set, such as ``3``, and "
256323
"no flags set, i.e. ``0``."
257324
msgstr ""
325+
"輸入參數的別名可以使用在有多個指令旗標時,例如 `3`;也可用於無任何指令旗標"
326+
"時,即 `0`。"
258327

259328
#: ../../howto/enum.rst:343
260329
msgid "Comparisons"
261-
msgstr ""
330+
msgstr "比較"
262331

263332
#: ../../howto/enum.rst:345
333+
#, fuzzy
264334
msgid "Enumeration members are compared by identity::"
265-
msgstr ""
335+
msgstr "列舉成員按識別性進行比較: ::"
266336

267337
#: ../../howto/enum.rst:354
338+
#, fuzzy
268339
msgid ""
269340
"Ordered comparisons between enumeration values are *not* supported. Enum "
270341
"members are not integers (but see `IntEnum`_ below)::"
271342
msgstr ""
343+
"不支援列舉值之間的排序比較。列舉成員並非整數(但下方可參考 `IntEnum`_): ::"
272344

273345
#: ../../howto/enum.rst:362
346+
#, fuzzy
274347
msgid "Equality comparisons are defined though::"
275-
msgstr ""
348+
msgstr "等式比較是透過以下定義: ::"
276349

277350
#: ../../howto/enum.rst:371
351+
#, fuzzy
278352
msgid ""
279353
"Comparisons against non-enumeration values will always compare not equal "
280354
"(again, :class:`IntEnum` was explicitly designed to behave differently, see "
281355
"below)::"
282356
msgstr ""
357+
"對不包含列舉值的比較總是會得到「不相等」(再一次地,:class:`IntEnum` 是有特別"
358+
"定義的行為,詳情見下文): ::"
283359

284360
#: ../../howto/enum.rst:380
361+
#, fuzzy
285362
msgid ""
286363
"It is possible to reload modules -- if a reloaded module contains enums, "
287364
"they will be recreated, and the new members may not compare identical/equal "
288365
"to the original members."
289366
msgstr ""
367+
"可以重新加載模組——如果重新加載的模組包含列舉,它們將被重新建立,並且新成員可"
368+
"能不會與原始成員相同/相等。"
290369

291370
#: ../../howto/enum.rst:385
292371
msgid "Allowed members and attributes of enumerations"
293-
msgstr ""
372+
msgstr "列舉型別中的允許成員和屬性"
294373

295374
#: ../../howto/enum.rst:387
375+
#, fuzzy
296376
msgid ""
297377
"Most of the examples above use integers for enumeration values. Using "
298378
"integers is short and handy (and provided by default by the `Functional "
299379
"API`_), but not strictly enforced. In the vast majority of use-cases, one "
300380
"doesn't care what the actual value of an enumeration is. But if the value "
301381
"*is* important, enumerations can have arbitrary values."
302382
msgstr ""
383+
"大部分上面的範例都使用整數來作為列舉值。使用整數即方便又快速(而且Functional "
384+
"API預設也會支援),但不是強制性的做法。在極大多數情況下,一個資料列舉實際所代"
385+
"表的值不重要。但如果該值很重要,你仍可以隨意指定任何需求所涵蓋到之列舉值。"
303386

304387
#: ../../howto/enum.rst:393
388+
#, fuzzy
305389
msgid ""
306390
"Enumerations are Python classes, and can have methods and special methods as "
307391
"usual. If we have this enumeration::"
308392
msgstr ""
393+
"列舉是 Python 中的一種類別,可像慣例中的其他類別一樣,具有方法和特殊方法。若"
394+
"我們定義以下列舉: ::"
309395

310396
#: ../../howto/enum.rst:413
311397
msgid "Then::"
312-
msgstr ""
398+
msgstr "接著是: ::"
313399

314400
#: ../../howto/enum.rst:422
401+
#, fuzzy
315402
msgid ""
316403
"The rules for what is allowed are as follows: names that start and end with "
317404
"a single underscore are reserved by enum and cannot be used; all other "
@@ -320,123 +407,165 @@ msgid ""
320407
"`__add__`, etc.), descriptors (methods are also descriptors), and variable "
321408
"names listed in :attr:`_ignore_`."
322409
msgstr ""
410+
"定義列舉時,需注意以下規則:命名以一個底線開頭和結尾的名稱保留給 enum ,不能"
411+
"使用;除了特殊方法(例如: :meth:`__str__`, :meth:`__add__` 等)、描述符 (方法"
412+
"也是描述符) 以及在 :attr:`_ignore_` 中列出的變數名之外,定義於列舉內部的所有"
413+
"屬性都會成為此列舉類別的成員。"
323414

324415
#: ../../howto/enum.rst:429
416+
#, fuzzy
325417
msgid ""
326418
"Note: if your enumeration defines :meth:`__new__` and/or :meth:`__init__`, "
327419
"any value(s) given to the enum member will be passed into those methods. See "
328420
"`Planet`_ for an example."
329421
msgstr ""
422+
"請注意:如果你的列舉定義了 ``__new__`` 和/或 ``__init__`` 方法,則任何指定給"
423+
"該列舉成員的值都將傳遞到這些方法中。請參考 `Planet`_ 的範例。"
330424

331425
#: ../../howto/enum.rst:435
426+
#, fuzzy
332427
msgid ""
333428
"The :meth:`__new__` method, if defined, is used during creation of the Enum "
334429
"members; it is then replaced by Enum's :meth:`__new__` which is used after "
335430
"class creation for lookup of existing members. See :ref:`new-vs-init` for "
336431
"more details."
337432
msgstr ""
433+
"__new__` 方法(如果定義)將在建立 Enum 成員期間使用;然後它被 Enum 的 "
434+
"__new__` 替換,該 __new__` 在類別建立後用於尋找現有成員。有關更多詳細資訊,請"
435+
"參閱:ref:`new-vs-init`。"
338436

339437
#: ../../howto/enum.rst:442
340438
msgid "Restricted Enum subclassing"
341-
msgstr ""
439+
msgstr "受限列舉子類別化"
342440

343441
#: ../../howto/enum.rst:444
442+
#, fuzzy
344443
msgid ""
345444
"A new :class:`Enum` class must have one base enum class, up to one concrete "
346445
"data type, and as many :class:`object`-based mixin classes as needed. The "
347446
"order of these base classes is::"
348447
msgstr ""
448+
"一個新的 :class:`Enum` 類別必須擁有一個基礎列舉(enum)類別、不超過一種具體的資"
449+
"料型別(data type),以及所需的任意數量使用 :class:`object` 為基礎(mixin) 的混"
450+
"合類別。這些基礎類別(base classes)之間的順序為: ::"
349451

350452
#: ../../howto/enum.rst:451
453+
#, fuzzy
351454
msgid ""
352455
"Also, subclassing an enumeration is allowed only if the enumeration does not "
353456
"define any members. So this is forbidden::"
354457
msgstr ""
458+
"同時,只有在列舉型別未定義任何成員時才允許子類化enumeration。因此,這是被禁止"
459+
"的: ::"
355460

356461
#: ../../howto/enum.rst:461
357462
msgid "But this is allowed::"
358-
msgstr ""
463+
msgstr "但這是允許的: ::"
359464

360465
#: ../../howto/enum.rst:472
466+
#, fuzzy
361467
msgid ""
362468
"Allowing subclassing of enums that define members would lead to a violation "
363469
"of some important invariants of types and instances. On the other hand, it "
364470
"makes sense to allow sharing some common behavior between a group of "
365471
"enumerations. (See `OrderedEnum`_ for an example.)"
366472
msgstr ""
473+
"允許定義成員的列舉型別可以被繼承,但這也會違反一些重要的類型和實例不變數。然"
474+
"而,在一組列舉中,允許共享某些通用的行為是有道理的。(例如參考 `OrderedEnum`_ "
475+
"之範例) 。"
367476

368477
#: ../../howto/enum.rst:481
478+
#, fuzzy
369479
msgid "Dataclass support"
370-
msgstr ""
480+
msgstr "資料類支援"
371481

372482
#: ../../howto/enum.rst:483
483+
#, fuzzy
373484
msgid ""
374485
"When inheriting from a :class:`~dataclasses.dataclass`, the :meth:`~Enum."
375486
"__repr__` omits the inherited class' name. For example::"
376487
msgstr ""
488+
"當從:class:`~dataclasses.dataclass` 繼承時,:meth:`~Enum.__repr__` 會省略繼承"
489+
"的類別的名稱。例如::"
377490

378491
#: ../../howto/enum.rst:500
492+
#, fuzzy
379493
msgid ""
380494
"Use the :func:`!dataclass` argument ``repr=False`` to use the standard :func:"
381495
"`repr`."
382-
msgstr ""
496+
msgstr "使用 :func:`!dataclass` 參數 ``repr=False`` 來使用標準 :func:`repr`。"
383497

384498
#: ../../howto/enum.rst:503
499+
#, fuzzy
385500
msgid ""
386501
"Only the dataclass fields are shown in the value area, not the dataclass' "
387502
"name."
388-
msgstr ""
503+
msgstr "值區域中僅顯示資料類欄位,而不顯示資料類名稱。"
389504

390505
#: ../../howto/enum.rst:509
391506
msgid "Pickling"
392-
msgstr ""
507+
msgstr "Pickling"
393508

394509
#: ../../howto/enum.rst:511
395510
msgid "Enumerations can be pickled and unpickled::"
396-
msgstr ""
511+
msgstr "列舉可以被 pickle 和 unpickle: ::"
397512

398513
#: ../../howto/enum.rst:518
514+
#, fuzzy
399515
msgid ""
400516
"The usual restrictions for pickling apply: picklable enums must be defined "
401517
"in the top level of a module, since unpickling requires them to be "
402518
"importable from that module."
403519
msgstr ""
520+
"通常對於 pickling 有一些限制:可 pickle 的列舉型別必須在模組的最上層定義,因"
521+
"為反序列化需要它們從該模組中 importable。"
404522

405523
#: ../../howto/enum.rst:524
524+
#, fuzzy
406525
msgid ""
407526
"With pickle protocol version 4 it is possible to easily pickle enums nested "
408527
"in other classes."
409528
msgstr ""
529+
"從 pickle 協議版本 4 開始,嵌套在其他類別內的 enums 可以方便地進行序列化"
530+
"(pickle)。"
410531

411532
#: ../../howto/enum.rst:527
533+
#, fuzzy
412534
msgid ""
413535
"It is possible to modify how enum members are pickled/unpickled by defining :"
414536
"meth:`__reduce_ex__` in the enumeration class. The default method is by-"
415537
"value, but enums with complicated values may want to use by-name::"
416538
msgstr ""
539+
"可以透過在列舉類別中定義 :meth:`__reduce_ex__` 來修改列舉成員的取捨(pickled/"
540+
"unpickled)方式: ::"
417541

418542
#: ../../howto/enum.rst:537
543+
#, fuzzy
419544
msgid ""
420545
"Using by-name for flags is not recommended, as unnamed aliases will not "
421546
"unpickle."
422-
msgstr ""
547+
msgstr "不建議旗標使用依名稱,因為未命名的別名不會被 unpickle。"
423548

424549
#: ../../howto/enum.rst:542
425550
msgid "Functional API"
426-
msgstr ""
551+
msgstr "功能性 API"
427552

428553
#: ../../howto/enum.rst:544
429554
msgid ""
430555
"The :class:`Enum` class is callable, providing the following functional API::"
431-
msgstr ""
556+
msgstr ":class:`Enum` 類別是可呼叫物件,並提供以下功能性 API: ::"
432557

433558
#: ../../howto/enum.rst:554
559+
#, fuzzy
434560
msgid ""
435561
"The semantics of this API resemble :class:`~collections.namedtuple`. The "
436562
"first argument of the call to :class:`Enum` is the name of the enumeration."
437563
msgstr ""
564+
"這個 API 的語義類似 :class:`~collections.namedtuple`。叫用 :class:`Enum` 的第"
565+
"一個引數是列舉型別的名稱。"
438566

439567
#: ../../howto/enum.rst:557
568+
#, fuzzy
440569
msgid ""
441570
"The second argument is the *source* of enumeration member names. It can be "
442571
"a whitespace-separated string of names, a sequence of names, a sequence of 2-"
@@ -447,128 +576,160 @@ msgid ""
447576
"class derived from :class:`Enum` is returned. In other words, the above "
448577
"assignment to :class:`Animal` is equivalent to::"
449578
msgstr ""
579+
"第二個參數是列舉成員名稱的「來源」。它可以是由空格分隔的字串、一系列名稱、具"
580+
"有鍵值對的 2 元序列,或者映射(例如字典),其中包含了名稱和相應值。最後兩個選項"
581+
"使得能夠將任意值指定給列舉;其他則自動分配從 1 開始增加的整數 (使用 "
582+
"``start`` 參數可指定不同的起始值) 。回傳一個衍生自 :class:`Enum` 的新類別。換"
583+
"句話說,上面賦予 :class:`Animal` 的功能等價於: ::"
450584

451585
#: ../../howto/enum.rst:573
586+
#, fuzzy
452587
msgid ""
453588
"The reason for defaulting to ``1`` as the starting number and not ``0`` is "
454589
"that ``0`` is ``False`` in a boolean sense, but by default enum members all "
455590
"evaluate to ``True``."
456591
msgstr ""
592+
"預設將起始數字設為 ``1`` 而非 ``0`` 的原因是,布林運算中 ``0`` 為 ``False``, "
593+
"但列舉型別中成員的預設值皆為真(evaluate to True)。"
457594

458595
#: ../../howto/enum.rst:577
596+
#, fuzzy
459597
msgid ""
460598
"Pickling enums created with the functional API can be tricky as frame stack "
461599
"implementation details are used to try and figure out which module the "
462600
"enumeration is being created in (e.g. it will fail if you use a utility "
463601
"function in a separate module, and also may not work on IronPython or "
464602
"Jython). The solution is to specify the module name explicitly as follows::"
465603
msgstr ""
604+
"使用函式 API 建立的列舉型別可能會比較棘手,因為框架堆疊實現細節被用來嘗試找出"
605+
"建立列舉型別的模組(例如,如果在另一個模組中使用實用工具函式則失敗,在 "
606+
"IronPython 或 Jython 上也可能無法正常運作)。解決方案是明確指定模組名稱,如下"
607+
"所示: ::"
466608

467609
#: ../../howto/enum.rst:587
610+
#, fuzzy
468611
msgid ""
469612
"If ``module`` is not supplied, and Enum cannot determine what it is, the new "
470613
"Enum members will not be unpicklable; to keep errors closer to the source, "
471614
"pickling will be disabled."
472615
msgstr ""
616+
"如果未提供``module``,且Enum不能確定它是什麼,新的Enum成員將無法進行反序列"
617+
"化; 為了讓錯誤更接近源頭,pickling會被禁用。"
473618

474619
#: ../../howto/enum.rst:591
620+
#, fuzzy
475621
msgid ""
476622
"The new pickle protocol 4 also, in some circumstances, relies on :attr:"
477623
"`~definition.__qualname__` being set to the location where pickle will be "
478624
"able to find the class. For example, if the class was made available in "
479625
"class SomeData in the global scope::"
480626
msgstr ""
627+
"新的 pickle 協議 4 在某些情況下還依賴於 :attr:``~definition.__qualname__`` 設"
628+
"置為 pickle 能找到該類別位置的屬性。舉例而言,如果在全域範圍內建立了一個名為 "
629+
"SomeData 的類別: ::"
481630

482631
#: ../../howto/enum.rst:598
483632
msgid "The complete signature is::"
484-
msgstr ""
633+
msgstr "完整的函式為: ::"
485634

486635
#: ../../howto/enum.rst:610
487636
msgid "*value*: What the new enum class will record as its name."
488-
msgstr ""
637+
msgstr "*value*:新列舉類別將記錄為其名稱。"
489638

490639
#: ../../howto/enum.rst:612
640+
#, fuzzy
491641
msgid ""
492642
"*names*: The enum members. This can be a whitespace- or comma-separated "
493643
"string (values will start at 1 unless otherwise specified)::"
494644
msgstr ""
645+
"*names*:列出 enum 的成員,這應為一個換行或以逗號分隔的字串(否則值將從 1 開"
646+
"始): ::"
495647

496648
#: ../../howto/enum.rst:617
497649
msgid "or an iterator of names::"
498-
msgstr ""
650+
msgstr "或一個名稱的疊代器: ::"
499651

500652
#: ../../howto/enum.rst:621
501653
msgid "or an iterator of (name, value) pairs::"
502-
msgstr ""
654+
msgstr "或是一個 (name, value) 對的疊代器: ::"
503655

504656
#: ../../howto/enum.rst:625
505657
msgid "or a mapping::"
506-
msgstr ""
658+
msgstr "或是一個對映: ::"
507659

508660
#: ../../howto/enum.rst:629
661+
#, fuzzy
509662
msgid "*module*: name of module where new enum class can be found."
510-
msgstr ""
663+
msgstr "*module*:可以找到新列舉類別的模組的名稱。"
511664

512665
#: ../../howto/enum.rst:631
666+
#, fuzzy
513667
msgid "*qualname*: where in module new enum class can be found."
514-
msgstr ""
668+
msgstr "*qualname*:在模組中可以找到新列舉類別的位置。"
515669

516670
#: ../../howto/enum.rst:633
517671
msgid "*type*: type to mix in to new enum class."
518-
msgstr ""
672+
msgstr "*type*:混合到新列舉類別中的型別。"
519673

520674
#: ../../howto/enum.rst:635
521675
msgid "*start*: number to start counting at if only names are passed in."
522-
msgstr ""
676+
msgstr "*start*:如果僅傳入名稱,則從該數字開始計數。"
523677

524678
#: ../../howto/enum.rst:637
525679
msgid "The *start* parameter was added."
526-
msgstr ""
680+
msgstr "新增了 *start* 參數。"
527681

528682
#: ../../howto/enum.rst:642
529683
msgid "Derived Enumerations"
530-
msgstr ""
684+
msgstr "衍生列舉"
531685

532686
#: ../../howto/enum.rst:645
533687
msgid "IntEnum"
534-
msgstr ""
688+
msgstr "IntEnum"
535689

536690
#: ../../howto/enum.rst:647
691+
#, fuzzy
537692
msgid ""
538693
"The first variation of :class:`Enum` that is provided is also a subclass of :"
539694
"class:`int`. Members of an :class:`IntEnum` can be compared to integers; by "
540695
"extension, integer enumerations of different types can also be compared to "
541696
"each other::"
542697
msgstr ""
698+
"提供的第一種:class:`Enum`變異體也是 :class:`int` 的子類別。:class:`IntEnum` "
699+
"成員可與整數進行比較;由此,不同型別的整數列舉也可以相互比較: ::"
543700

544701
#: ../../howto/enum.rst:668
545702
msgid ""
546703
"However, they still can't be compared to standard :class:`Enum` "
547704
"enumerations::"
548-
msgstr ""
705+
msgstr "然而,它們仍無法與標準的 :class:`Enum` 型別相比較: ::"
549706

550707
#: ../../howto/enum.rst:681
551708
msgid ""
552709
":class:`IntEnum` values behave like integers in other ways you'd expect::"
553-
msgstr ""
710+
msgstr ":class:`IntEnum` 型別的值在其他方面的行為就像你所預期的整數一樣: ::"
554711

555712
#: ../../howto/enum.rst:692
556713
msgid "StrEnum"
557-
msgstr ""
714+
msgstr "StrEnum"
558715

559716
#: ../../howto/enum.rst:694
717+
#, fuzzy
560718
msgid ""
561719
"The second variation of :class:`Enum` that is provided is also a subclass "
562720
"of :class:`str`. Members of a :class:`StrEnum` can be compared to strings; "
563721
"by extension, string enumerations of different types can also be compared to "
564722
"each other."
565723
msgstr ""
724+
"提供第二種 :class:`Enum` 變型的子類別 :class:`StrEnum`。:class:`StrEnum` 的成"
725+
"員可與字串比較;因此,不同型態的字串列舉也可以彼此比較。"
566726

567727
#: ../../howto/enum.rst:703
568728
msgid "IntFlag"
569-
msgstr ""
729+
msgstr "IntFlag"
570730

571731
#: ../../howto/enum.rst:705
732+
#, fuzzy
572733
msgid ""
573734
"The next variation of :class:`Enum` provided, :class:`IntFlag`, is also "
574735
"based on :class:`int`. The difference being :class:`IntFlag` members can be "
@@ -577,61 +738,82 @@ msgid ""
577738
"`IntFlag` members are also integers and can be used wherever an :class:`int` "
578739
"is used."
579740
msgstr ""
741+
"提供的 Enum 的下一個變體 IntFlag 也基於 int。差別在於 IntFlag 成員可以使用位"
742+
"元運算子(&、\\|、^、~)進行組合,如果可能的話,結果仍然是 IntFlag 成員。與 "
743+
"IntEnum 一樣,IntFlag 成員也是整數,並且可以在使用 int 的任何地方使用。"
580744

581745
#: ../../howto/enum.rst:713
746+
#, fuzzy
582747
msgid ""
583748
"Any operation on an :class:`IntFlag` member besides the bit-wise operations "
584749
"will lose the :class:`IntFlag` membership."
585750
msgstr ""
751+
"除了以位元運算的方式操作 :class:`IntFlag` 成員之外,其他任何操作都會使這個成"
752+
"員失去屬於 :class:`IntFlag` 的身份。"
586753

587754
#: ../../howto/enum.rst:716
755+
#, fuzzy
588756
msgid ""
589757
"Bit-wise operations that result in invalid :class:`IntFlag` values will lose "
590758
"the :class:`IntFlag` membership. See :class:`FlagBoundary` for details."
591759
msgstr ""
760+
"進行位元運算,若導致 :class:`IntFlag` 值無效,就會失去 :class:`IntFlag` 成員"
761+
"資格。詳細資訊請參考 :class:`FlagBoundary`。"
592762

593763
#: ../../howto/enum.rst:723
594764
msgid "Sample :class:`IntFlag` class::"
595-
msgstr ""
765+
msgstr "範例 :class:`IntFlag` 類別: ::"
596766

597767
#: ../../howto/enum.rst:739
598768
msgid "It is also possible to name the combinations::"
599-
msgstr ""
769+
msgstr "可以為這些組合命名: ::"
600770

601771
#: ../../howto/enum.rst:756
772+
#, fuzzy
602773
msgid ""
603774
"Named combinations are considered aliases. Aliases do not show up during "
604775
"iteration, but can be returned from by-value lookups."
605776
msgstr ""
777+
"已命名的組合被視為別名。\"Aliases\" 在疊代時不會顯示,但可以從按值查找中回"
778+
"傳。"
606779

607780
#: ../../howto/enum.rst:761
781+
#, fuzzy
608782
msgid ""
609783
"Another important difference between :class:`IntFlag` and :class:`Enum` is "
610784
"that if no flags are set (the value is 0), its boolean evaluation is :data:"
611785
"`False`::"
612786
msgstr ""
787+
":class:`IntFlag` 和 :class:`Enum` 之間的另一個重要差異是,如果沒有設定旗標"
788+
"(值為0),那麼它的布林估值就是 :data:`False`: ::"
613789

614790
#: ../../howto/enum.rst:769
791+
#, fuzzy
615792
msgid ""
616793
"Because :class:`IntFlag` members are also subclasses of :class:`int` they "
617794
"can be combined with them (but may lose :class:`IntFlag` membership::"
618795
msgstr ""
796+
"由於 :class:`IntFlag` 成員也是 :class:`int` 的子類別,因此它們可以與這些數值"
797+
"結合使用 (但其可能失去 :class:`IntFlag` 的成員身份) : ::"
619798

620799
#: ../../howto/enum.rst:780
800+
#, fuzzy
621801
msgid ""
622802
"The negation operator, ``~``, always returns an :class:`IntFlag` member with "
623803
"a positive value::"
624804
msgstr ""
805+
"否定運算子 ``~``,總是會回傳一個 :class:`IntFlag` 成員,其值為正數: ::"
625806

626807
#: ../../howto/enum.rst:786
627808
msgid ":class:`IntFlag` members can also be iterated over::"
628-
msgstr ""
809+
msgstr ":class:`IntFlag` 的成員也可以進行疊代: ::"
629810

630811
#: ../../howto/enum.rst:795
631812
msgid "Flag"
632-
msgstr ""
813+
msgstr "Flag"
633814

634815
#: ../../howto/enum.rst:797
816+
#, fuzzy
635817
msgid ""
636818
"The last variation is :class:`Flag`. Like :class:`IntFlag`, :class:`Flag` "
637819
"members can be combined using the bitwise operators (&, \\|, ^, ~). Unlike :"
@@ -640,30 +822,41 @@ msgid ""
640822
"specify the values directly it is recommended to use :class:`auto` as the "
641823
"value and let :class:`Flag` select an appropriate value."
642824
msgstr ""
825+
"最後一個變體是 Flag。與 IntFlag 一樣,Flag 成員可以使用位元運算子(&、\\|、"
826+
"^、~)進行組合。與 IntFlag 不同,它們不能與任何其他 Flag 列舉或 int 組合或比"
827+
"較。雖然可以直接指定值,但建議使用 auto 作為值,並讓 Flag 選擇適當的值。"
643828

644829
#: ../../howto/enum.rst:806
830+
#, fuzzy
645831
msgid ""
646832
"Like :class:`IntFlag`, if a combination of :class:`Flag` members results in "
647833
"no flags being set, the boolean evaluation is :data:`False`::"
648834
msgstr ""
835+
"類似 :class:`IntFlag` 的作法,如果一組 :class:`Flag` 類別的成員結果沒有任何旗"
836+
"標被設定,那麼布林式評估會是 :data:`False`: ::"
649837

650838
#: ../../howto/enum.rst:820
839+
#, fuzzy
651840
msgid ""
652841
"Individual flags should have values that are powers of two (1, 2, 4, "
653842
"8, ...), while combinations of flags will not::"
654843
msgstr ""
844+
"個別的旗標 (flag) 應該具有 2 的次方數值 (1, 2, 4, 8...),而旗標組合則不"
845+
"會: ::"
655846

656847
#: ../../howto/enum.rst:832
848+
#, fuzzy
657849
msgid ""
658850
"Giving a name to the \"no flags set\" condition does not change its boolean "
659851
"value::"
660-
msgstr ""
852+
msgstr "將「無旗標設置」狀況命名並不會改變其布林值:"
661853

662854
#: ../../howto/enum.rst:846
663855
msgid ":class:`Flag` members can also be iterated over::"
664-
msgstr ""
856+
msgstr ":class:`Flag` 成員也可以被疊代: ::"
665857

666858
#: ../../howto/enum.rst:856
859+
#, fuzzy
667860
msgid ""
668861
"For the majority of new code, :class:`Enum` and :class:`Flag` are strongly "
669862
"recommended, since :class:`IntEnum` and :class:`IntFlag` break some semantic "
@@ -673,176 +866,240 @@ msgid ""
673866
"will not do; for example, when integer constants are replaced with "
674867
"enumerations, or for interoperability with other systems."
675868
msgstr ""
869+
"對於大部分的新程式碼,強烈建議使用 :class:`Enum` 和 :class:`Flag`, 因為 :"
870+
"class:`IntEnum` 和 :class:`IntFlag` 違反了列舉型別的一些語意承諾(可比較整數,"
871+
"因此也可適用於其他無關聯的列舉型別)。只有在不具備:class: `Enum`和:class: "
872+
"`Flag` 的功能時方才應使用:class: ` IntEnum`與: class:``IntDate``;例如當整"
873+
"數常量被替換成列舉常量或需要互通性質上其他系統時。"
676874

677875
#: ../../howto/enum.rst:866
678876
msgid "Others"
679-
msgstr ""
877+
msgstr "其他"
680878

681879
#: ../../howto/enum.rst:868
880+
#, fuzzy
682881
msgid ""
683882
"While :class:`IntEnum` is part of the :mod:`enum` module, it would be very "
684883
"simple to implement independently::"
685884
msgstr ""
885+
"雖然 :class:`IntEnum` 是 :mod:`enum` 模組的一部分,但獨立實現也非常簡單: ::"
686886

687887
#: ../../howto/enum.rst:874
888+
#, fuzzy
688889
msgid ""
689890
"This demonstrates how similar derived enumerations can be defined; for "
690891
"example a :class:`FloatEnum` that mixes in :class:`float` instead of :class:"
691892
"`int`."
692893
msgstr ""
894+
"這展示了多種派生列舉定義相似之處;例如,一個以浮點型別(``float``)混入代替整"
895+
"數(``int``)的 ``FloatEnum`` 類別。"
693896

694897
#: ../../howto/enum.rst:877
695898
msgid "Some rules:"
696-
msgstr ""
899+
msgstr "一些規則:"
697900

698901
#: ../../howto/enum.rst:879
902+
#, fuzzy
699903
msgid ""
700904
"When subclassing :class:`Enum`, mix-in types must appear before :class:"
701905
"`Enum` itself in the sequence of bases, as in the :class:`IntEnum` example "
702906
"above."
703907
msgstr ""
908+
"當子類別化 :class:`Enum` 時,mix-in 的型別必須在 :class:`Enum` 本身之前出現於"
909+
"基礎序列中,就像先前舉的 :class:`IntEnum` 範例。"
704910

705911
#: ../../howto/enum.rst:882
912+
#, fuzzy
706913
msgid ""
707914
"Mix-in types must be subclassable. For example, :class:`bool` and :class:"
708915
"`range` are not subclassable and will throw an error during Enum creation if "
709916
"used as the mix-in type."
710917
msgstr ""
918+
"混入類別必須是可被繼承的。例如 :class:`bool` 和 :class:`range` 並非可被子類化"
919+
"的,如果用於作為混入類型則會在建立列舉時拋出錯誤訊息。"
711920

712921
#: ../../howto/enum.rst:885
922+
#, fuzzy
713923
msgid ""
714924
"While :class:`Enum` can have members of any type, once you mix in an "
715925
"additional type, all the members must have values of that type, e.g. :class:"
716926
"`int` above. This restriction does not apply to mix-ins which only add "
717927
"methods and don't specify another type."
718928
msgstr ""
929+
"雖然:class:`Enum`可以包含任何型別的成員,但是一旦混合了其他型別,所有的成員都"
930+
"必須具有該型別的值,例如上面提到的 :class:`int`。這個限制不適用於僅添加方法而"
931+
"未指定另一種類型的 mixin。"
719932

720933
#: ../../howto/enum.rst:889
934+
#, fuzzy
721935
msgid ""
722936
"When another data type is mixed in, the :attr:`value` attribute is *not the "
723937
"same* as the enum member itself, although it is equivalent and will compare "
724938
"equal."
725939
msgstr ""
940+
"當enum與其他型別混在一起時,即使他們是相等的且具有可比性,該列舉成員本身和屬"
941+
"性 :attr:`value` *不會完全相同*。"
726942

727943
#: ../../howto/enum.rst:892
944+
#, fuzzy
728945
msgid ""
729946
"A ``data type`` is a mixin that defines :meth:`__new__`, or a :class:"
730947
"`~dataclasses.dataclass`"
731948
msgstr ""
949+
"``data type`` 是定義 :meth:`__new__` 或 :class:`~dataclasses.dataclass` 的 "
950+
"mixin"
732951

733952
#: ../../howto/enum.rst:894
953+
#, fuzzy
734954
msgid ""
735955
"%-style formatting: ``%s`` and ``%r`` call the :class:`Enum` class's :meth:"
736956
"`__str__` and :meth:`__repr__` respectively; other codes (such as ``%i`` or "
737957
"``%h`` for IntEnum) treat the enum member as its mixed-in type."
738958
msgstr ""
959+
"% 風格的格式化:使用 ``%s`` 和 ``%r``,分別會呼叫 :class:`Enum` 類別的 :meth:"
960+
"`__str__` 和 :meth:`__repr__`;其它格式符號(例如:IntEnum 的 ``%i`` 或 "
961+
"``%h``)則將列舉成員視為其混入型別。"
739962

740963
#: ../../howto/enum.rst:897
741964
msgid ""
742965
":ref:`Formatted string literals <f-strings>`, :meth:`str.format`, and :func:"
743966
"`format` will use the enum's :meth:`__str__` method."
744967
msgstr ""
968+
":ref:`格式化字串文本 <f-strings>`、:meth:`str.format` 和 :func:`format` 會使"
969+
"用列舉的 :meth:`__str__` 方法。"
745970

746971
#: ../../howto/enum.rst:902
972+
#, fuzzy
747973
msgid ""
748974
"Because :class:`IntEnum`, :class:`IntFlag`, and :class:`StrEnum` are "
749975
"designed to be drop-in replacements for existing constants, their :meth:"
750976
"`__str__` method has been reset to their data types' :meth:`__str__` method."
751977
msgstr ""
978+
"由於 :class:`IntEnum`、:class:`IntFlag` 和 :class:`StrEnum` 被設計為現有常數"
979+
"的即插即用替代品,因此它們的 :meth:`__str__` 方法已被重置為其資料類型的 :"
980+
"meth:`__str__` 方法。"
752981

753982
#: ../../howto/enum.rst:910
754983
msgid "When to use :meth:`__new__` vs. :meth:`__init__`"
755-
msgstr ""
984+
msgstr "何時使用 :meth:`__new__` 而不是 :meth:`__init__`"
756985

757986
#: ../../howto/enum.rst:912
987+
#, fuzzy
758988
msgid ""
759989
":meth:`__new__` must be used whenever you want to customize the actual value "
760990
"of the :class:`Enum` member. Any other modifications may go in either :meth:"
761991
"`__new__` or :meth:`__init__`, with :meth:`__init__` being preferred."
762992
msgstr ""
993+
"當你想客製化 :class:`Enum` 成員的實際值時,必須使用 :meth:`__new__`。任何其他"
994+
"修改可以放在 :meth:`__new_` 或是 :meth:`__init__` 中,而優先選擇使用 :meth:"
995+
"`__init__ ` 進行修改。"
763996

764997
#: ../../howto/enum.rst:916
998+
#, fuzzy
765999
msgid ""
7661000
"For example, if you want to pass several items to the constructor, but only "
7671001
"want one of them to be the value::"
768-
msgstr ""
1002+
msgstr "例如,如果你想傳遞幾個項目給構造函式,但只想其中一個是值: ::"
7691003

7701004
#: ../../howto/enum.rst:943
1005+
#, fuzzy
7711006
msgid ""
7721007
"*Do not* call ``super().__new__()``, as the lookup-only ``__new__`` is the "
7731008
"one that is found; instead, use the data type directly."
7741009
msgstr ""
1010+
"*不要*呼叫 ``super().__new__()``,因為只查找 ``__new__`` 是找到的;相反,直接"
1011+
"使用資料型態。"
7751012

7761013
#: ../../howto/enum.rst:948
1014+
#, fuzzy
7771015
msgid "Finer Points"
778-
msgstr ""
1016+
msgstr "微妙之處"
7791017

7801018
#: ../../howto/enum.rst:951
7811019
msgid "Supported ``__dunder__`` names"
782-
msgstr ""
1020+
msgstr "有支援的 ``__dunder_ _`` 命名"
7831021

7841022
#: ../../howto/enum.rst:953
1023+
#, fuzzy
7851024
msgid ""
7861025
":attr:`__members__` is a read-only ordered mapping of ``member_name``:"
7871026
"``member`` items. It is only available on the class."
7881027
msgstr ""
1028+
":attr:`__members__` 是一個唯讀的有序映射,包含了 ``member_name``:``member`` "
1029+
"項目,在類別中才能使用。"
7891030

7901031
#: ../../howto/enum.rst:956
1032+
#, fuzzy
7911033
msgid ""
7921034
":meth:`__new__`, if specified, must create and return the enum members; it "
7931035
"is also a very good idea to set the member's :attr:`_value_` appropriately. "
7941036
"Once all the members are created it is no longer used."
7951037
msgstr ""
1038+
"如果指定了 `:meth:`__new__`` 則必須建立並回傳列舉成員;同時,為其 :attr:"
1039+
"`_value_` 正確設值是一個非常好的選擇。當所有成員都建立完成後,此方法將不再使"
1040+
"用。"
7961041

7971042
#: ../../howto/enum.rst:962
7981043
msgid "Supported ``_sunder_`` names"
799-
msgstr ""
1044+
msgstr "有支援的 ``_sunder_`` 命名"
8001045

8011046
#: ../../howto/enum.rst:964
8021047
msgid "``_name_`` -- name of the member"
803-
msgstr ""
1048+
msgstr "``_name_`` -- 成員的名稱"
8041049

8051050
#: ../../howto/enum.rst:965
8061051
msgid ""
8071052
"``_value_`` -- value of the member; can be set / modified in ``__new__``"
808-
msgstr ""
1053+
msgstr "``_value_`` -- 成員的值;可在 ``__new__`` 中設定/修改"
8091054

8101055
#: ../../howto/enum.rst:967
8111056
msgid ""
8121057
"``_missing_`` -- a lookup function used when a value is not found; may be "
8131058
"overridden"
814-
msgstr ""
1059+
msgstr "``_missing_`` -- 當找不到值時使用的查詢函式;可以被覆寫"
8151060

8161061
#: ../../howto/enum.rst:969
1062+
#, fuzzy
8171063
msgid ""
8181064
"``_ignore_`` -- a list of names, either as a :class:`list` or a :class:"
8191065
"`str`, that will not be transformed into members, and will be removed from "
8201066
"the final class"
8211067
msgstr ""
1068+
"``_ignore_`` -- 包含不需要作為類別成員的名稱的列表,必須是 :class:`list` 或 :"
1069+
"class:`str` 類型,這些名稱將不會轉換為類別成員且將從最終所建立的類別中移除"
8221070

8231071
#: ../../howto/enum.rst:972
1072+
#, fuzzy
8241073
msgid ""
8251074
"``_order_`` -- used in Python 2/3 code to ensure member order is consistent "
8261075
"(class attribute, removed during class creation)"
8271076
msgstr ""
1077+
"``_order_`` -- 在 Python 2/3 程式碼中使用以確保成員順序一致(類屬性,在類建立"
1078+
"期間刪除)"
8281079

8291080
#: ../../howto/enum.rst:974
1081+
#, fuzzy
8301082
msgid ""
8311083
"``_generate_next_value_`` -- used by the `Functional API`_ and by :class:"
8321084
"`auto` to get an appropriate value for an enum member; may be overridden"
8331085
msgstr ""
1086+
"``_generate_next_value_`` 是供 `Functional API`_ 和 :class:`auto` 使用的方"
1087+
"法,以便取得適當的列舉成員值;可被覆寫。"
8341088

8351089
#: ../../howto/enum.rst:980
8361090
msgid ""
8371091
"For standard :class:`Enum` classes the next value chosen is the last value "
8381092
"seen incremented by one."
839-
msgstr ""
1093+
msgstr "對於標準的 :class:`Enum` 類別,下一個選擇的值是最後看到的值加一。"
8401094

8411095
#: ../../howto/enum.rst:983
1096+
#, fuzzy
8421097
msgid ""
8431098
"For :class:`Flag` classes the next value chosen will be the next highest "
8441099
"power-of-two, regardless of the last value seen."
8451100
msgstr ""
1101+
"對於 :class:`Flag` 類別,下一個被選擇的值是接下來最高的二次冪,無論上一個值是"
1102+
"否見過。"
8461103

8471104
#: ../../howto/enum.rst:986
8481105
msgid "``_missing_``, ``_order_``, ``_generate_next_value_``"
@@ -853,33 +1110,42 @@ msgid "``_ignore_``"
8531110
msgstr "``_ignore_``"
8541111

8551112
#: ../../howto/enum.rst:989
1113+
#, fuzzy
8561114
msgid ""
8571115
"To help keep Python 2 / Python 3 code in sync an :attr:`_order_` attribute "
8581116
"can be provided. It will be checked against the actual order of the "
8591117
"enumeration and raise an error if the two do not match::"
8601118
msgstr ""
1119+
"為了協助保持 Python 2 / Python 3 的程式碼同步,可以提供一個 :attr:`_order_` "
1120+
"屬性。它將與列舉的實際順序進行檢查,如果不符則會引發錯誤: ::"
8611121

8621122
#: ../../howto/enum.rst:1007
8631123
msgid ""
8641124
"In Python 2 code the :attr:`_order_` attribute is necessary as definition "
8651125
"order is lost before it can be recorded."
8661126
msgstr ""
1127+
"在 Python 2 的程式中,:attr:`_order_` 屬性是必要的,因為定義順序在記錄之前就"
1128+
"已遺失。"
8671129

8681130
#: ../../howto/enum.rst:1012
8691131
msgid "_Private__names"
870-
msgstr ""
1132+
msgstr "_Private__names"
8711133

8721134
#: ../../howto/enum.rst:1014
1135+
#, fuzzy
8731136
msgid ""
8741137
":ref:`Private names <private-name-mangling>` are not converted to enum "
8751138
"members, but remain normal attributes."
8761139
msgstr ""
1140+
"私有名稱(即雙下劃線開頭的屬性或方法)不會轉換成列舉成員,而是保持正常屬性。"
1141+
"請參見 :ref:`Private names <private-name-mangling>`。"
8771142

8781143
#: ../../howto/enum.rst:1021
8791144
msgid "``Enum`` member type"
880-
msgstr ""
1145+
msgstr "``Enum`` 成員型別"
8811146

8821147
#: ../../howto/enum.rst:1023
1148+
#, fuzzy
8831149
msgid ""
8841150
"Enum members are instances of their enum class, and are normally accessed as "
8851151
"``EnumClass.member``. In certain situations, such as writing custom enum "
@@ -888,162 +1154,198 @@ msgid ""
8881154
"names and attributes/methods from mixed-in classes, upper-case names are "
8891155
"strongly recommended."
8901156
msgstr ""
1157+
"列舉成員是其列舉類別的實例,通常會以 ``EnumClass.member`` 來存取。在某些情況"
1158+
"下,例如編寫自訂列舉行為,能夠直接從另一個成員存取一個成員是有用的,並且受到"
1159+
"支援;但是,為了避免混合類別中的成員名稱和屬性/方法之間的名稱衝突,強烈建議使"
1160+
"用大寫名稱。"
8911161

8921162
#: ../../howto/enum.rst:1034
8931163
msgid "Creating members that are mixed with other data types"
894-
msgstr ""
1164+
msgstr "建立和其他資料型別混合的成員"
8951165

8961166
#: ../../howto/enum.rst:1036
1167+
#, fuzzy
8971168
msgid ""
8981169
"When subclassing other data types, such as :class:`int` or :class:`str`, "
8991170
"with an :class:`Enum`, all values after the ``=`` are passed to that data "
9001171
"type's constructor. For example::"
9011172
msgstr ""
1173+
"當需要對其他數據類型(例如 :class:`int` 或 :class:`str`)進行父類別派生並使用"
1174+
"到:class:`Enum`時,屬於 `=` 之後的所有值都會傳遞給該數據類型的建構函式。例"
1175+
"如: ::"
9021176

9031177
#: ../../howto/enum.rst:1048
9041178
msgid "Boolean value of ``Enum`` classes and members"
905-
msgstr ""
1179+
msgstr "``Enum`` 類別和成員的布林值"
9061180

9071181
#: ../../howto/enum.rst:1050
1182+
#, fuzzy
9081183
msgid ""
9091184
"Enum classes that are mixed with non-:class:`Enum` types (such as :class:"
9101185
"`int`, :class:`str`, etc.) are evaluated according to the mixed-in type's "
9111186
"rules; otherwise, all members evaluate as :data:`True`. To make your own "
9121187
"enum's boolean evaluation depend on the member's value add the following to "
9131188
"your class::"
9141189
msgstr ""
1190+
"混合了非 :class:`Enum` 型別(例如:class:`int`、:class:`str`等)的列舉類型,會"
1191+
"依據混入型別所規定的規則進行評估;否則,所有成員均評估為:data: `True`. 要讓你"
1192+
"自己的enum布林求值取決於成員值時,在你的類中添加以下內容: ::"
9151193

9161194
#: ../../howto/enum.rst:1059
9171195
msgid "Plain :class:`Enum` classes always evaluate as :data:`True`."
918-
msgstr ""
1196+
msgstr "通常 :class:`Enum` 類別的值會被計算為 :data:`True`。"
9191197

9201198
#: ../../howto/enum.rst:1063
9211199
msgid "``Enum`` classes with methods"
922-
msgstr ""
1200+
msgstr "具有方法的 ``Enum`` 類別"
9231201

9241202
#: ../../howto/enum.rst:1065
1203+
#, fuzzy
9251204
msgid ""
9261205
"If you give your enum subclass extra methods, like the `Planet`_ class "
9271206
"below, those methods will show up in a :func:`dir` of the member, but not of "
9281207
"the class::"
9291208
msgstr ""
1209+
"如果你給你的列舉子類別新增了一些方法,就像下面這個 `Planet`_ 類別,那這些方法"
1210+
"會出現在成員的 :func:`dir`,但不會出現在列舉本身的 :func:`dir` 裡: ::"
9301211

9311212
#: ../../howto/enum.rst:1076
9321213
msgid "Combining members of ``Flag``"
933-
msgstr ""
1214+
msgstr "合併 ``Flag`` 的成員"
9341215

9351216
#: ../../howto/enum.rst:1078
1217+
#, fuzzy
9361218
msgid ""
9371219
"Iterating over a combination of :class:`Flag` members will only return the "
9381220
"members that are comprised of a single bit::"
939-
msgstr ""
1221+
msgstr "疊代 :class:`Flag` 成員的組合將只會回傳由單一位元所構成的成員: ::"
9401222

9411223
#: ../../howto/enum.rst:1096
1224+
#, fuzzy
9421225
msgid "``Flag`` and ``IntFlag`` minutia"
943-
msgstr ""
1226+
msgstr "``Flag`` 和 ``IntFlag`` 細節部份"
9441227

9451228
#: ../../howto/enum.rst:1098
9461229
msgid "Using the following snippet for our examples::"
947-
msgstr ""
1230+
msgstr "我們將運用下列程式碼片段作為範例: ::"
9481231

9491232
#: ../../howto/enum.rst:1109
9501233
msgid "the following are true:"
951-
msgstr ""
1234+
msgstr "以下敘述為真:"
9521235

9531236
#: ../../howto/enum.rst:1111
1237+
#, fuzzy
9541238
msgid "single-bit flags are canonical"
955-
msgstr ""
1239+
msgstr "單位元旗標是規範的"
9561240

9571241
#: ../../howto/enum.rst:1112
9581242
msgid "multi-bit and zero-bit flags are aliases"
959-
msgstr ""
1243+
msgstr "多位元旗標和零位元旗標是別名"
9601244

9611245
#: ../../howto/enum.rst:1113
1246+
#, fuzzy
9621247
msgid "only canonical flags are returned during iteration::"
963-
msgstr ""
1248+
msgstr "疊代時只回傳正規旗標 (canonical flags): ::"
9641249

9651250
#: ../../howto/enum.rst:1118
1251+
#, fuzzy
9661252
msgid ""
9671253
"negating a flag or flag set returns a new flag/flag set with the "
9681254
"corresponding positive integer value::"
969-
msgstr ""
1255+
msgstr "否定一個旗標或旗標集會回傳對應的正整數值: ::"
9701256

9711257
#: ../../howto/enum.rst:1127
1258+
#, fuzzy
9721259
msgid "names of pseudo-flags are constructed from their members' names::"
973-
msgstr ""
1260+
msgstr "偽旗標的名稱是由其成員名稱建構而成的: ::"
9741261

9751262
#: ../../howto/enum.rst:1132
9761263
msgid "multi-bit flags, aka aliases, can be returned from operations::"
977-
msgstr ""
1264+
msgstr "多位元旗標,也就是別名,可以從操作中回傳: ::"
9781265

9791266
#: ../../howto/enum.rst:1143
1267+
#, fuzzy
9801268
msgid ""
9811269
"membership / containment checking: zero-valued flags are always considered "
9821270
"to be contained::"
983-
msgstr ""
1271+
msgstr "成員 / 包含測試:零值旗標始終被認為是包含的: ::"
9841272

9851273
#: ../../howto/enum.rst:1149
1274+
#, fuzzy
9861275
msgid ""
9871276
"otherwise, only if all bits of one flag are in the other flag will True be "
9881277
"returned::"
989-
msgstr ""
1278+
msgstr "否則,只有當一個旗標的所有位都在另一個旗標中時,才會回傳 True: ::"
9901279

9911280
#: ../../howto/enum.rst:1158
1281+
#, fuzzy
9921282
msgid ""
9931283
"There is a new boundary mechanism that controls how out-of-range / invalid "
9941284
"bits are handled: ``STRICT``, ``CONFORM``, ``EJECT``, and ``KEEP``:"
9951285
msgstr ""
1286+
"有一個新的邊界機制控制超出範圍或無效位元的處理方式: ``STRICT``(嚴格)、"
1287+
"``CONFORM``(遵從)、``EJECT``(彈出)和 ``KEEP``(保留):"
9961288

9971289
#: ../../howto/enum.rst:1161
1290+
#, fuzzy
9981291
msgid "STRICT --> raises an exception when presented with invalid values"
999-
msgstr ""
1292+
msgstr "在遇到無效數值時,STRICT(嚴格模式)會引發一個異常。"
10001293

10011294
#: ../../howto/enum.rst:1162
10021295
msgid "CONFORM --> discards any invalid bits"
1003-
msgstr ""
1296+
msgstr "CONFORM --> 丟棄任何無效的位元"
10041297

10051298
#: ../../howto/enum.rst:1163
1299+
#, fuzzy
10061300
msgid "EJECT --> lose Flag status and become a normal int with the given value"
1007-
msgstr ""
1301+
msgstr "EJECT --> 失去旗標狀態,並成為一個具有給定值的普通整數"
10081302

10091303
#: ../../howto/enum.rst:1164
10101304
msgid "KEEP --> keep the extra bits"
1011-
msgstr ""
1305+
msgstr "KEEP --> 保留額外的位元"
10121306

10131307
#: ../../howto/enum.rst:1166
10141308
msgid "keeps Flag status and extra bits"
1015-
msgstr ""
1309+
msgstr "保留旗標狀態和額外位元"
10161310

10171311
#: ../../howto/enum.rst:1167
10181312
msgid "extra bits do not show up in iteration"
1019-
msgstr ""
1313+
msgstr "額外位元在疊代時不會出現"
10201314

10211315
#: ../../howto/enum.rst:1168
10221316
msgid "extra bits do show up in repr() and str()"
1023-
msgstr ""
1317+
msgstr "在 repr() 和 str() 也會顯示額外的位元"
10241318

10251319
#: ../../howto/enum.rst:1170
1320+
#, fuzzy
10261321
msgid ""
10271322
"The default for Flag is ``STRICT``, the default for ``IntFlag`` is "
10281323
"``EJECT``, and the default for ``_convert_`` is ``KEEP`` (see ``ssl."
10291324
"Options`` for an example of when ``KEEP`` is needed)."
10301325
msgstr ""
1326+
"標記的預設值為「嚴格」(``STRICT``),IntFlag 的預設值為「拋出異常」"
1327+
"(``EJECT``),而 _convert_ 的預設值則是「保持現況」(``KEEP``) (請參考 ``ssl."
1328+
"Options`` 中需要使用 ``KEEP`` 的範例)。"
10311329

10321330
#: ../../howto/enum.rst:1178
10331331
msgid "How are Enums and Flags different?"
1034-
msgstr ""
1332+
msgstr "列舉和旗標有何不同?"
10351333

10361334
#: ../../howto/enum.rst:1180
1335+
#, fuzzy
10371336
msgid ""
10381337
"Enums have a custom metaclass that affects many aspects of both derived :"
10391338
"class:`Enum` classes and their instances (members)."
10401339
msgstr ""
1340+
"限定列舉 (Enums) 有一個獨特的元類,會影響到所有衍生 :class:`Enum` 類別及其實"
1341+
"例(成員)的許多屬性。"
10411342

10421343
#: ../../howto/enum.rst:1185
10431344
msgid "Enum Classes"
1044-
msgstr ""
1345+
msgstr "列舉類別"
10451346

10461347
#: ../../howto/enum.rst:1187
1348+
#, fuzzy
10471349
msgid ""
10481350
"The :class:`EnumType` metaclass is responsible for providing the :meth:"
10491351
"`__contains__`, :meth:`__dir__`, :meth:`__iter__` and other methods that "
@@ -1053,222 +1355,271 @@ msgid ""
10531355
"final :class:`Enum` class are correct (such as :meth:`__new__`, :meth:"
10541356
"`__getnewargs__`, :meth:`__str__` and :meth:`__repr__`)."
10551357
msgstr ""
1358+
":class:`EnumType`(列舉型別) 元類別(meta-class) 負責提供 `__contains__`、 "
1359+
"`__dir__`、 `__iter__` 以及其他方法,允許開發人員使用像是 ``list(Color)`` 或"
1360+
"是 ``some_enum_var in Color`` 的方式對一個 :class:`Enum`(列舉類別)進行操作,"
1361+
"而通常類別則無法進行。:class:`EnumType`維護被命名的常數(names constants),例"
1362+
"如 :meth:`__new__.`, :meth:`__getnewargs__.`, :meth:`__str__.`, 和:meth: "
1363+
"'__repr__',並確保最終的:class'Enum'(列舉class)符合指定格式。"
10561364

10571365
#: ../../howto/enum.rst:1196
10581366
msgid "Flag Classes"
1059-
msgstr ""
1367+
msgstr "旗標類別"
10601368

10611369
#: ../../howto/enum.rst:1198
1370+
#, fuzzy
10621371
msgid ""
10631372
"Flags have an expanded view of aliasing: to be canonical, the value of a "
10641373
"flag needs to be a power-of-two value, and not a duplicate name. So, in "
10651374
"addition to the :class:`Enum` definition of alias, a flag with no value (a.k."
10661375
"a. ``0``) or with more than one power-of-two value (e.g. ``3``) is "
10671376
"considered an alias."
10681377
msgstr ""
1378+
"旗標有一個更廣泛的別名觀點:為了符合規範,旗標的值需要是二次冪的值,而不是重"
1379+
"複的名稱。因此除了使用 :class:`Enum` 別名定義之外,沒有值(a.k.a. `0`)或多於"
1380+
"一個二次冪數(例如 `3`)的旗幟也被視為別名。"
10691381

10701382
#: ../../howto/enum.rst:1204
10711383
msgid "Enum Members (aka instances)"
1072-
msgstr ""
1384+
msgstr "列舉成員(又稱為實例)"
10731385

10741386
#: ../../howto/enum.rst:1206
1387+
#, fuzzy
10751388
msgid ""
10761389
"The most interesting thing about enum members is that they are singletons. :"
10771390
"class:`EnumType` creates them all while it is creating the enum class "
10781391
"itself, and then puts a custom :meth:`__new__` in place to ensure that no "
10791392
"new ones are ever instantiated by returning only the existing member "
10801393
"instances."
10811394
msgstr ""
1395+
"enum 成員最有趣的地方在於它們是單例 (singletons)。當 :class:`EnumType` 建立列"
1396+
"舉類別本身時,就會一併建立這些成員,並提供自訂的 :meth:`__new__` 方法來確保只"
1397+
"回傳現有的成員實例,而不會再被實體化出新的。"
10821398

10831399
#: ../../howto/enum.rst:1212
10841400
msgid "Flag Members"
1085-
msgstr ""
1401+
msgstr "旗標成員"
10861402

10871403
#: ../../howto/enum.rst:1214
1404+
#, fuzzy
10881405
msgid ""
10891406
"Flag members can be iterated over just like the :class:`Flag` class, and "
10901407
"only the canonical members will be returned. For example::"
10911408
msgstr ""
1409+
"旗標成員可像 :class:`Flag` 類別一樣被疊代,只有典型成員會被回傳。舉例而"
1410+
"言: ::"
10921411

10931412
#: ../../howto/enum.rst:1220
10941413
msgid "(Note that ``BLACK``, ``PURPLE``, and ``WHITE`` do not show up.)"
1095-
msgstr ""
1414+
msgstr "(請注意,``BLACK``、``PURPLE`` 和 ``WHITE`` 不會出現)"
10961415

10971416
#: ../../howto/enum.rst:1222
10981417
msgid ""
10991418
"Inverting a flag member returns the corresponding positive value, rather "
11001419
"than a negative value --- for example::"
1101-
msgstr ""
1420+
msgstr "反轉旗標成員會回傳相應的正值,而不是負值 --- 例如: ::"
11021421

11031422
#: ../../howto/enum.rst:1228
1423+
#, fuzzy
11041424
msgid ""
11051425
"Flag members have a length corresponding to the number of power-of-two "
11061426
"values they contain. For example::"
1107-
msgstr ""
1427+
msgstr "旗標成員的長度與他們包含的二次冥值相對應。例如: ::"
11081428

11091429
#: ../../howto/enum.rst:1238
11101430
msgid "Enum Cookbook"
1111-
msgstr ""
1431+
msgstr "列舉參考手冊"
11121432

11131433
#: ../../howto/enum.rst:1241
1434+
#, fuzzy
11141435
msgid ""
11151436
"While :class:`Enum`, :class:`IntEnum`, :class:`StrEnum`, :class:`Flag`, and :"
11161437
"class:`IntFlag` are expected to cover the majority of use-cases, they cannot "
11171438
"cover them all. Here are recipes for some different types of enumerations "
11181439
"that can be used directly, or as examples for creating one's own."
1119-
msgstr ""
1440+
msgstr "雖然我們期望 :class:`Enum`、:cl"
11201441

11211442
#: ../../howto/enum.rst:1248
11221443
msgid "Omitting values"
1123-
msgstr ""
1444+
msgstr "省略值"
11241445

11251446
#: ../../howto/enum.rst:1250
11261447
msgid ""
11271448
"In many use-cases, one doesn't care what the actual value of an enumeration "
11281449
"is. There are several ways to define this type of simple enumeration:"
1129-
msgstr ""
1450+
msgstr "很多時候,我們不在意列舉的實際值。定義這種簡單的列舉有幾種方式:"
11301451

11311452
#: ../../howto/enum.rst:1253
11321453
msgid "use instances of :class:`auto` for the value"
1133-
msgstr ""
1454+
msgstr "使用 :class:`auto` 的實例當作值"
11341455

11351456
#: ../../howto/enum.rst:1254
11361457
msgid "use instances of :class:`object` as the value"
1137-
msgstr ""
1458+
msgstr "使用 :class:`object` 的實例作為值。"
11381459

11391460
#: ../../howto/enum.rst:1255
11401461
msgid "use a descriptive string as the value"
1141-
msgstr ""
1462+
msgstr "使用描述性的字串作為值"
11421463

11431464
#: ../../howto/enum.rst:1256
1465+
#, fuzzy
11441466
msgid ""
11451467
"use a tuple as the value and a custom :meth:`__new__` to replace the tuple "
11461468
"with an :class:`int` value"
11471469
msgstr ""
1470+
"使用元組作為值,再加上自定義的 :meth:`__new__` 函式來將該元組替換成 :class:"
1471+
"`int` 型別的值"
11481472

11491473
#: ../../howto/enum.rst:1259
1474+
#, fuzzy
11501475
msgid ""
11511476
"Using any of these methods signifies to the user that these values are not "
11521477
"important, and also enables one to add, remove, or reorder members without "
11531478
"having to renumber the remaining members."
11541479
msgstr ""
1480+
"使用這些方法之一,向使用者傳達數值不重要的意涵,也能讓你加入、移除或重新排序"
1481+
"成員而不必重新編號其他成員。"
11551482

11561483
#: ../../howto/enum.rst:1265
11571484
msgid "Using :class:`auto`"
1158-
msgstr ""
1485+
msgstr "使用 :class:`auto`"
11591486

11601487
#: ../../howto/enum.rst:1267
11611488
msgid "Using :class:`auto` would look like::"
1162-
msgstr ""
1489+
msgstr "使用 :class:`auto` 看起來會像這樣: ::"
11631490

11641491
#: ../../howto/enum.rst:1279
11651492
msgid "Using :class:`object`"
1166-
msgstr ""
1493+
msgstr "使用 :class:`object`"
11671494

11681495
#: ../../howto/enum.rst:1281
11691496
msgid "Using :class:`object` would look like::"
1170-
msgstr ""
1497+
msgstr "使用 :class:`object` 看起來會像這樣: ::"
11711498

11721499
#: ../../howto/enum.rst:1291
11731500
msgid ""
11741501
"This is also a good example of why you might want to write your own :meth:"
11751502
"`__repr__`::"
1176-
msgstr ""
1503+
msgstr "這也是為何你有可能會想要撰寫你自己的 :meth:`__repr__` 的好範例: ::"
11771504

11781505
#: ../../howto/enum.rst:1307
11791506
msgid "Using a descriptive string"
1180-
msgstr ""
1507+
msgstr "使用一個描述性字串"
11811508

11821509
#: ../../howto/enum.rst:1309
11831510
msgid "Using a string as the value would look like::"
1184-
msgstr ""
1511+
msgstr "將字串作為值會看起來像這樣: ::"
11851512

11861513
#: ../../howto/enum.rst:1321
11871514
msgid "Using a custom :meth:`__new__`"
1188-
msgstr ""
1515+
msgstr "使用自訂的 :meth:`__new__`"
11891516

11901517
#: ../../howto/enum.rst:1323
11911518
msgid "Using an auto-numbering :meth:`__new__` would look like::"
1192-
msgstr ""
1519+
msgstr "使用自動編號的 :meth:`__new__` 看起來會像這樣: ::"
11931520

11941521
#: ../../howto/enum.rst:1340
1522+
#, fuzzy
11951523
msgid ""
11961524
"To make a more general purpose ``AutoNumber``, add ``*args`` to the "
11971525
"signature::"
11981526
msgstr ""
1527+
"為了讓``AutoNumber``成為更多用途的程式,請在函式签名中新增 ``*args``: ::"
11991528

12001529
#: ../../howto/enum.rst:1350
12011530
msgid ""
12021531
"Then when you inherit from ``AutoNumber`` you can write your own "
12031532
"``__init__`` to handle any extra arguments::"
12041533
msgstr ""
1534+
"當你從 ``AutoNumber`` 繼承時,可以撰寫自己的 ``__init__`` 來處理任何額外引"
1535+
"數: ::"
12051536

12061537
#: ../../howto/enum.rst:1369
1538+
#, fuzzy
12071539
msgid ""
12081540
"The :meth:`__new__` method, if defined, is used during creation of the Enum "
12091541
"members; it is then replaced by Enum's :meth:`__new__` which is used after "
12101542
"class creation for lookup of existing members."
12111543
msgstr ""
1544+
":meth:`__new__` 方法(如有定義)將在建立列舉成員期間使用;然後它被列舉的 :"
1545+
"meth:`__new__` 替換,該 :meth:`__new__` 在類別建立後用於尋找現有成員。"
12121546

12131547
#: ../../howto/enum.rst:1375
1548+
#, fuzzy
12141549
msgid ""
12151550
"*Do not* call ``super().__new__()``, as the lookup-only ``__new__`` is the "
12161551
"one that is found; instead, use the data type directly -- e.g.::"
12171552
msgstr ""
1553+
"*不要*\\ 呼叫 ``super().__new__()``,因為只查找 ``__new__`` 是找到的;相反,"
1554+
"直接使用資料型別—例如::"
12181555

12191556
#: ../../howto/enum.rst:1382
12201557
msgid "OrderedEnum"
1221-
msgstr ""
1558+
msgstr "OrderedEnum"
12221559

12231560
#: ../../howto/enum.rst:1384
1561+
#, fuzzy
12241562
msgid ""
12251563
"An ordered enumeration that is not based on :class:`IntEnum` and so "
12261564
"maintains the normal :class:`Enum` invariants (such as not being comparable "
12271565
"to other enumerations)::"
12281566
msgstr ""
1567+
"一個有序的列舉,它不依據 :class:`IntEnum` 類別而是遵循正常的 :class:`Enum` 不"
1568+
"變量 (例如不能與其他列舉進行比較): ::"
12291569

12301570
#: ../../howto/enum.rst:1418
12311571
msgid "DuplicateFreeEnum"
1232-
msgstr ""
1572+
msgstr "DuplicateFreeEnum"
12331573

12341574
#: ../../howto/enum.rst:1420
1575+
#, fuzzy
12351576
msgid ""
12361577
"Raises an error if a duplicate member value is found instead of creating an "
12371578
"alias::"
1238-
msgstr ""
1579+
msgstr "如果出現重複的成員值而不是建立別名,則會引發錯誤: ::"
12391580

12401581
#: ../../howto/enum.rst:1445
1582+
#, fuzzy
12411583
msgid ""
12421584
"This is a useful example for subclassing Enum to add or change other "
12431585
"behaviors as well as disallowing aliases. If the only desired change is "
12441586
"disallowing aliases, the :func:`unique` decorator can be used instead."
12451587
msgstr ""
1588+
"這是一個有用的範例,可以透過繼承 Enum 來添加或修改其他行為以及禁止別名。如果"
1589+
"唯一需要的更改是禁止使用別名,那麼可以使用 :func:`unique` 裝飾器。"
12461590

12471591
#: ../../howto/enum.rst:1451
12481592
msgid "Planet"
1249-
msgstr ""
1593+
msgstr "Planet"
12501594

12511595
#: ../../howto/enum.rst:1453
1596+
#, fuzzy
12521597
msgid ""
12531598
"If :meth:`__new__` or :meth:`__init__` is defined, the value of the enum "
12541599
"member will be passed to those methods::"
12551600
msgstr ""
1601+
"如果定義了 :meth:`__new__` 或是 :meth:`__init__`,將會把該列舉成員的值傳遞給"
1602+
"這些方法: ::"
12561603

12571604
#: ../../howto/enum.rst:1482
12581605
msgid "TimePeriod"
1259-
msgstr ""
1606+
msgstr "TimePeriod"
12601607

12611608
#: ../../howto/enum.rst:1484
12621609
msgid "An example to show the :attr:`_ignore_` attribute in use::"
1263-
msgstr ""
1610+
msgstr "一個展示使用 :attr:`_ignore_` 屬性的範例: ::"
12641611

12651612
#: ../../howto/enum.rst:1503
12661613
msgid "Subclassing EnumType"
1267-
msgstr ""
1614+
msgstr "子類別化 EnumType"
12681615

12691616
#: ../../howto/enum.rst:1505
1617+
#, fuzzy
12701618
msgid ""
12711619
"While most enum needs can be met by customizing :class:`Enum` subclasses, "
12721620
"either with class decorators or custom functions, :class:`EnumType` can be "
12731621
"subclassed to provide a different Enum experience."
12741622
msgstr ""
1623+
"雖然大部分的列舉需求可以透過客製化 :class:`Enum` subclasses,藉由使用類別裝飾"
1624+
"器或是自定義的函式來應付,在創造另一種不同的列舉體驗時,可以建立 :class:"
1625+
"`EnumType` 子類別。"

0 commit comments

Comments
 (0)
Please sign in to comment.