Skip to content

Commit

Permalink
Update tutorial/errors.po (#335)
Browse files Browse the repository at this point in the history
* Update tutorial/errors.po

Update with cpython 3.11

* Apply suggestions from code review

Apply "接受" and "直接造成的結果" from the code review.

Co-authored-by: Wei-Hsiang (Matt) Wang <[email protected]>

Co-authored-by: Wei-Hsiang (Matt) Wang <[email protected]>
  • Loading branch information
StevenHsuYL and mattwang44 authored Oct 24, 2022
1 parent 19f27b6 commit 96d9bd5
Showing 1 changed file with 59 additions and 7 deletions.
66 changes: 59 additions & 7 deletions tutorial/errors.po
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@
#
# Translators:
# jerrychen <[email protected]>, 2016
# Steven Hsu <[email protected]>, 2021
# Steven Hsu <[email protected]>, 2021-2022
# Matt Wang <[email protected]>, 2021
msgid ""
msgstr ""
"Project-Id-Version: Python 3.11\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-10-15 20:43+0000\n"
"PO-Revision-Date: 2022-10-16 05:53+0800\n"
"Last-Translator: Matt Wang <mattwang44@gmail.com>\n"
"PO-Revision-Date: 2022-10-24 14:54+0800\n"
"Last-Translator: Steven Hsu <hsuhaochun@gmail.com>\n"
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
"tw)\n"
"Language: zh_TW\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Poedit 3.1.1\n"
"X-Generator: Poedit 3.2\n"

#: ../../tutorial/errors.rst:5
msgid "Errors and Exceptions"
Expand Down Expand Up @@ -265,6 +265,11 @@ msgid ""
"exit` and :exc:`KeyboardInterrupt` which is raised when a user wishes to "
"interrupt the program."
msgstr ""
":exc:`BaseException` 是由全部的例外所共用的 base class。它的 subclass(子類"
"別)之一,:exc:`Exception`,則是所有非嚴重例外 (non-fatal exception) 的 base "
"class。有些例外不是 :exc:`Exception` 的 subclass,而它們通常不會被處理,因為"
"它們是用來指示程式應該終止。這些例外包括了由 :meth:`sys.exit` 所引發的 :exc:"
"`SystemExit`,以及當使用者想要中斷程式時所引發的 :exc:`KeyboardInterrupt`。"

#: ../../tutorial/errors.rst:188
msgid ""
Expand All @@ -273,13 +278,20 @@ msgid ""
"exceptions that we intend to handle, and to allow any unexpected exceptions "
"to propagate on."
msgstr ""
":exc:`Exception` 可以用作通配符 (wildcard) 來捕獲(幾乎)所有的例外。然而,比"
"較好的做法是盡可能具體地說明我們打算處理的例外類型,並容許任何非預期例外的傳"
"遞 (propagate)。"

#: ../../tutorial/errors.rst:193
msgid ""
"The most common pattern for handling :exc:`Exception` is to print or log the "
"exception and then re-raise it (allowing a caller to handle the exception as "
"well)::"
msgstr ""
"處理 :exc:`Exception` 的最常見模式,是先將該例外印出或記錄,然後再重新引發它"
"(也允許一個呼叫函式 (caller) 來處理該例外):\n"
"\n"
"::"

#: ../../tutorial/errors.rst:211
msgid ""
Expand Down Expand Up @@ -338,7 +350,7 @@ msgid ""
"instantiated by calling its constructor with no arguments::"
msgstr ""
":keyword:`raise` 唯一的引數就是要引發的例外。該引數必須是一個例外實例或例外 "
"class(衍生自 :class:`BaseException` 的 class,例如 :class:`Exception` 與他"
"class(衍生自 :class:`BaseException` 的 class,例如 :class:`Exception` 與它"
"的 subclass)。如果一個例外 class 被傳遞,它會不含引數地呼叫它的建構函式 "
"(constructor) ,使它被自動建立實例 (implicitly instantiated):\n"
"\n"
Expand All @@ -365,12 +377,20 @@ msgid ""
"will have the exception being handled attached to it and included in the "
"error message::"
msgstr ""
"如果在 :keyword:`except` 段落內部發生了一個未處理的例外,則它會讓這個將要被處"
"理的例外附加在後,並將其包含在錯誤訊息中:\n"
"\n"
"::"

#: ../../tutorial/errors.rst:306
msgid ""
"To indicate that an exception is a direct consequence of another, the :"
"keyword:`raise` statement allows an optional :keyword:`from<raise>` clause::"
msgstr ""
"為了表明一個例外是另一個例外直接造成的結果,:keyword:`raise` 陳述式容許一個選擇性"
"的 :keyword:`from<raise>` 子句:\n"
"\n"
"::"

#: ../../tutorial/errors.rst:312
msgid "This can be useful when you are transforming exceptions. For example::"
Expand All @@ -384,6 +404,9 @@ msgid ""
"It also allows disabling automatic exception chaining using the ``from "
"None`` idiom::"
msgstr ""
"它也容許使用慣用語 ``from None`` 來停用自動例外鏈接:\n"
"\n"
"::"

#: ../../tutorial/errors.rst:345
msgid ""
Expand Down Expand Up @@ -583,7 +606,7 @@ msgstr ""

#: ../../tutorial/errors.rst:496
msgid "Raising and Handling Multiple Unrelated Exceptions"
msgstr ""
msgstr "引發及處理多個無關的例外"

#: ../../tutorial/errors.rst:498
msgid ""
Expand All @@ -593,13 +616,21 @@ msgid ""
"cases where it is desirable to continue execution and collect multiple "
"errors rather than raise the first exception."
msgstr ""
"在某些情況下,必須回報已經發生的多個例外。在並行框架 (concurrency framework) "
"中經常會出現這種情況,當平行的 (parallel) 某些任務可能已經失效,但還有其他用"
"例 (use case) 希望能繼續執行並收集多個例外,而不是只有引發第一個例外時。"

#: ../../tutorial/errors.rst:504
msgid ""
"The builtin :exc:`ExceptionGroup` wraps a list of exception instances so "
"that they can be raised together. It is an exception itself, so it can be "
"caught like any other exception. ::"
msgstr ""
"內建的 :exc:`ExceptionGroup` 會包裝一個例外實例 (exception instance) 的 "
"list(串列),使得它們可以一起被引發。由於它本身就是一個例外,因此它也可以像"
"任何其他例外一樣被捕獲。\n"
"\n"
"::"

#: ../../tutorial/errors.rst:530
msgid ""
Expand All @@ -609,6 +640,12 @@ msgid ""
"extracts from the group exceptions of a certain type while letting all other "
"exceptions propagate to other clauses and eventually to be reraised. ::"
msgstr ""
"若使用 ``except*`` 代替 ``except``,我們可以選擇性地只處理該群組中與特定類型"
"匹配的例外。在以下範例中,展示了一個巢狀的例外群組 (exception group),每個 "
"``except*`` 子句分別從該群組中提取一個特定類型的例外,同時讓所有其他的例外都"
"傳遞到其他子句,最後再被重新引發。\n"
"\n"
"::"

#: ../../tutorial/errors.rst:564
msgid ""
Expand All @@ -617,10 +654,14 @@ msgid ""
"that have already been raised and caught by the program, along the following "
"pattern::"
msgstr ""
"請注意,被巢套在例外群組中的例外必須是實例,而不是類型。這是因為在實務上,這"
"些例外通常是已經被程式引發並捕獲的例外,類似以下的模式:\n"
"\n"
"::"

#: ../../tutorial/errors.rst:582
msgid "Enriching Exceptions with Notes"
msgstr ""
msgstr "用註解使例外更詳細"

#: ../../tutorial/errors.rst:584
msgid ""
Expand All @@ -632,13 +673,24 @@ msgid ""
"standard traceback rendering includes all notes, in the order they were "
"added, after the exception. ::"
msgstr ""
"當一個例外是為了被引發而建立時,它通常會伴隨著一些資訊被初始化,這些資訊描述"
"了當下發生的錯誤。在某些情況,在例外被捕獲之後添加資訊會很有用。為此,例外具"
"有一個 ``add_note(note)`` method(方法),它可以接受一個字串並將其添加到例外"
"的註解清單中。標準的回溯呈現會在例外之後列出所有的註解,並按照其被添加的順序"
"來排列。\n"
"\n"
"::"

#: ../../tutorial/errors.rst:605
msgid ""
"For example, when collecting exceptions into an exception group, we may want "
"to add context information for the individual errors. In the following each "
"exception in the group has a note indicating when this error has occurred. ::"
msgstr ""
"例如,在將例外收集到例外群組中時,我們可能希望為各個錯誤添加一些上下文的資"
"訊。在以下範例中,群組中的每個例外都有一條註解,指示此錯誤是在何時發生。\n"
"\n"
"::"

#~ msgid ""
#~ "All exceptions inherit from :exc:`BaseException`, and so it can be used "
Expand Down

0 comments on commit 96d9bd5

Please sign in to comment.