From: Serhiy Storchaka Date: Mon, 26 Feb 2024 21:11:27 +0000 (+0200) Subject: [3.12] gh-77956: Add the words 'default' and 'version' help text localizable (GH... X-Git-Tag: v3.12.3~196 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f0c194ad156f7b8056f23ca3ce60d580f19537d7;p=thirdparty%2FPython%2Fcpython.git [3.12] gh-77956: Add the words 'default' and 'version' help text localizable (GH-12711) (GH-115967) (cherry picked from commit da382aaf52d761a037874bee27bb5db69906df9e) Co-authored-by: paul.j3 Co-authored-by: Emmanuel Arias Co-authored-by: Jérémie Detrey --- diff --git a/Lib/argparse.py b/Lib/argparse.py index 4d6b31aaef64..f23e2a4611b2 100644 --- a/Lib/argparse.py +++ b/Lib/argparse.py @@ -722,7 +722,7 @@ class ArgumentDefaultsHelpFormatter(HelpFormatter): if action.default is not SUPPRESS: defaulting_nargs = [OPTIONAL, ZERO_OR_MORE] if action.option_strings or action.nargs in defaulting_nargs: - help += ' (default: %(default)s)' + help += _(' (default: %(default)s)') return help @@ -1151,7 +1151,9 @@ class _VersionAction(Action): version=None, dest=SUPPRESS, default=SUPPRESS, - help="show program's version number and exit"): + help=None): + if help is None: + help = _("show program's version number and exit") super(_VersionAction, self).__init__( option_strings=option_strings, dest=dest, diff --git a/Misc/NEWS.d/next/Library/2019-04-06-23-50-59.bpo-33775.0yhMDc.rst b/Misc/NEWS.d/next/Library/2019-04-06-23-50-59.bpo-33775.0yhMDc.rst new file mode 100644 index 000000000000..2a663ac7940d --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-04-06-23-50-59.bpo-33775.0yhMDc.rst @@ -0,0 +1 @@ +Add 'default' and 'version' help text for localization in argparse.