From 10794fd724aac79f748d14765c2dea66e143749a Mon Sep 17 00:00:00 2001 From: "Wei-Hsiang (Matt) Wang" Date: Sat, 16 Nov 2024 15:39:44 +0800 Subject: [PATCH] Translate the second half of `library/pdb.po` (#991) Co-authored-by: mindihx --- library/pdb.po | 197 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 173 insertions(+), 24 deletions(-) diff --git a/library/pdb.po b/library/pdb.po index 1f31a9ad78..82e3ec7697 100644 --- a/library/pdb.po +++ b/library/pdb.po @@ -672,7 +672,7 @@ msgstr "" #: ../../library/pdb.rst:382 msgid "Enable the breakpoints specified." -msgstr "" +msgstr "啟用指定的斷點。" #: ../../library/pdb.rst:386 msgid "" @@ -682,6 +682,9 @@ msgid "" "the breakpoint is reached and the breakpoint is not disabled and any " "associated condition evaluates to true." msgstr "" +"為給定的斷點編號設定忽略計數。如果省略 *count* 則忽略計數設定為 0。當忽略計數" +"為 0 時,斷點將變為有效狀態。當非 0 時,每次到達斷點,且斷點沒有被禁用,且任" +"何關聯的條件被求值為 true,則 *count* 就會遞減。" #: ../../library/pdb.rst:394 msgid "" @@ -689,6 +692,8 @@ msgid "" "to true before the breakpoint is honored. If *condition* is absent, any " "existing condition is removed; i.e., the breakpoint is made unconditional." msgstr "" +"為斷點設定一個新 *condition*,為一個運算式,且其求值結果為 true 時斷點才會起" +"作用。如果沒有給定 *condition*,則刪除任何現有條件,也就是不為斷點設定條件。" #: ../../library/pdb.rst:400 msgid "" @@ -696,6 +701,8 @@ msgid "" "themselves appear on the following lines. Type a line containing just " "``end`` to terminate the commands. An example::" msgstr "" +"為編號是 *bpnumber* 的斷點指定一系列命令。命令內容出現在後續的幾列中。輸入僅" +"包含 ``end`` 的一列來結束命令列表。例如: ::" #: ../../library/pdb.rst:404 msgid "" @@ -704,17 +711,23 @@ msgid "" "(com) end\n" "(Pdb)" msgstr "" +"(Pdb) commands 1\n" +"(com) p some_variable\n" +"(com) end\n" +"(Pdb)" #: ../../library/pdb.rst:409 msgid "" "To remove all commands from a breakpoint, type ``commands`` and follow it " "immediately with ``end``; that is, give no commands." msgstr "" +"要刪除斷點上的所有命令,請輸入 ``commands`` 並立即以 ``end`` 結尾,也就是不指" +"定任何命令。" #: ../../library/pdb.rst:412 msgid "" "With no *bpnumber* argument, ``commands`` refers to the last breakpoint set." -msgstr "" +msgstr "不帶有 *bpnumber* 引數則 ``commands`` 會關聯到上一個設定的斷點。" #: ../../library/pdb.rst:414 msgid "" @@ -722,6 +735,8 @@ msgid "" "the :pdbcmd:`continue` command, or :pdbcmd:`step`, or any other command that " "resumes execution." msgstr "" +"可以使用斷點命令來重新啟動程式,只需使用 :pdbcmd:`continue` 或 :pdbcmd:" +"`step` 命令,或其他可以繼續執行程式的命令。" #: ../../library/pdb.rst:418 msgid "" @@ -733,6 +748,11 @@ msgid "" "another breakpoint—which could have its own command list, leading to " "ambiguities about which list to execute." msgstr "" +"如果指定了某個繼續執行程式的命令(目前包括 :pdbcmd:`continue`、:pdbcmd:" +"`step`、:pdbcmd:`next`、:pdbcmd:`return`、:pdbcmd:`jump`、:pdbcmd:`quit` 及它" +"們的縮寫)將終止命令列表(就像該命令後馬上跟著 end)。因為在任何時候繼續執行" +"下去(即使是簡單的 next 或 step),都可能會遇到另一個斷點,該斷點可能具有自己" +"的命令列表,這會導致無法確定要執行哪個列表。" #: ../../library/pdb.rst:427 msgid "" @@ -742,12 +762,17 @@ msgid "" "of the other commands print anything, you see no sign that the breakpoint " "was reached." msgstr "" +"如果你在命令列表中使用 ``silent`` 命令,則平常會有的那些關於停止於斷點處的訊" +"息就不會印出。對於要印出特定訊息再繼續的斷點來說,這可能會是需要的功能。如果" +"其他命令都沒有印出任何內容,那你就看不到已到達斷點的跡象。" #: ../../library/pdb.rst:434 msgid "" "Execute the current line, stop at the first possible occasion (either in a " "function that is called or on the next line in the current function)." msgstr "" +"執行當前列,在第一個可以停止的位置(在被呼叫的函式內部或在當前函式的下一列)" +"停止。" #: ../../library/pdb.rst:439 msgid "" @@ -757,12 +782,16 @@ msgid "" "executes called functions at (nearly) full speed, only stopping at the next " "line in the current function.)" msgstr "" +"繼續執行,直至執行到當前函式的下一列或者當前函式回傳為止。(:pdbcmd:`next` " +"和 :pdbcmd:`step` 之間的區別在於 :pdbcmd:`step` 會在被呼叫函式的內部停止、" +"而 :pdbcmd:`next`\\ (幾乎)全速執行被呼叫的函式,並僅在當前函式的下一列停" +"止。)" #: ../../library/pdb.rst:447 msgid "" "Without argument, continue execution until the line with a number greater " "than the current one is reached." -msgstr "" +msgstr "如果不帶引數則繼續執行,直到列號比當前的列大時停止。" #: ../../library/pdb.rst:450 msgid "" @@ -770,18 +799,20 @@ msgid "" "equal to *lineno* is reached. In both cases, also stop when the current " "frame returns." msgstr "" +"如帶有 *lineno* 則繼續執行,直到到達列號大於或等於 *lineno* 的那一列。在這兩" +"種情況下,當前 frame 回傳時也會停止。" #: ../../library/pdb.rst:454 msgid "Allow giving an explicit line number." -msgstr "" +msgstr "允許明確給定一個列號。" #: ../../library/pdb.rst:459 msgid "Continue execution until the current function returns." -msgstr "" +msgstr "繼續執行,直到目前的函式回傳。" #: ../../library/pdb.rst:463 msgid "Continue execution, only stop when a breakpoint is encountered." -msgstr "" +msgstr "繼續執行,除非遇到斷點才停下來。" #: ../../library/pdb.rst:467 msgid "" @@ -789,6 +820,8 @@ msgid "" "frame. This lets you jump back and execute code again, or jump forward to " "skip code that you don't want to run." msgstr "" +"設定即將執行的下一列,僅可用於堆疊中最底部的 frame。這讓你可以跳回去並再次執" +"行程式碼,或者往前跳以跳過不想執行的程式碼。" #: ../../library/pdb.rst:471 msgid "" @@ -796,6 +829,8 @@ msgid "" "possible to jump into the middle of a :keyword:`for` loop or out of a :" "keyword:`finally` clause." msgstr "" +"需要注意的是,不是所有的跳轉都是被允許的 -- 例如不能跳轉到 :keyword:`for` 迴" +"圈的中間或跳出 :keyword:`finally` 子句。" #: ../../library/pdb.rst:477 msgid "" @@ -805,6 +840,10 @@ msgid "" "lines around at that line. With two arguments, list the given range; if the " "second argument is less than the first, it is interpreted as a count." msgstr "" +"列出當前檔案的原始碼。如果不帶引數,則列出當前列周圍的 11 列,或繼續先前的列" +"表操作。如果用 ``.`` 作為引數,則列出當前列周圍的 11 列。如果帶有一個引數,則" +"列出那一列周圍的 11 列。如果帶有兩個引數,則列出給定範圍中的程式碼;如果第二" +"個引數小於第一個引數,則將其直譯為要列出的列數。" #: ../../library/pdb.rst:483 msgid "" @@ -813,55 +852,62 @@ msgid "" "raised or propagated is indicated by ``>>``, if it differs from the current " "line." msgstr "" +"當前 frame 中的當前列會用 ``->`` 標記出來。如果正在偵錯一個例外,且引發或傳遞" +"該例外的那一列不是當前列,則會用 ``>>`` 來標記該列。" #: ../../library/pdb.rst:488 msgid "Added the ``>>`` marker." -msgstr "" +msgstr "新增了 ``>>`` 標記。" #: ../../library/pdb.rst:493 msgid "" "List all source code for the current function or frame. Interesting lines " "are marked as for :pdbcmd:`list`." msgstr "" +"列出當前函式或 frame 的所有原始碼。相關列的標記方式與 :pdbcmd:`list` 相同。" #: ../../library/pdb.rst:500 msgid "Print the arguments of the current function and their current values." -msgstr "" +msgstr "印出當前函式的引數及它們當前的值。" #: ../../library/pdb.rst:504 msgid "Evaluate *expression* in the current context and print its value." -msgstr "" +msgstr "在當前情境中為 *expression* 求值並印出其值。" #: ../../library/pdb.rst:508 msgid "" "``print()`` can also be used, but is not a debugger command --- this " "executes the Python :func:`print` function." msgstr "" +"也可以使用 ``print()``,但它不是一個偵錯器命令 --- 它會執行 Python :func:" +"`print` 函式。" #: ../../library/pdb.rst:514 msgid "" "Like the :pdbcmd:`p` command, except the value of *expression* is pretty-" "printed using the :mod:`pprint` module." msgstr "" +"與 :pdbcmd:`p` 命令類似,除了 *expression* 的值是使用 :mod:`pprint` 模組美化" +"後印出來的。" #: ../../library/pdb.rst:519 msgid "Print the type of *expression*." -msgstr "" +msgstr "印出 *expression* 的型別。" #: ../../library/pdb.rst:523 msgid "Try to get source code of *expression* and display it." -msgstr "" +msgstr "嘗試獲取 *expression* 的原始碼並顯示它。" #: ../../library/pdb.rst:529 msgid "" "Display the value of *expression* if it changed, each time execution stops " "in the current frame." -msgstr "" +msgstr "每次在當前 frame 中停止執行時,顯示 *expression* 的值(如果有變更)。" #: ../../library/pdb.rst:532 msgid "" "Without *expression*, list all display expressions for the current frame." -msgstr "" +msgstr "如果不帶有 *expression*,則列出當前 frame 的所有運算式。" #: ../../library/pdb.rst:536 msgid "" @@ -869,10 +915,12 @@ msgid "" "evaluation of *expression*, so when the result is mutable, display may not " "be able to pick up the changes." msgstr "" +"display 會對 *expression* 求值並將結果與之前 *expression* 的求值結果進行比" +"較,因此當結果可變時,display 可能無法獲取其變更。" #: ../../library/pdb.rst:540 ../../library/pdb.rst:690 msgid "Example::" -msgstr "範例: ::" +msgstr "範例如下: ::" #: ../../library/pdb.rst:542 msgid "" @@ -882,12 +930,19 @@ msgid "" "lst.append(1)\n" "print(lst)" msgstr "" +"lst = []\n" +"breakpoint()\n" +"pass\n" +"lst.append(1)\n" +"print(lst)" #: ../../library/pdb.rst:548 msgid "" "Display won't realize ``lst`` has been changed because the result of " "evaluation is modified in place by ``lst.append(1)`` before being compared::" msgstr "" +"display 不會意識到 ``lst`` 已更改,因為其求值結果在比較之前已被 ``lst." +"append(1)`` 原地 (in place) 修改: ::" #: ../../library/pdb.rst:551 msgid "" @@ -903,10 +958,21 @@ msgid "" "-> print(lst)\n" "(Pdb)" msgstr "" +"> example.py(3)()\n" +"-> pass\n" +"(Pdb) display lst\n" +"display lst: []\n" +"(Pdb) n\n" +"> example.py(4)()\n" +"-> lst.append(1)\n" +"(Pdb) n\n" +"> example.py(5)()\n" +"-> print(lst)\n" +"(Pdb)" #: ../../library/pdb.rst:563 msgid "You can do some tricks with copy mechanism to make it work::" -msgstr "" +msgstr "你可以運用複製機制的一些技巧來使其能夠運作: ::" #: ../../library/pdb.rst:565 msgid "" @@ -923,12 +989,26 @@ msgid "" "display lst[:]: [1] [old: []]\n" "(Pdb)" msgstr "" +"> example.py(3)()\n" +"-> pass\n" +"(Pdb) display lst[:]\n" +"display lst[:]: []\n" +"(Pdb) n\n" +"> example.py(4)()\n" +"-> lst.append(1)\n" +"(Pdb) n\n" +"> example.py(5)()\n" +"-> print(lst)\n" +"display lst[:]: [1] [old: []]\n" +"(Pdb)" #: ../../library/pdb.rst:582 msgid "" "Do not display *expression* anymore in the current frame. Without " "*expression*, clear all display expressions for the current frame." msgstr "" +"不再顯示當前 frame 中的 *expression*。如果不帶有 *expression*,則清除當前 " +"frame 的所有顯示運算式。" #: ../../library/pdb.rst:589 msgid "" @@ -937,6 +1017,9 @@ msgid "" "current scope. Use ``exit()`` or ``quit()`` to exit the interpreter and " "return to the debugger." msgstr "" +"在從目前作用域的區域和全域命名空間初始化的新全域命名空間中啟動互動式直譯器" +"(使用 :mod:`code` 模組)。可使用 ``exit()`` 或 ``quit()`` 退出直譯器並回到偵" +"錯器。" #: ../../library/pdb.rst:596 msgid "" @@ -945,17 +1028,22 @@ msgid "" "modifications to any referenced mutable objects will be reflected in the " "original namespaces as usual." msgstr "" +"由於 ``interact`` 為程式碼執行建立了一個新的專用命名空間,因此變數的賦值不會" +"影響原始命名空間,但是對任何被參照的可變物件的修改將像往常一樣反映在原始命名" +"空間中。" #: ../../library/pdb.rst:603 msgid "" "``exit()`` and ``quit()`` can be used to exit the :pdbcmd:`interact` command." -msgstr "" +msgstr "``exit()`` 和 ``quit()`` 可用來退出 :pdbcmd:`interact` 命令。" #: ../../library/pdb.rst:607 msgid "" ":pdbcmd:`interact` directs its output to the debugger's output channel " "rather than :data:`sys.stderr`." msgstr "" +":pdbcmd:`interact` 將其輸出導向到偵錯器的輸出通道 (output channel),而不是 :" +"data:`sys.stderr`。" #: ../../library/pdb.rst:615 msgid "" @@ -965,6 +1053,10 @@ msgid "" "parameters. If *command* is omitted, the current alias for *name* is shown. " "If no arguments are given, all aliases are listed." msgstr "" +"建立一個名為 *name* 的別名,用於執行 *command*。*command* *不得*\\ 用引號包起" +"來。可被替換的參數要用 ``%1``、``%2``、 ... 和 ``%9`` 標示,而 ``%*`` 則被所" +"有參數替換。如果省略 *command*,則顯示 *name* 的目前別名。如果未給定引數,則" +"列出所有別名。" #: ../../library/pdb.rst:621 msgid "" @@ -974,12 +1066,16 @@ msgid "" "Aliasing is recursively applied to the first word of the command line; all " "other words in the line are left alone." msgstr "" +"巢狀別名是允許的,且可包含能在 pdb 提示字元下合法輸入的任何內容。請注意,內" +"部 pdb 命令\\ *可以*\\ 被別名所覆蓋。這樣的命令在別名被移除前都將被隱藏。別名" +"會遞迴地應用到命令列的第一個單詞;該列內的其他單詞則不會受影響。" #: ../../library/pdb.rst:627 msgid "" "As an example, here are two useful aliases (especially when placed in the :" "file:`.pdbrc` file)::" msgstr "" +"作為範例,這裡列出了兩個有用的別名(特別是放在 :file:`.pdbrc` 檔案中時): ::" #: ../../library/pdb.rst:630 msgid "" @@ -988,10 +1084,14 @@ msgid "" "# Print instance variables in self\n" "alias ps pi self" msgstr "" +"# 印出實例變數(用法如 \"pi classInst\")\n" +"alias pi for k in %1.__dict__.keys(): print(f\"%1.{k} = {%1.__dict__[k]}\")\n" +"# 印出 self 中的實例變數\n" +"alias ps pi self" #: ../../library/pdb.rst:637 msgid "Delete the specified alias *name*." -msgstr "" +msgstr "刪除指定的別名 *name*。" #: ../../library/pdb.rst:641 msgid "" @@ -999,24 +1099,32 @@ msgid "" "frame. The exclamation point can be omitted unless the first word of the " "statement resembles a debugger command, e.g.:" msgstr "" +"在當前 stack frame 的情境中執行(單列)\\ *statement*。除非陳述式的第一個單詞" +"類似於偵錯器命令,否則可以省略驚嘆號,例如:" #: ../../library/pdb.rst:645 msgid "" "(Pdb) ! n=42\n" "(Pdb)" msgstr "" +"(Pdb) ! n=42\n" +"(Pdb)" #: ../../library/pdb.rst:650 msgid "" "To set a global variable, you can prefix the assignment command with a :" "keyword:`global` statement on the same line, e.g.:" msgstr "" +"要設定全域變數,你可以在同一列的賦值命令前面加上 :keyword:`global` 陳述式,例" +"如:" #: ../../library/pdb.rst:653 msgid "" "(Pdb) global list_options; list_options = ['-l']\n" "(Pdb)" msgstr "" +"(Pdb) global list_options; list_options = ['-l']\n" +"(Pdb)" #: ../../library/pdb.rst:661 msgid "" @@ -1025,24 +1133,29 @@ msgid "" "History, breakpoints, actions and debugger options are preserved. :pdbcmd:" "`restart` is an alias for :pdbcmd:`run`." msgstr "" +"重新啟動已偵錯完畢的 Python 程式。如果提供了 *args*,它將以 :mod:`shlex` 分" +"割,並將結果用作新的 :data:`sys.argv`。歷史記錄、斷點、操作和偵錯器選項均會被" +"保留。:pdbcmd:`restart` 是 :pdbcmd:`run` 的別名。" #: ../../library/pdb.rst:668 msgid "Quit from the debugger. The program being executed is aborted." -msgstr "" +msgstr "離開偵錯器,執行中的程式會被中止。" #: ../../library/pdb.rst:672 msgid "" "Enter a recursive debugger that steps through *code* (which is an arbitrary " "expression or statement to be executed in the current environment)." msgstr "" +"進入一個遞迴偵錯器,逐步執行 *code*\\ (這是要在當前環境中執行的任意運算式或" +"陳述式)。" #: ../../library/pdb.rst:678 msgid "Print the return value for the last return of the current function." -msgstr "" +msgstr "印出當前函式最後一次回傳的回傳值。" #: ../../library/pdb.rst:682 msgid "List or jump between chained exceptions." -msgstr "" +msgstr "列出鏈接例外 (chained exceptions),或在其間跳轉。" #: ../../library/pdb.rst:684 msgid "" @@ -1051,6 +1164,9 @@ msgid "" "chained exceptions using ``exceptions`` command to list exceptions, and " "``exception `` to switch to that exception." msgstr "" +"當使用 ``pdb.pm()`` 或 ``Pdb.post_mortem(...)`` 於鏈接例外而不是回溯時,它允" +"許使用者在鏈接例外之間移動,使用 ``exceptions`` 命令以列出例外,並使用 " +"``exception `` 切換到該例外。" #: ../../library/pdb.rst:692 msgid "" @@ -1071,10 +1187,26 @@ msgid "" "\n" " out()" msgstr "" +"def out():\n" +" try:\n" +" middle()\n" +" except Exception as e:\n" +" raise ValueError(\"reraise middle() error\") from e\n" +"\n" +"def middle():\n" +" try:\n" +" return inner(0)\n" +" except Exception as e:\n" +" raise ValueError(\"Middle fail\")\n" +"\n" +"def inner(x):\n" +" 1 / x\n" +"\n" +" out()" #: ../../library/pdb.rst:709 msgid "calling ``pdb.pm()`` will allow to move between exceptions::" -msgstr "" +msgstr "呼叫 ``pdb.pm()`` 將允許在例外之間移動: ::" #: ../../library/pdb.rst:711 msgid "" @@ -1094,20 +1226,37 @@ msgid "" "> example.py(10)middle()\n" "-> return inner(0)" msgstr "" +"> example.py(5)out()\n" +"-> raise ValueError(\"reraise middle() error\") from e\n" +"\n" +"(Pdb) exceptions\n" +" 0 ZeroDivisionError('division by zero')\n" +" 1 ValueError('Middle fail')\n" +"> 2 ValueError('reraise middle() error')\n" +"\n" +"(Pdb) exceptions 0\n" +"> example.py(16)inner()\n" +"-> 1 / x\n" +"\n" +"(Pdb) up\n" +"> example.py(10)middle()\n" +"-> return inner(0)" #: ../../library/pdb.rst:730 msgid "Footnotes" -msgstr "註解" +msgstr "註腳" #: ../../library/pdb.rst:731 msgid "" "Whether a frame is considered to originate in a certain module is determined " "by the ``__name__`` in the frame globals." msgstr "" +"一個 frame 是否會被認為源自特定模組是由該 frame 全域性變數中的 ``__name__`` " +"來決定的。" #: ../../library/pdb.rst:11 msgid "debugging" -msgstr "debugging(除錯)" +msgstr "debugging(偵錯)" #: ../../library/pdb.rst:21 msgid "Pdb (class in pdb)" @@ -1135,7 +1284,7 @@ msgstr "file(檔案)" #: ../../library/pdb.rst:295 msgid "debugger" -msgstr "debugger(除錯器)" +msgstr "debugger(偵錯器)" #: ../../library/pdb.rst:295 msgid "configuration"