-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
bpo-44864: Do not translate user-provided strings in ArgumentParser.add_subparsers()
#27667
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…add_subparsers()` Call `_()` on `argparse`-provided strings only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ran 1670 tests in 8.544s
OK
Looks ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a behaviour change and, as such, requires a unit test to cover it.
If there are no tests for translations in argparse, those should be added and possibly we need to go over what does and what doesn't need to be translated.
CC @terryjreedy
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase And if you don't make the requested changes, you will be poked with soft cushions! |
I agree that this needs tests -- at least very specific ones for the changed cases. The change itself is correct: argparse-provided strings should be translated, user-provided ones should not. The translation function ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
There are no currently any tests for gettext in argparse, and adding them requires a lot of effort. I do not think that this should be a blocker for this bugfix. You can open a new issue for adding tests for gettext in argparse.
@iritkatriel, @encukou, are you fine with merging this PR without tests and creating a separate issue for adding tests for argparse+gettext? |
Sure. |
Opened #124432. |
Yes, I'm fine with that. |
BTW, |
Thanks @jdetrey for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12. |
Thanks @jdetrey for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
…dd_subparsers() (pythonGH-27667) Call _() on literal strings only. (cherry picked from commit d3c76df) Co-authored-by: Jérémie Detrey <[email protected]>
GH-124505 is a backport of this pull request to the 3.12 branch. |
…dd_subparsers() (pythonGH-27667) Call _() on literal strings only. (cherry picked from commit d3c76df) Co-authored-by: Jérémie Detrey <[email protected]>
GH-124506 is a backport of this pull request to the 3.13 branch. |
…arser.add_subparsers() (GH-27667) (GH-124505) Call _() on literal strings only. (cherry picked from commit d3c76df) Co-authored-by: Jérémie Detrey <[email protected]>
Call
_()
onargparse
-provided strings only.https://bugs.python.org/issue44864