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

Allow translating argparse error messages #83645

Open
DjMorgul mannequin opened this issue Jan 27, 2020 · 4 comments
Open

Allow translating argparse error messages #83645

DjMorgul mannequin opened this issue Jan 27, 2020 · 4 comments
Labels
3.9 only security fixes 3.10 only security fixes 3.11 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@DjMorgul
Copy link
Mannequin

DjMorgul mannequin commented Jan 27, 2020

BPO 39464
Nosy @rhettinger, @shihai1991, @DjMorgul, @iritkatriel
PRs
  • bpo-39464: Allow translating argument error messages  #17169
  • 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 = None
    closed_at = None
    created_at = <Date 2020-01-27.13:55:37.792>
    labels = ['type-feature', 'library', '3.9', '3.10', '3.11']
    title = 'Allow translating argparse error messages'
    updated_at = <Date 2021-12-14.16:22:47.266>
    user = 'https://github.com/DjMorgul'

    bugs.python.org fields:

    activity = <Date 2021-12-14.16:22:47.266>
    actor = 'iritkatriel'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2020-01-27.13:55:37.792>
    creator = 'DjMorgul'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 39464
    keywords = []
    message_count = 4.0
    messages = ['360764', '361156', '361157', '408545']
    nosy_count = 5.0
    nosy_names = ['rhettinger', 'paul.j3', 'shihai1991', 'DjMorgul', 'iritkatriel']
    pr_nums = ['17169']
    priority = 'normal'
    resolution = None
    stage = None
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue39464'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    @DjMorgul
    Copy link
    Mannequin Author

    DjMorgul mannequin commented Jan 27, 2020

    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.

    @DjMorgul DjMorgul mannequin added 3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Jan 27, 2020
    @tirkarthi tirkarthi removed 3.7 (EOL) end of life 3.8 only security fixes labels Jan 27, 2020
    @tirkarthi tirkarthi changed the title Allow translating argument error messages Allow translating argparse error messages Jan 27, 2020
    @tirkarthi tirkarthi changed the title Allow translating argument error messages Allow translating argparse error messages Jan 27, 2020
    @shihai1991
    Copy link
    Member

    Paste José's comment from PR17169:

    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

    @shihai1991
    Copy link
    Member

    Users interact with console's output, so translated the output info is fine to me.
    Hi,raymond、paul. What's your opinion?

    @iritkatriel
    Copy link
    Member

    Closed bpo-26726 as duplicate of this.

    @iritkatriel iritkatriel added 3.10 only security fixes 3.11 only security fixes labels Dec 14, 2021
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes 3.10 only security fixes 3.11 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    Status: Features
    Development

    No branches or pull requests

    3 participants