Skip to content
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

bpo-39464: Allow translating argument error messages #17169

Merged
merged 1 commit into from
May 5, 2022

Conversation

DjMorgul
Copy link
Contributor

@DjMorgul DjMorgul commented Nov 15, 2019

Argument error messages display the untranslatable text 'argument ', which should be translatable to other languages, just like it's possible to do with the rest of the constructed error message.

https://bugs.python.org/issue39464

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

Recognized GitHub username

We couldn't find a bugs.python.org (b.p.o) account corresponding to the following GitHub usernames:

@DjMorgul

This might be simply due to a missing "GitHub Name" entry in one's b.p.o account settings. This is necessary for legal reasons before we can look at this contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

@brandtbucher
Copy link
Member

Thanks for your time @DjMorgul, and welcome to CPython! 😎

I assume that you've seen the bot's message about the CLA?

Copy link
Member

@brandtbucher brandtbucher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is necessary... we don't internationalize any other exception messages in this file.

If this exception is raised during parsing, it is printed by calling ArgumentParser.error, which performs this step already (see the last line of the file).

It would be great if you could open a BPO issue for discussion.

@DjMorgul
Copy link
Contributor Author

This message isn't used (only?) in exceptions... it's a message that is given to the console, to notify the user when she didn't provide correct parameters. For example:

$ python3 ./drt.py -l
Uso: ./drt.py [-h] [-l LONG_MIN] [-L LONG_MAX] [-v] [-V]
              entrada.json [salida.tok]
./drt.py: error: argument -l/--min-length: se esperaba un parámetro

These are console messages localized into Spanish. The "error:" part is translatable, but it's the same word in Spanish than in English. The "argument" part is what isn't translatable, and it's taken from this "exception".

I confirmed that my proposed patch, translating that particular string, allows giving a fully localized console output to the user in Spanish, such as:

./drt.py: error: parámetro -l/--min-length: se esperaba un parámetro

@taleinat
Copy link
Contributor

@DjMorgul, the place to discuss this is on our issue tracker. Please create an issue on bugs.python.org, as suggested above by @brandtbucher.

@csabella
Copy link
Contributor

@DjMorgul, did you have a chance to open an issue on the bug tracker as requested by @taleinat? If so, please update the PR title with the format bpo-xxxxx: for the tracker number. Thanks!

@DjMorgul DjMorgul changed the title Allow translating argument error messages Allow translating argument error messages bpo-39464 Jan 27, 2020
@DjMorgul
Copy link
Contributor Author

I just created the issue on bugs.python.org, and I updated the title of this pull request accordingly.

@csabella csabella changed the title Allow translating argument error messages bpo-39464 bpo-39464: Allow translating argument error messages May 28, 2020
@csabella csabella requested a review from rhettinger May 28, 2020 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news type-feature A feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants