Skip to content

Commit

Permalink
sync with cpython aea2e03b
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwang44 committed Dec 29, 2024
1 parent 4f92e39 commit 3a7839f
Show file tree
Hide file tree
Showing 12 changed files with 2,677 additions and 2,265 deletions.
173 changes: 87 additions & 86 deletions c-api/object.po

Large diffs are not rendered by default.

81 changes: 49 additions & 32 deletions howto/argparse-optparse.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Python 3.13\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-09 00:13+0000\n"
"POT-Creation-Date: 2024-12-29 18:06+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
Expand All @@ -16,101 +16,118 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: ../../howto/argparse-optparse.rst:7
msgid "Upgrading optparse code"
#: ../../howto/argparse-optparse.rst:8
#, fuzzy
msgid "Migrating ``optparse`` code to ``argparse``"
msgstr "升級 optparse 程式碼"

#: ../../howto/argparse-optparse.rst:9
msgid ""
"Originally, the :mod:`argparse` module had attempted to maintain "
"compatibility with :mod:`optparse`. However, :mod:`optparse` was difficult "
"to extend transparently, particularly with the changes required to support "
"``nargs=`` specifiers and better usage messages. When most everything in :"
"mod:`optparse` had either been copy-pasted over or monkey-patched, it no "
"longer seemed practical to try to maintain the backwards compatibility."
msgstr ""

#: ../../howto/argparse-optparse.rst:16
#: ../../howto/argparse-optparse.rst:10
msgid ""
"The :mod:`argparse` module improves on the :mod:`optparse` module in a "
"number of ways including:"
"The :mod:`argparse` module offers several higher level features not natively "
"provided by the :mod:`optparse` module, including:"
msgstr ""

#: ../../howto/argparse-optparse.rst:19
#: ../../howto/argparse-optparse.rst:13
msgid "Handling positional arguments."
msgstr ""

#: ../../howto/argparse-optparse.rst:20
#: ../../howto/argparse-optparse.rst:14
msgid "Supporting subcommands."
msgstr ""

#: ../../howto/argparse-optparse.rst:21
#: ../../howto/argparse-optparse.rst:15
msgid "Allowing alternative option prefixes like ``+`` and ``/``."
msgstr ""

#: ../../howto/argparse-optparse.rst:22
#: ../../howto/argparse-optparse.rst:16
msgid "Handling zero-or-more and one-or-more style arguments."
msgstr ""

#: ../../howto/argparse-optparse.rst:23
#: ../../howto/argparse-optparse.rst:17
msgid "Producing more informative usage messages."
msgstr ""

#: ../../howto/argparse-optparse.rst:24
#: ../../howto/argparse-optparse.rst:18
msgid "Providing a much simpler interface for custom ``type`` and ``action``."
msgstr ""

#: ../../howto/argparse-optparse.rst:26
msgid "A partial upgrade path from :mod:`optparse` to :mod:`argparse`:"
#: ../../howto/argparse-optparse.rst:20
msgid ""
"Originally, the :mod:`argparse` module attempted to maintain compatibility "
"with :mod:`optparse`. However, the fundamental design differences between "
"supporting declarative command line option processing (while leaving "
"positional argument processing to application code), and supporting both "
"named options and positional arguments in the declarative interface mean "
"that the API has diverged from that of ``optparse`` over time."
msgstr ""

#: ../../howto/argparse-optparse.rst:27
msgid ""
"As described in :ref:`choosing-an-argument-parser`, applications that are "
"currently using :mod:`optparse` and are happy with the way it works can just "
"continue to use ``optparse``."
msgstr ""

#: ../../howto/argparse-optparse.rst:31
msgid ""
"Application developers that are considering migrating should also review the "
"list of intrinsic behavioural differences described in that section before "
"deciding whether or not migration is desirable."
msgstr ""

#: ../../howto/argparse-optparse.rst:35
msgid ""
"For applications that do choose to migrate from :mod:`optparse` to :mod:"
"`argparse`, the following suggestions should be helpful:"
msgstr ""

#: ../../howto/argparse-optparse.rst:28
#: ../../howto/argparse-optparse.rst:38
msgid ""
"Replace all :meth:`optparse.OptionParser.add_option` calls with :meth:"
"`ArgumentParser.add_argument` calls."
msgstr ""

#: ../../howto/argparse-optparse.rst:31
#: ../../howto/argparse-optparse.rst:41
msgid ""
"Replace ``(options, args) = parser.parse_args()`` with ``args = parser."
"parse_args()`` and add additional :meth:`ArgumentParser.add_argument` calls "
"for the positional arguments. Keep in mind that what was previously called "
"``options``, now in the :mod:`argparse` context is called ``args``."
msgstr ""

#: ../../howto/argparse-optparse.rst:36
#: ../../howto/argparse-optparse.rst:46
msgid ""
"Replace :meth:`optparse.OptionParser.disable_interspersed_args` by using :"
"meth:`~ArgumentParser.parse_intermixed_args` instead of :meth:"
"`~ArgumentParser.parse_args`."
msgstr ""

#: ../../howto/argparse-optparse.rst:40
#: ../../howto/argparse-optparse.rst:50
msgid ""
"Replace callback actions and the ``callback_*`` keyword arguments with "
"``type`` or ``action`` arguments."
msgstr ""

#: ../../howto/argparse-optparse.rst:43
#: ../../howto/argparse-optparse.rst:53
msgid ""
"Replace string names for ``type`` keyword arguments with the corresponding "
"type objects (e.g. int, float, complex, etc)."
msgstr ""

#: ../../howto/argparse-optparse.rst:46
#: ../../howto/argparse-optparse.rst:56
msgid ""
"Replace :class:`optparse.Values` with :class:`Namespace` and :exc:`optparse."
"OptionError` and :exc:`optparse.OptionValueError` with :exc:`ArgumentError`."
msgstr ""

#: ../../howto/argparse-optparse.rst:50
#: ../../howto/argparse-optparse.rst:60
msgid ""
"Replace strings with implicit arguments such as ``%default`` or ``%prog`` "
"with the standard Python syntax to use dictionaries to format strings, that "
"is, ``%(default)s`` and ``%(prog)s``."
msgstr ""

#: ../../howto/argparse-optparse.rst:54
#: ../../howto/argparse-optparse.rst:64
msgid ""
"Replace the OptionParser constructor ``version`` argument with a call to "
"``parser.add_argument('--version', action='version', version='<the "
Expand Down
Loading

0 comments on commit 3a7839f

Please sign in to comment.