|
| 1 | +# SOME DESCRIPTIVE TITLE. |
| 2 | +# Copyright (C) 2001-2025, Python Software Foundation |
| 3 | +# This file is distributed under the same license as the Python package. |
| 4 | +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. |
| 5 | +# |
| 6 | +# Translators: |
| 7 | +# Rafael Fontenelle <rffontenelle@gmail.com>, 2025 |
| 8 | +# |
| 9 | +#,fuzzy |
| 10 | +msgid "" |
| 11 | +msgstr "" |
| 12 | +"Project-Id-Version:Python 3.13\n" |
| 13 | +"Report-Msgid-Bugs-To:\n" |
| 14 | +"POT-Creation-Date:2025-05-09 14:59+0000\n" |
| 15 | +"PO-Revision-Date:2025-05-08 05:09+0000\n" |
| 16 | +"Last-Translator:Rafael Fontenelle <rffontenelle@gmail.com>, 2025\n" |
| 17 | +"Language-Team:Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n" |
| 18 | +"MIME-Version:1.0\n" |
| 19 | +"Content-Type:text/plain; charset=UTF-8\n" |
| 20 | +"Content-Transfer-Encoding:8bit\n" |
| 21 | +"Language:zh_CN\n" |
| 22 | +"Plural-Forms:nplurals=1; plural=0;\n" |
| 23 | + |
| 24 | +#:../../howto/argparse-optparse.rst:8 |
| 25 | +msgid"Migrating ``optparse`` code to ``argparse``" |
| 26 | +msgstr"将 ``optparse`` 代码迁移至 ``argparse``" |
| 27 | + |
| 28 | +#:../../howto/argparse-optparse.rst:10 |
| 29 | +msgid"" |
| 30 | +"The :mod:`argparse` module offers several higher level features not natively" |
| 31 | +" provided by the :mod:`optparse` module, including:" |
| 32 | +msgstr":mod:`argparse` 模块提供了一些未获 :mod:`optparse` 模块原生支持的更高层级特性,包括:" |
| 33 | + |
| 34 | +#:../../howto/argparse-optparse.rst:13 |
| 35 | +msgid"Handling positional arguments." |
| 36 | +msgstr"处理位置参数。" |
| 37 | + |
| 38 | +#:../../howto/argparse-optparse.rst:14 |
| 39 | +msgid"Supporting subcommands." |
| 40 | +msgstr"支持子命令。" |
| 41 | + |
| 42 | +#:../../howto/argparse-optparse.rst:15 |
| 43 | +msgid"Allowing alternative option prefixes like ``+`` and ``/``." |
| 44 | +msgstr"允许替代选项前缀例如 ``+`` 和 ``/``。" |
| 45 | + |
| 46 | +#:../../howto/argparse-optparse.rst:16 |
| 47 | +msgid"Handling zero-or-more and one-or-more style arguments." |
| 48 | +msgstr"处理零个或多个以及一个或多个风格的参数。" |
| 49 | + |
| 50 | +#:../../howto/argparse-optparse.rst:17 |
| 51 | +msgid"Producing more informative usage messages." |
| 52 | +msgstr"生成更具信息量的用法消息。" |
| 53 | + |
| 54 | +#:../../howto/argparse-optparse.rst:18 |
| 55 | +msgid"Providing a much simpler interface for custom ``type`` and ``action``." |
| 56 | +msgstr"提供用于定制 ``type`` 和 ``action`` 的更为简单的接口。" |
| 57 | + |
| 58 | +#:../../howto/argparse-optparse.rst:20 |
| 59 | +msgid"" |
| 60 | +"Originally, the :mod:`argparse` module attempted to maintain compatibility " |
| 61 | +"with :mod:`optparse`. However, the fundamental design differences between " |
| 62 | +"supporting declarative command line option processing (while leaving " |
| 63 | +"positional argument processing to application code), and supporting both " |
| 64 | +"named options and positional arguments in the declarative interface mean " |
| 65 | +"that the API has diverged from that of ``optparse`` over time." |
| 66 | +msgstr"" |
| 67 | +"最初的时候,:mod:`argparse` 模块试图维持与 :mod:`optparse` 的兼容性。 " |
| 68 | +"不过,在支持声明式命令行选项处理(并将位置参数处理留给应用程序代码)以及在声明式界面中同时支持名称选项和位置参数之间底层设计方面的差异意味着其 API " |
| 69 | +"逐渐与 ``optparse`` 的拉开了差距。" |
| 70 | + |
| 71 | +#:../../howto/argparse-optparse.rst:27 |
| 72 | +msgid"" |
| 73 | +"As described in :ref:`choosing-an-argument-parser`, applications that are " |
| 74 | +"currently using :mod:`optparse` and are happy with the way it works can just" |
| 75 | +" continue to use ``optparse``." |
| 76 | +msgstr"" |
| 77 | +"正如 :ref:`choosing-an-argument-parser` 中所描述的,目前使用 :mod:`optparse` " |
| 78 | +"并且对其效果感到满意的应用程序完全可以继续使用 ``optparse``。" |
| 79 | + |
| 80 | +#:../../howto/argparse-optparse.rst:31 |
| 81 | +msgid"" |
| 82 | +"Application developers that are considering migrating should also review the" |
| 83 | +" list of intrinsic behavioural differences described in that section before " |
| 84 | +"deciding whether or not migration is desirable." |
| 85 | +msgstr"考虑迁移的应用程序开发者也应当先仔细查看在该章节中描述的内在行为差异列表再决定是否需要迁移。" |
| 86 | + |
| 87 | +#:../../howto/argparse-optparse.rst:35 |
| 88 | +msgid"" |
| 89 | +"For applications that do choose to migrate from :mod:`optparse` to " |
| 90 | +":mod:`argparse`, the following suggestions should be helpful:" |
| 91 | +msgstr"对于确定选择从 :mod:`optparse` 迁移到 :mod:`argparse` 的应用程序,下列建议应该会有帮助:" |
| 92 | + |
| 93 | +#:../../howto/argparse-optparse.rst:38 |
| 94 | +msgid"" |
| 95 | +"Replace all :meth:`optparse.OptionParser.add_option` calls with " |
| 96 | +":meth:`ArgumentParser.add_argument` calls." |
| 97 | +msgstr"" |
| 98 | +"将所有 :meth:`optparse.OptionParser.add_option` 调用替换为 " |
| 99 | +":meth:`ArgumentParser.add_argument` 调用。" |
| 100 | + |
| 101 | +#:../../howto/argparse-optparse.rst:41 |
| 102 | +msgid"" |
| 103 | +"Replace ``(options, args) = parser.parse_args()`` with ``args = " |
| 104 | +"parser.parse_args()`` and add additional :meth:`ArgumentParser.add_argument`" |
| 105 | +" calls for the positional arguments. Keep in mind that what was previously " |
| 106 | +"called ``options``, now in the :mod:`argparse` context is called ``args``." |
| 107 | +msgstr"" |
| 108 | +"将 ``(options, args) = parser.parse_args()`` 替换为 ``args = " |
| 109 | +"parser.parse_args()`` 并为位置参数添加额外的 :meth:`ArgumentParser.add_argument` 调用。 " |
| 110 | +"请注意之前所谓的 ``options`` 在 :mod:`argparse` 上下文中被称为 ``args``。" |
| 111 | + |
| 112 | +#:../../howto/argparse-optparse.rst:46 |
| 113 | +msgid"" |
| 114 | +"Replace :meth:`optparse.OptionParser.disable_interspersed_args` by using " |
| 115 | +":meth:`~ArgumentParser.parse_intermixed_args` instead of " |
| 116 | +":meth:`~ArgumentParser.parse_args`." |
| 117 | +msgstr"" |
| 118 | +"通过使用 :meth:`~ArgumentParser.parse_intermixed_args` 而非 " |
| 119 | +":meth:`~ArgumentParser.parse_args` 来替换 " |
| 120 | +":meth:`optparse.OptionParser.disable_interspersed_args`。" |
| 121 | + |
| 122 | +#:../../howto/argparse-optparse.rst:50 |
| 123 | +msgid"" |
| 124 | +"Replace callback actions and the ``callback_*`` keyword arguments with " |
| 125 | +"``type`` or ``action`` arguments." |
| 126 | +msgstr"将回调动作和 ``callback_*`` 关键字参数替换为 ``type`` 或 ``action`` 参数。" |
| 127 | + |
| 128 | +#:../../howto/argparse-optparse.rst:53 |
| 129 | +msgid"" |
| 130 | +"Replace string names for ``type`` keyword arguments with the corresponding " |
| 131 | +"type objects (e.g. int, float, complex, etc)." |
| 132 | +msgstr"将 ``type`` 关键字参数字符串名称替换为相应的类型对象(例如 int, float, complex 等)。" |
| 133 | + |
| 134 | +#:../../howto/argparse-optparse.rst:56 |
| 135 | +msgid"" |
| 136 | +"Replace :class:`optparse.Values` with :class:`Namespace` and " |
| 137 | +":exc:`optparse.OptionError` and :exc:`optparse.OptionValueError` with " |
| 138 | +":exc:`ArgumentError`." |
| 139 | +msgstr"" |
| 140 | +"将 :class:`optparse.Values` 替换为 :class:`Namespace` 并将 " |
| 141 | +":exc:`optparse.OptionError` 和 :exc:`optparse.OptionValueError` 替换为 " |
| 142 | +":exc:`ArgumentError`。" |
| 143 | + |
| 144 | +#:../../howto/argparse-optparse.rst:60 |
| 145 | +msgid"" |
| 146 | +"Replace strings with implicit arguments such as ``%default`` or ``%prog`` " |
| 147 | +"with the standard Python syntax to use dictionaries to format strings, that " |
| 148 | +"is, ``%(default)s`` and ``%(prog)s``." |
| 149 | +msgstr"" |
| 150 | +"将隐式参数字符串例如使用标准 Python 字典语法的 ``%default`` 或 ``%prog`` 替换为格式字符串,即 " |
| 151 | +"``%(default)s`` 和 ``%(prog)s``。" |
| 152 | + |
| 153 | +#:../../howto/argparse-optparse.rst:64 |
| 154 | +msgid"" |
| 155 | +"Replace the OptionParser constructor ``version`` argument with a call to " |
| 156 | +"``parser.add_argument('--version', action='version', version='<the " |
| 157 | +"version>')``." |
| 158 | +msgstr"" |
| 159 | +"将 OptionParser 构造器 ``version`` 参数替换为对 ``parser.add_argument('--version', " |
| 160 | +"action='version', version='<the version>')`` 的调用。" |