Skip to content

Commit f0c194a

Browse files
serhiy-storchakaeamanujdetrey
authored
[3.12] gh-77956: Add the words 'default' and 'version' help text localizable (GH-12711) (GH-115967)
(cherry picked from commit da382aa) Co-authored-by: paul.j3 Co-authored-by: Emmanuel Arias <[email protected]> Co-authored-by: Jérémie Detrey <[email protected]>
1 parent 7b91b90 commit f0c194a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Lib/argparse.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ def _get_help_string(self, action):
722722
if action.default is not SUPPRESS:
723723
defaulting_nargs = [OPTIONAL, ZERO_OR_MORE]
724724
if action.option_strings or action.nargs in defaulting_nargs:
725-
help += ' (default: %(default)s)'
725+
help += _(' (default: %(default)s)')
726726
return help
727727

728728

@@ -1151,7 +1151,9 @@ def __init__(self,
11511151
version=None,
11521152
dest=SUPPRESS,
11531153
default=SUPPRESS,
1154-
help="show program's version number and exit"):
1154+
help=None):
1155+
if help is None:
1156+
help = _("show program's version number and exit")
11551157
super(_VersionAction, self).__init__(
11561158
option_strings=option_strings,
11571159
dest=dest,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add 'default' and 'version' help text for localization in argparse.

0 commit comments

Comments
 (0)