https://github.com/python/cpython/commit/f8a6a1c5c34a82181e26827e336c4005adb1e22c commit: f8a6a1c5c34a82181e26827e336c4005adb1e22c branch: 3.11 author: Serhiy Storchaka <[email protected]> committer: serhiy-storchaka <[email protected]> date: 2024-02-26T21:36:57Z summary:
[3.11] gh-77956: Add the words 'default' and 'version' help text localizable (GH-12711) (GH-115968) (cherry picked from commit da382aaf52d761a037874bee27bb5db69906df9e) Co-authored-by: paul.j3 Co-authored-by: Emmanuel Arias <[email protected]> Co-authored-by: Jérémie Detrey <[email protected]> files: A Misc/NEWS.d/next/Library/2019-04-06-23-50-59.bpo-33775.0yhMDc.rst M Lib/argparse.py diff --git a/Lib/argparse.py b/Lib/argparse.py index 57e6619a8c38d0..a6ff3122da531a 100644 --- a/Lib/argparse.py +++ b/Lib/argparse.py @@ -721,7 +721,7 @@ def _get_help_string(self, action): 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 @@ -1129,7 +1129,9 @@ def __init__(self, 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 00000000000000..2a663ac7940dcb --- /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. _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: [email protected]
