]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-77956: Add the words 'default' and 'version' help text localizable (GH-12711)
authorEmmanuel Arias <eamanu@yaerobi.com>
Mon, 26 Feb 2024 19:20:39 +0000 (16:20 -0300)
committerGitHub <noreply@github.com>
Mon, 26 Feb 2024 19:20:39 +0000 (19:20 +0000)
Co-authored-by: paul.j3
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 f86658baf7f2bac8294ed415b8c20be66badc51d..c16f538ae1535a11829d076b82412e03a92f4f8d 100644 (file)
@@ -708,7 +708,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
 
 
@@ -1159,8 +1159,10 @@ class _VersionAction(Action):
                  version=None,
                  dest=SUPPRESS,
                  default=SUPPRESS,
-                 help="show program's version number and exit",
+                 help=None,
                  deprecated=False):
+        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.