@@ -984,45 +984,53 @@ msgid ""
984984" you can call :func:`OptionParser.error` to signal an application-defined "
985985"error condition::"
986986msgstr ""
987+ "处理用户错误更为重要,因为无论你的代码有多稳定他们都肯定会发生。 :mod:`optparse` 可以自动检测部分用户错误,例如不正确的选项参数(如传入"
988+ " ``-n 4x`` 而 ``-n`` 接受整数参数),缺少参数(如 ``-n`` 位于命令行的末尾,而 ``-n`` 接受任意类型的参数)。 "
989+ "并且,你可以调用 :func:`OptionParser.error` 来指明应用程序自定义的错误条件::"
987990
988991#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:728
989992msgid ""
990993"In either case, :mod:`optparse` handles the error the same way: it prints "
991994"the program's usage message and an error message to standard error and exits"
992995" with error status 2."
993996msgstr ""
997+ "在两种情况下,:mod:`optparse` 都是以相同方式处理错误的:它会将程序的用法消息和错误消息打印到标准错误并附带错误状态 2 退出。"
994998
995999#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:732
9961000msgid ""
9971001"Consider the first example above, where the user passes ``4x`` to an option "
9981002"that takes an integer:"
999- msgstr ""
1003+ msgstr "考虑上面的第一个示例,其中用户向一个接受整数的选项传入了 ``4x``: "
10001004
10011005#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:742
10021006msgid "Or, where the user fails to pass a value at all:"
1003- msgstr ""
1007+ msgstr "或者,当用户未传入任何值: "
10041008
10051009#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:751
10061010msgid ""
10071011":mod:`optparse`\\ -generated error messages take care always to mention the "
10081012"option involved in the error; be sure to do the same when calling "
10091013":func:`OptionParser.error` from your application code."
10101014msgstr ""
1015+ ":mod:`optparse` 生成的错误消息总是会确保提示在错误中涉及的选项;请确保在从你的应用程序代码调用 "
1016+ ":func:`OptionParser.error` 时也做同样的事。"
10111017
10121018#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:755
10131019msgid ""
10141020"If :mod:`optparse`'s default error-handling behaviour does not suit your "
10151021"needs, you'll need to subclass OptionParser and override its "
10161022":meth:`~OptionParser.exit` and/or :meth:`~OptionParser.error` methods."
10171023msgstr ""
1024+ "如果 :mod:`optparse` 的默认错误处理行为不适合你的需求,你需要子类化 OptionParser 并重载它的 "
1025+ ":meth:`~OptionParser.exit` 和/或 :meth:`~OptionParser.error` 方法。"
10181026
10191027#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:763
10201028msgid "Putting it all together"
1021- msgstr ""
1029+ msgstr "合并所有代码 "
10221030
10231031#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:765
10241032msgid "Here's what :mod:`optparse`\\ -based scripts usually look like::"
1025- msgstr ""
1033+ msgstr "下面是基于 :mod:`optparse` 的脚本通常的结构:: "
10261034
10271035#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:793
10281036msgid "Reference Guide"