Skip to content

Commit f8a6a1c

Browse files
serhiy-storchakaeamanujdetrey
authored
[3.11] gh-77956: Add the words 'default' and 'version' help text localizable (GH-12711) (GH-115968)
(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 46f821d commit f8a6a1c

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
@@ -721,7 +721,7 @@ def _get_help_string(self, action):
721721
if action.default is not SUPPRESS:
722722
defaulting_nargs = [OPTIONAL, ZERO_OR_MORE]
723723
if action.option_strings or action.nargs in defaulting_nargs:
724-
help += ' (default: %(default)s)'
724+
help += _(' (default: %(default)s)')
725725
return help
726726

727727

@@ -1129,7 +1129,9 @@ def __init__(self,
11291129
version=None,
11301130
dest=SUPPRESS,
11311131
default=SUPPRESS,
1132-
help="show program's version number and exit"):
1132+
help=None):
1133+
if help is None:
1134+
help = _("show program's version number and exit")
11331135
super(_VersionAction, self).__init__(
11341136
option_strings=option_strings,
11351137
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)