4
4
#
5
5
# Translators:
6
6
# jerrychen <[email protected] >, 2016
7
- # Steven Hsu <[email protected] >, 2021
7
+ # Steven Hsu <[email protected] >, 2021-2022
8
8
# Matt Wang <[email protected] >, 2021
9
9
msgid ""
10
10
msgstr ""
11
11
"Project-Id-Version : Python 3.11\n "
12
12
"Report-Msgid-Bugs-To : \n "
13
13
"POT-Creation-Date : 2022-10-15 20:43+0000\n "
14
- "PO-Revision-Date : 2022-10-16 05:53 +0800\n "
15
- "Last-Translator : Matt Wang <mattwang44 @gmail.com>\n "
14
+ "PO-Revision-Date : 2022-10-24 14:54 +0800\n "
15
+ "Last-Translator : Steven Hsu <hsuhaochun @gmail.com>\n "
16
16
"Language-Team : Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
17
17
"tw)\n "
18
18
"Language : zh_TW\n "
19
19
"MIME-Version : 1.0\n "
20
20
"Content-Type : text/plain; charset=UTF-8\n "
21
21
"Content-Transfer-Encoding : 8bit\n "
22
22
"Plural-Forms : nplurals=1; plural=0;\n "
23
- "X-Generator : Poedit 3.1.1 \n "
23
+ "X-Generator : Poedit 3.2 \n "
24
24
25
25
#: ../../tutorial/errors.rst:5
26
26
msgid "Errors and Exceptions"
@@ -265,6 +265,11 @@ msgid ""
265
265
"exit` and :exc:`KeyboardInterrupt` which is raised when a user wishes to "
266
266
"interrupt the program."
267
267
msgstr ""
268
+ ":exc:`BaseException` 是由全部的例外所共用的 base class。它的 subclass(子類"
269
+ "別)之一,:exc:`Exception`,則是所有非嚴重例外 (non-fatal exception) 的 base "
270
+ "class。有些例外不是 :exc:`Exception` 的 subclass,而它們通常不會被處理,因為"
271
+ "它們是用來指示程式應該終止。這些例外包括了由 :meth:`sys.exit` 所引發的 :exc:"
272
+ "`SystemExit`,以及當使用者想要中斷程式時所引發的 :exc:`KeyboardInterrupt`。"
268
273
269
274
#: ../../tutorial/errors.rst:188
270
275
msgid ""
@@ -273,13 +278,20 @@ msgid ""
273
278
"exceptions that we intend to handle, and to allow any unexpected exceptions "
274
279
"to propagate on."
275
280
msgstr ""
281
+ ":exc:`Exception` 可以用作通配符 (wildcard) 來捕獲(幾乎)所有的例外。然而,比"
282
+ "較好的做法是盡可能具體地說明我們打算處理的例外類型,並容許任何非預期例外的傳"
283
+ "遞 (propagate)。"
276
284
277
285
#: ../../tutorial/errors.rst:193
278
286
msgid ""
279
287
"The most common pattern for handling :exc:`Exception` is to print or log the "
280
288
"exception and then re-raise it (allowing a caller to handle the exception as "
281
289
"well)::"
282
290
msgstr ""
291
+ "處理 :exc:`Exception` 的最常見模式,是先將該例外印出或記錄,然後再重新引發它"
292
+ "(也允許一個呼叫函式 (caller) 來處理該例外):\n"
293
+ "\n"
294
+ "::"
283
295
284
296
#: ../../tutorial/errors.rst:211
285
297
msgid ""
@@ -338,7 +350,7 @@ msgid ""
338
350
"instantiated by calling its constructor with no arguments::"
339
351
msgstr ""
340
352
":keyword:`raise` 唯一的引數就是要引發的例外。該引數必須是一個例外實例或例外 "
341
- "class(衍生自 :class:`BaseException` 的 class,例如 :class:`Exception` 與他 "
353
+ "class(衍生自 :class:`BaseException` 的 class,例如 :class:`Exception` 與它 "
342
354
"的 subclass)。如果一個例外 class 被傳遞,它會不含引數地呼叫它的建構函式 "
343
355
"(constructor) ,使它被自動建立實例 (implicitly instantiated):\n"
344
356
"\n"
@@ -365,12 +377,20 @@ msgid ""
365
377
"will have the exception being handled attached to it and included in the "
366
378
"error message::"
367
379
msgstr ""
380
+ "如果在 :keyword:`except` 段落內部發生了一個未處理的例外,則它會讓這個將要被處"
381
+ "理的例外附加在後,並將其包含在錯誤訊息中:\n"
382
+ "\n"
383
+ "::"
368
384
369
385
#: ../../tutorial/errors.rst:306
370
386
msgid ""
371
387
"To indicate that an exception is a direct consequence of another, the :"
372
388
"keyword:`raise` statement allows an optional :keyword:`from<raise>` clause::"
373
389
msgstr ""
390
+ "為了表明一個例外是另一個例外的直接結果,:keyword:`raise` 陳述式容許一個選擇性"
391
+ "的 :keyword:`from<raise>` 子句:\n"
392
+ "\n"
393
+ "::"
374
394
375
395
#: ../../tutorial/errors.rst:312
376
396
msgid "This can be useful when you are transforming exceptions. For example::"
@@ -384,6 +404,9 @@ msgid ""
384
404
"It also allows disabling automatic exception chaining using the ``from "
385
405
"None`` idiom::"
386
406
msgstr ""
407
+ "它也容許使用慣用語 ``from None`` 來停用自動例外鏈接:\n"
408
+ "\n"
409
+ "::"
387
410
388
411
#: ../../tutorial/errors.rst:345
389
412
msgid ""
@@ -583,7 +606,7 @@ msgstr ""
583
606
584
607
#: ../../tutorial/errors.rst:496
585
608
msgid "Raising and Handling Multiple Unrelated Exceptions"
586
- msgstr ""
609
+ msgstr "引發及處理多個無關的例外 "
587
610
588
611
#: ../../tutorial/errors.rst:498
589
612
msgid ""
@@ -593,13 +616,21 @@ msgid ""
593
616
"cases where it is desirable to continue execution and collect multiple "
594
617
"errors rather than raise the first exception."
595
618
msgstr ""
619
+ "在某些情況下,必須回報已經發生的多個例外。在並行框架 (concurrency framework) "
620
+ "中經常會出現這種情況,當平行的 (parallel) 某些任務可能已經失效,但還有其他用"
621
+ "例 (use case) 希望能繼續執行並收集多個例外,而不是只有引發第一個例外時。"
596
622
597
623
#: ../../tutorial/errors.rst:504
598
624
msgid ""
599
625
"The builtin :exc:`ExceptionGroup` wraps a list of exception instances so "
600
626
"that they can be raised together. It is an exception itself, so it can be "
601
627
"caught like any other exception. ::"
602
628
msgstr ""
629
+ "內建的 :exc:`ExceptionGroup` 會包裝一個例外實例 (exception instance) 的 "
630
+ "list(串列),使得它們可以一起被引發。由於它本身就是一個例外,因此它也可以像"
631
+ "任何其他例外一樣被捕獲。\n"
632
+ "\n"
633
+ "::"
603
634
604
635
#: ../../tutorial/errors.rst:530
605
636
msgid ""
@@ -609,6 +640,12 @@ msgid ""
609
640
"extracts from the group exceptions of a certain type while letting all other "
610
641
"exceptions propagate to other clauses and eventually to be reraised. ::"
611
642
msgstr ""
643
+ "若使用 ``except*`` 代替 ``except``,我們可以選擇性地只處理該群組中與特定類型"
644
+ "匹配的例外。在以下範例中,展示了一個巢狀的例外群組 (exception group),每個 "
645
+ "``except*`` 子句分別從該群組中提取一個特定類型的例外,同時讓所有其他的例外都"
646
+ "傳遞到其他子句,最後再被重新引發。\n"
647
+ "\n"
648
+ "::"
612
649
613
650
#: ../../tutorial/errors.rst:564
614
651
msgid ""
@@ -617,10 +654,14 @@ msgid ""
617
654
"that have already been raised and caught by the program, along the following "
618
655
"pattern::"
619
656
msgstr ""
657
+ "請注意,被巢套在例外群組中的例外必須是實例,而不是類型。這是因為在實務上,這"
658
+ "些例外通常是已經被程式引發並捕獲的例外,類似以下的模式:\n"
659
+ "\n"
660
+ "::"
620
661
621
662
#: ../../tutorial/errors.rst:582
622
663
msgid "Enriching Exceptions with Notes"
623
- msgstr ""
664
+ msgstr "用註解使例外更詳細 "
624
665
625
666
#: ../../tutorial/errors.rst:584
626
667
msgid ""
@@ -632,13 +673,24 @@ msgid ""
632
673
"standard traceback rendering includes all notes, in the order they were "
633
674
"added, after the exception. ::"
634
675
msgstr ""
676
+ "當一個例外是為了被引發而建立時,它通常會伴隨著一些資訊被初始化,這些資訊描述"
677
+ "了當下發生的錯誤。在某些情況,在例外被捕獲之後添加資訊會很有用。為此,例外具"
678
+ "有一個 ``add_note(note)`` method(方法),它可以接收一個字串並將其添加到例外"
679
+ "的註解清單中。標準的回溯呈現會在例外之後列出所有的註解,並按照其被添加的順序"
680
+ "來排列。\n"
681
+ "\n"
682
+ "::"
635
683
636
684
#: ../../tutorial/errors.rst:605
637
685
msgid ""
638
686
"For example, when collecting exceptions into an exception group, we may want "
639
687
"to add context information for the individual errors. In the following each "
640
688
"exception in the group has a note indicating when this error has occurred. ::"
641
689
msgstr ""
690
+ "例如,在將例外收集到例外群組中時,我們可能希望為各個錯誤添加一些上下文的資"
691
+ "訊。在以下範例中,群組中的每個例外都有一條註解,指示此錯誤是在何時發生。\n"
692
+ "\n"
693
+ "::"
642
694
643
695
#~ msgid ""
644
696
#~ "All exceptions inherit from :exc:`BaseException`, and so it can be used "
0 commit comments