You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
argparse: the word 'default' (in help) is not marked as translatable #77956
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2018-06-05.22:12:35.905>labels= ['type-bug', '3.8', '3.9', '3.10', '3.11', '3.7', 'library']
title="argparse: the word 'default' (in help) is not marked as translatable"updated_at=<Date2021-08-08.14:13:35.843>user='https://bugs.python.org/woutgg'
The word 'default', used to indicate default arguments in the help text (found here: Lib/argparse.py:681) is missing the gettext wrapper, causing it to be untranslatable.
Note: the line number in the link is not correct anymore, I'm not sure how to link to a specific commit so here is the source line: help += ' (default: %(default)s)'.
I haven't paid much attention to the localization issues in argparse.
The issue is with the help modification done by the:
class ArgumentDefaultsHelpFormatter
help += ' (default: %(default)s)'
This formatter is a convenience, not something critical. The programmer could always include that 'default' string in the help line with their preferred terminology. They don't have to use this formatter to show the default values in their help lines.
_() is used mostly for error messages with the format
msg=_('message %(value)s')
raiseError( msg%args)
So the following change might work:
help += _(' (default: %(default)s)')
But I'm not in a position to test it or evaluate its usefulness.
Activity
woutgg commentedon Jun 5, 2018
The word 'default', used to indicate default arguments in the help text (found here: Lib/argparse.py:681) is missing the gettext wrapper, causing it to be untranslatable.
woutgg commentedon Jun 5, 2018
Note: the line number in the link is not correct anymore, I'm not sure how to link to a specific commit so here is the source line:
help += ' (default: %(default)s)'.tirkarthi commentedon Apr 6, 2019
@paul.j3 I assume this is an easy issue of wrapping "default" with _() at [0]. There doesn't seem to be any tests for localization in argparse.
cpython/Lib/argparse.py
Line 682 in 2ea8099
paulj3 commentedon Apr 6, 2019
I haven't paid much attention to the localization issues in
argparse.The issue is with the help modification done by the:
class ArgumentDefaultsHelpFormatter
This formatter is a convenience, not something critical. The programmer could always include that 'default' string in the help line with their preferred terminology. They don't have to use this formatter to show the default values in their help lines.
_() is used mostly for error messages with the format
So the following change might work:
But I'm not in a position to test it or evaluate its usefulness.
paulj3 commentedon Apr 6, 2019
https://bugs.python.org/issue16786
points out that the 'version' action isn't localizable either.
4 remaining items
gh-77956: Add the words 'default' and 'version' help text localizable (…
[3.12] pythongh-77956: Add the words 'default' and 'version' help tex…
[3.11] pythongh-77956: Add the words 'default' and 'version' help tex…
[3.12] gh-77956: Add the words 'default' and 'version' help text loca…
[3.11] gh-77956: Add the words 'default' and 'version' help text loca…
pythongh-77956: Add the words 'default' and 'version' help text local…
pythongh-77956: Add the words 'default' and 'version' help text local…
pythongh-77956: Add the words 'default' and 'version' help text local…
pythongh-77956: Add the words 'default' and 'version' help text local…