]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-77956: Add the words 'default' and 'version' help text localizable (GH...
authorSerhiy Storchaka <storchaka@gmail.com>
Mon, 26 Feb 2024 21:36:57 +0000 (23:36 +0200)
committerGitHub <noreply@github.com>
Mon, 26 Feb 2024 21:36:57 +0000 (21:36 +0000)
(cherry picked from commit da382aaf52d761a037874bee27bb5db69906df9e)

Co-authored-by: paul.j3
Co-authored-by: Emmanuel Arias <eamanu@yaerobi.com>
Co-authored-by: Jérémie Detrey <jdetrey@users.noreply.github.com>
Lib/argparse.py
Misc/NEWS.d/next/Library/2019-04-06-23-50-59.bpo-33775.0yhMDc.rst [new file with mode: 0644]

index 57e6619a8c38d050a2b97d0ca42f39b2a0fa19ca..a6ff3122da531a63f24c1aa6a51b1c62c8ab59d0 100644 (file)
@@ -721,7 +721,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
 
 
@@ -1129,7 +1129,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 (file)
index 0000000..2a663ac
--- /dev/null
@@ -0,0 +1 @@
+Add 'default' and 'version' help text for localization in argparse.