From e179a2d6974d33368b3056b52c3ed15f93a0967a Mon Sep 17 00:00:00 2001 From: Matt Wang Date: Fri, 10 May 2024 00:45:45 +0800 Subject: [PATCH 1/2] feat: translate `library/sched.po` --- library/sched.po | 51 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 12 deletions(-) diff --git a/library/sched.po b/library/sched.po index a7fbfe7d4b..c7cf02eb4b 100644 --- a/library/sched.po +++ b/library/sched.po @@ -1,15 +1,15 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: +# Matt Wang , 2024 msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" -"PO-Revision-Date: 2018-05-23 16:09+0000\n" -"Last-Translator: Adrian Liaw \n" +"PO-Revision-Date: 2024-05-09 16:09+0000\n" +"Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" @@ -30,7 +30,7 @@ msgstr "**原始碼:**\\ :source:`Lib/sched.py`" msgid "" "The :mod:`sched` module defines a class which implements a general purpose " "event scheduler:" -msgstr "" +msgstr ":mod:`sched` 模組定義了一個有實作通用事件排程器的類別:" #: ../../library/sched.rst:20 msgid "" @@ -43,15 +43,20 @@ msgid "" "argument ``0`` after each event is run to allow other threads an opportunity " "to run in multi-threaded applications." msgstr "" +":class:`scheduler` 類別定義了事件排程的泛用介面。它需要兩個函式來和「外部世" +"界」作用 —— *timefunc* 應不帶引數地被呼叫,並回傳一個數字(為「時間」,可為任" +"何單位)。*delayfunc* 函式應以一個引數呼叫,並與 *timefunc* 的輸出相容,且應" +"延遲其指定的時間單位。每個事件運行後,也會以引數 ``0`` 呼叫 *delayfunc*,來使" +"得其他執行緒有機會在多執行緒應用程式中運行。" #: ../../library/sched.rst:29 msgid "*timefunc* and *delayfunc* parameters are optional." -msgstr "" +msgstr "*timefunc* 和 *delayfunc* 參數是可選的。" #: ../../library/sched.rst:32 msgid "" ":class:`scheduler` class can be safely used in multi-threaded environments." -msgstr "" +msgstr ":class:`scheduler` 類別可以安全地在多執行緒環境中使用。" #: ../../library/sched.rst:36 msgid "Example::" @@ -59,11 +64,11 @@ msgstr "範例: ::" #: ../../library/sched.rst:67 msgid "Scheduler Objects" -msgstr "" +msgstr "排程器物件" #: ../../library/sched.rst:69 msgid ":class:`scheduler` instances have the following methods and attributes:" -msgstr "" +msgstr ":class:`scheduler` 實例具有以下方法和屬性:" #: ../../library/sched.rst:74 msgid "" @@ -72,6 +77,9 @@ msgid "" "constructor. Events scheduled for the same *time* will be executed in the " "order of their *priority*. A lower number represents a higher priority." msgstr "" +"為一個新事件排程。*time* 引數應該是與傳遞給建構函式的 *timefunc* 函式回傳值相" +"容的數字型別。安排在相同 *time* 的事件將按照其 *priority* 的順序執行。數字越" +"小代表優先順序越高。" #: ../../library/sched.rst:79 msgid "" @@ -79,16 +87,18 @@ msgid "" "*argument* is a sequence holding the positional arguments for *action*. " "*kwargs* is a dictionary holding the keyword arguments for *action*." msgstr "" +"執行事件意味著執行 ``action(*argument, **kwargs)``。*argument* 是一個包含 " +"*action* 之位置引數的序列。*kwargs* 是一個字典,帶有 *action* 的關鍵字引數。" #: ../../library/sched.rst:83 msgid "" "Return value is an event which may be used for later cancellation of the " "event (see :meth:`cancel`)." -msgstr "" +msgstr "回傳值是一個事件,可用於後續取消該事件(請見 :meth:`cancel`)。" #: ../../library/sched.rst:86 ../../library/sched.rst:99 msgid "*argument* parameter is optional." -msgstr "" +msgstr "*argument* 參數是可選的。" #: ../../library/sched.rst:89 ../../library/sched.rst:102 msgid "*kwargs* parameter was added." @@ -100,16 +110,20 @@ msgid "" "the other arguments, the effect and the return value are the same as those " "for :meth:`enterabs`." msgstr "" +"為一個排程事件延期 *delay* 時間單位。除了相對時間之外,其他引數、效果和回傳值" +"皆與 :meth:`enterabs` 的相同。" #: ../../library/sched.rst:107 msgid "" "Remove the event from the queue. If *event* is not an event currently in the " "queue, this method will raise a :exc:`ValueError`." msgstr "" +"從佇列中刪除該事件。如果 *event* 不是目前佇列中的事件,此方法將引發 :exc:" +"`ValueError`。" #: ../../library/sched.rst:113 msgid "Return ``True`` if the event queue is empty." -msgstr "" +msgstr "如果事件佇列為空,則回傳 ``True``。" #: ../../library/sched.rst:118 msgid "" @@ -117,6 +131,8 @@ msgid "" "function passed to the constructor) for the next event, then execute it and " "so on until there are no more scheduled events." msgstr "" +"運行所有已排程的事件。此方法將會等待(使用傳遞給建構函式的 *delayfunc* 函式)" +"下一個事件,然後執行它,並依此類推,直到不再有排程好的事件。" #: ../../library/sched.rst:122 msgid "" @@ -124,6 +140,8 @@ msgid "" "(if any) and then return the deadline of the next scheduled call in the " "scheduler (if any)." msgstr "" +"如果 *blocking* 為 false,則執行最快到期的已排程事件(如存在),然後回傳排程" +"器中下一個排程呼叫(如存在)的截止時間。" #: ../../library/sched.rst:126 msgid "" @@ -132,6 +150,9 @@ msgid "" "an exception is raised by *action*, the event will not be attempted in " "future calls to :meth:`run`." msgstr "" +"*action* 或 *delayfunc* 都可能引發例外。無論哪種情況,排程器都將保持一致的狀" +"態並傳遞例外。如果是由 *action* 引發例外,則後續呼叫 :meth:`run` 時將不會嘗試" +"運行該事件。" #: ../../library/sched.rst:131 msgid "" @@ -140,6 +161,9 @@ msgid "" "dropped; the calling code is responsible for canceling events which are no " "longer pertinent." msgstr "" +"如果一系列事件的運行時長比執行下一個事件前的可用時長 (available time) 更長," +"那麼排程器就單純會落後。不會有事件被丟棄;呼叫程式碼也要負責取消不再相關的事" +"件。" #: ../../library/sched.rst:136 msgid "*blocking* parameter was added." @@ -151,6 +175,9 @@ msgid "" "will be run. Each event is shown as a :term:`named tuple` with the " "following fields: time, priority, action, argument, kwargs." msgstr "" +"會按事件運行順序回傳即將發生的事件串列的唯讀屬性。每個事件都以\\ :term:`附名" +"元組 (named tuple) ` 表示,並包含以下欄位:時間、優先順序、動作 " +"(action)、引數、kwargs。" #: ../../library/sched.rst:11 msgid "event scheduling" From 6d6ceafa1486fb7797dfb999b102fdd44ae61fdd Mon Sep 17 00:00:00 2001 From: "Wei-Hsiang (Matt) Wang" Date: Tue, 11 Jun 2024 01:44:48 +0800 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Payon --- library/sched.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/sched.po b/library/sched.po index c7cf02eb4b..9bc5dd3cc1 100644 --- a/library/sched.po +++ b/library/sched.po @@ -110,7 +110,7 @@ msgid "" "the other arguments, the effect and the return value are the same as those " "for :meth:`enterabs`." msgstr "" -"為一個排程事件延期 *delay* 時間單位。除了相對時間之外,其他引數、效果和回傳值" +"為一個排程事件延期 *delay* 個時間單位。除了相對時間之外,其他引數、效果和回傳值" "皆與 :meth:`enterabs` 的相同。" #: ../../library/sched.rst:107