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

argparse: the word 'default' (in help) is not marked as translatable #77956

Closed
woutgg mannequin opened this issue Jun 5, 2018 · 5 comments
Closed

argparse: the word 'default' (in help) is not marked as translatable #77956

woutgg mannequin opened this issue Jun 5, 2018 · 5 comments
Labels
3.11 only security fixes 3.12 bugs and security fixes 3.13 bugs and security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@woutgg
Copy link
Mannequin

woutgg mannequin commented Jun 5, 2018

BPO 33775
Nosy @tirkarthi
PRs
  • gh-77956: Add the words 'default' and 'version' help text localizable #12711
  • 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 2018-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 = <Date 2021-08-08.14:13:35.843>
    user = 'https://bugs.python.org/woutgg'

    bugs.python.org fields:

    activity = <Date 2021-08-08.14:13:35.843>
    actor = 'jdetrey'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2018-06-05.22:12:35.905>
    creator = 'woutgg'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 33775
    keywords = ['patch']
    message_count = 5.0
    messages = ['318784', '318787', '339543', '339547', '339549']
    nosy_count = 3.0
    nosy_names = ['paul.j3', 'woutgg', 'xtreak']
    pr_nums = ['12711']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue33775'
    versions = ['Python 3.6', 'Python 3.7', 'Python 3.8', 'Python 3.9', 'Python 3.10', 'Python 3.11']

    Linked PRs

    @woutgg
    Copy link
    Mannequin Author

    woutgg mannequin commented 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 woutgg mannequin added the type-bug An unexpected behavior, bug, or error label Jun 5, 2018
    @woutgg
    Copy link
    Mannequin Author

    woutgg mannequin commented 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
    Copy link
    Member

    @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.

    help += ' (default: %(default)s)'

    @tirkarthi tirkarthi added stdlib Python modules in the Lib dir 3.8 only security fixes labels Apr 6, 2019
    @paulj3
    Copy link
    Mannequin

    paulj3 mannequin commented 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

    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')
        raise Error( 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.

    @paulj3
    Copy link
    Mannequin

    paulj3 mannequin commented Apr 6, 2019

    https://bugs.python.org/issue16786

    points out that the 'version' action isn't localizable either.

    @jdetrey jdetrey mannequin added 3.7 (EOL) end of life 3.9 only security fixes 3.10 only security fixes 3.11 only security fixes labels Aug 8, 2021
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @serhiy-storchaka serhiy-storchaka added 3.12 bugs and security fixes 3.13 bugs and security fixes and removed 3.10 only security fixes 3.9 only security fixes 3.8 only security fixes 3.7 (EOL) end of life labels Feb 26, 2024
    serhiy-storchaka pushed a commit that referenced this issue Feb 26, 2024
    …GH-12711)
    
    Co-authored-by: paul.j3
    Co-authored-by: Jérémie Detrey <jdetrey@users.noreply.github.com>
    serhiy-storchaka pushed a commit to serhiy-storchaka/cpython that referenced this issue Feb 26, 2024
    …t localizable (pythonGH-12711)
    
    (cherry picked from commit da382aa)
    
    Co-authored-by: Emmanuel Arias <eamanu@yaerobi.com>
    Co-authored-by: paul.j3
    Co-authored-by: Jérémie Detrey <jdetrey@users.noreply.github.com>
    serhiy-storchaka pushed a commit to serhiy-storchaka/cpython that referenced this issue Feb 26, 2024
    …t localizable (pythonGH-12711)
    
    (cherry picked from commit da382aa)
    
    Co-authored-by: Emmanuel Arias <eamanu@yaerobi.com>
    Co-authored-by: paul.j3
    Co-authored-by: Jérémie Detrey <jdetrey@users.noreply.github.com>
    serhiy-storchaka added a commit that referenced this issue Feb 26, 2024
    …lizable (GH-12711) (GH-115967)
    
    (cherry picked from commit da382aa)
    
    Co-authored-by: paul.j3
    Co-authored-by: Emmanuel Arias <eamanu@yaerobi.com>
    Co-authored-by: Jérémie Detrey <jdetrey@users.noreply.github.com>
    serhiy-storchaka added a commit that referenced this issue Feb 26, 2024
    …lizable (GH-12711) (GH-115968)
    
    (cherry picked from commit da382aa)
    
    Co-authored-by: paul.j3
    Co-authored-by: Emmanuel Arias <eamanu@yaerobi.com>
    Co-authored-by: Jérémie Detrey <jdetrey@users.noreply.github.com>
    woodruffw pushed a commit to woodruffw-forks/cpython that referenced this issue Mar 4, 2024
    …izable (pythonGH-12711)
    
    Co-authored-by: paul.j3
    Co-authored-by: Jérémie Detrey <jdetrey@users.noreply.github.com>
    adorilson pushed a commit to adorilson/cpython that referenced this issue Mar 25, 2024
    …izable (pythonGH-12711)
    
    Co-authored-by: paul.j3
    Co-authored-by: Jérémie Detrey <jdetrey@users.noreply.github.com>
    diegorusso pushed a commit to diegorusso/cpython that referenced this issue Apr 17, 2024
    …izable (pythonGH-12711)
    
    Co-authored-by: paul.j3
    Co-authored-by: Jérémie Detrey <jdetrey@users.noreply.github.com>
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.11 only security fixes 3.12 bugs and security fixes 3.13 bugs and security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    Status: Doc issues
    Development

    No branches or pull requests

    2 participants