Skip to content

Commit 1b8172b

Browse files
eamanujdetrey
authored andcommitted
pythongh-77956: Add the words 'default' and 'version' help text localizable (pythonGH-12711)
Co-authored-by: paul.j3 Co-authored-by: Jérémie Detrey <[email protected]>
1 parent ee0093c commit 1b8172b

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
@@ -708,7 +708,7 @@ def _get_help_string(self, action):
708708
if action.default is not SUPPRESS:
709709
defaulting_nargs = [OPTIONAL, ZERO_OR_MORE]
710710
if action.option_strings or action.nargs in defaulting_nargs:
711-
help += ' (default: %(default)s)'
711+
help += _(' (default: %(default)s)')
712712
return help
713713

714714

@@ -1159,8 +1159,10 @@ def __init__(self,
11591159
version=None,
11601160
dest=SUPPRESS,
11611161
default=SUPPRESS,
1162-
help="show program's version number and exit",
1162+
help=None,
11631163
deprecated=False):
1164+
if help is None:
1165+
help = _("show program's version number and exit")
11641166
super(_VersionAction, self).__init__(
11651167
option_strings=option_strings,
11661168
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)