Skip to content

Translate library/cmd.po rst: 13-99 #1045

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 46 additions & 5 deletions library/cmd.po
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
# This file is distributed under the same license as the Python package.
#
# Translators:
# Dr-XYZ <[email protected]>, 2025
msgid ""
msgstr ""
"Project-Id-Version: Python 3.13\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-09-23 07:52+0800\n"
"PO-Revision-Date: 2018-05-23 14:40+0000\n"
"Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n"
"PO-Revision-Date: 2025-05-14 14:32+0800\n"
"Last-Translator: Dr-XYZ <dr.xyz.tw@gmail.com>\n"
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
"tw)\n"
"Language: zh_TW\n"
Expand All @@ -33,6 +34,8 @@ msgid ""
"administrative tools, and prototypes that will later be wrapped in a more "
"sophisticated interface."
msgstr ""
":class:`Cmd` 類別提供了一個簡單的架構,用於撰寫行導向的命令直譯器。這類直譯器"
"常用於測試控制工具、管理工具以及日後將包裝於更高階介面的原型中。"

#: ../../library/cmd.rst:20
msgid ""
Expand All @@ -42,6 +45,9 @@ msgid ""
"yourself in order to inherit :class:`Cmd`'s methods and encapsulate action "
"methods."
msgstr ""
":class:`Cmd` 實例或其子類別實例是一種行導向的直譯器架構。通常沒有必要直接實例"
"化 :class:`Cmd` 本身;它更適合作為你自定義的直譯器類別的父類別,讓你能繼承 :"
"class:`Cmd` 的方法,並封裝動作方法。"

#: ../../library/cmd.rst:25
msgid ""
Expand All @@ -50,6 +56,9 @@ msgid ""
"`None` and :mod:`readline` is available, command completion is done "
"automatically."
msgstr ""
"可選引數 *completekey* 是 :mod:`readline` 模組中用於自動完成的按鍵名稱;預設"
"為 :kbd:`Tab`。若 *completekey* 不為 :const:`None` 且 :mod:`readline` 可用,"
"則會自動啟用命令自動完成功能。"

#: ../../library/cmd.rst:29
msgid ""
Expand All @@ -59,6 +68,10 @@ msgid ""
"``'tab'``. Note that other values are not treated this way, and might only "
"work with a specific backend."
msgstr ""
"預設值 ``'tab'`` 會被特殊處理,使其在所有的 :data:`readline.backend` 中皆代"
"表 :kbd:`Tab` 鍵。具體來說,若 :data:`readline.backend` 為 ``editline``,則 "
"``Cmd`` 會改用 ``'^I'`` 取代 ``'tab'``。請注意,其他值不會有此處理方式,且可"
"能僅能在特定的後端中適用。"

#: ../../library/cmd.rst:36
msgid ""
Expand All @@ -67,38 +80,46 @@ msgid ""
"and output. If not specified, they will default to :data:`sys.stdin` and :"
"data:`sys.stdout`."
msgstr ""
"可選引數 *stdin* 與 *stdout* 用來指定 Cmd 實例或其子類別實例所使用的輸入與輸"
"出檔案物件。若未指定,預設為 :data:`sys.stdin` 與 :data:`sys.stdout`。"

#: ../../library/cmd.rst:41
msgid ""
"If you want a given *stdin* to be used, make sure to set the instance's :"
"attr:`use_rawinput` attribute to ``False``, otherwise *stdin* will be "
"ignored."
msgstr ""
"若你希望使用指定的 *stdin*,請務必將該實例的 :attr:`use_rawinput` 屬性設為 "
"``False``,否則 *stdin* 會被忽略。"

#: ../../library/cmd.rst:45
msgid "``completekey='tab'`` is replaced by ``'^I'`` for ``editline``."
msgstr ""
msgstr "對於 ``editline``,``completekey='tab'`` 會被替換為 ``'^I'``。"

#: ../../library/cmd.rst:52
msgid "Cmd Objects"
msgstr "Cmd 物件"

#: ../../library/cmd.rst:54
msgid "A :class:`Cmd` instance has the following methods:"
msgstr ""
msgstr ":class:`Cmd` 實例具有以下方法:"

#: ../../library/cmd.rst:59
msgid ""
"Repeatedly issue a prompt, accept input, parse an initial prefix off the "
"received input, and dispatch to action methods, passing them the remainder "
"of the line as argument."
msgstr ""
"重複顯示提示字元、接收輸入、剖析接收到的輸入字串前綴,並派發給動作方法,將其"
"餘部分作為引數傳遞給它們"

#: ../../library/cmd.rst:63
msgid ""
"The optional argument is a banner or intro string to be issued before the "
"first prompt (this overrides the :attr:`intro` class attribute)."
msgstr ""
"此可選引數為橫幅或導言字串,會在首次顯示提示字元前輸出(此值會覆寫 :attr:"
"`intro` 類別屬性)。"

#: ../../library/cmd.rst:66
msgid ""
Expand All @@ -108,10 +129,14 @@ msgid ""
"`Control-F` moves the cursor to the right non-destructively, :kbd:`Control-"
"B` moves the cursor to the left non-destructively, etc.)."
msgstr ""
"如果已載入 :mod:`readline` 模組,輸入行將自動繼承類似 :program:`bash` 的歷史"
"紀錄編輯功能(例如 :kbd:`Control-P` 可向上捲動至上一個指令,:kbd:`Control-N` "
"向下捲動至下一個指令,:kbd:`Control-F` 非破壞性地將游標向右移動,:kbd:"
"`Control-B` 非破壞性地將游標向左移動等)。"

#: ../../library/cmd.rst:72
msgid "An end-of-file on input is passed back as the string ``'EOF'``."
msgstr ""
msgstr "當輸入為檔案結尾(EOF)時,會傳回字串 ``'EOF'``。"

#: ../../library/cmd.rst:78
msgid ""
Expand All @@ -121,13 +146,19 @@ msgid ""
"another special case, a line beginning with the character ``'!'`` is "
"dispatched to the method :meth:`!do_shell` (if such a method is defined)."
msgstr ""
"直譯器實例僅當存在 :meth:`!do_foo` 方法時,才會識別命令名稱 ``foo``。作為特殊"
"情況,以字元 ``'?'`` 開頭的行會被派發至 :meth:`do_help` 方法;另一個特殊情況"
"是,以字元 ``'!'`` 開頭的行會被派發至 :meth:`!do_shell` 方法(若該方法已定"
"義)。"

#: ../../library/cmd.rst:84
msgid ""
"This method will return when the :meth:`postcmd` method returns a true "
"value. The *stop* argument to :meth:`postcmd` is the return value from the "
"command's corresponding :meth:`!do_\\*` method."
msgstr ""
"當 :meth:`postcmd` 方法回傳真值時,此方法將會結束。傳遞給 :meth:`postcmd` 的 "
"*stop* 引數是該命令對應的 :meth:`!do_\\*` 方法的回傳值。"

#: ../../library/cmd.rst:88
msgid ""
Expand All @@ -140,6 +171,11 @@ msgid ""
"could be used to provide different completion depending upon which position "
"the argument is in."
msgstr ""
"如果啟用了自動完成,命令的自動完成將會自動執行,而命令引數的自動完成則是透過"
"呼叫 :meth:`!complete_foo` 方法並傳入 *text*、*line*、*begidx* 和 *endidx* 引"
"數來處理。*text* 是要比對的字串前綴:所有回傳的符合項都必須以此字串開頭。"
"*line* 是目前的輸入行(前置空白會被移除),*begidx* 和 *endidx* 則分別是前綴"
"字串的起始與結束索引,可用來根據引數所在的位置提供不同的自動完成結果。"

#: ../../library/cmd.rst:99
msgid ""
Expand All @@ -151,6 +187,11 @@ msgid ""
"help_\\*` methods or commands that have docstrings), and also lists any "
"undocumented commands."
msgstr ""
"所有 :class:`Cmd` 的子類別都會繼承預先定義的 :meth:`!do_help` 方法。當此方法"
"接收到引數 ``'bar'`` 時,會呼叫對應的 :meth:`!help_bar` 方法;若該方法不存"
"在,則會列印 :meth:`!do_bar` 的說明字串(若有的話)。若未提供任何引數,:meth:"
"`!do_help` 會列出所有可用的說明主題(也就是所有具有對應 :meth:`!help_\\*` 方"
"法或有說明字串的命令),並且也會列出所有尚未記錄的命令。"

#: ../../library/cmd.rst:110
msgid ""
Expand Down