Skip to content

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

Closed

Description

@woutgg
mannequin
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

    Activity

    1. woutgg commented on Jun 5, 2018

      woutggmannequin
      MannequinAuthor

      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.

    2. added
      type-bugAn unexpected behavior, bug, or error
      on Jun 5, 2018
    3. woutgg commented on Jun 5, 2018

      woutggmannequin
      MannequinAuthor

      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)'.

    4. tirkarthi commented on Apr 6, 2019

      @tirkarthi
      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)'

    5. added
      stdlibStandard Library Python modules in the Lib/ directory
      on Apr 6, 2019
    6. paulj3 commented on Apr 6, 2019

      paulj3mannequin
      Mannequin

      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.

    7. paulj3 commented on Apr 6, 2019

      paulj3mannequin
      Mannequin

      https://bugs.python.org/issue16786

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

    8. transferred this issue fromon Apr 10, 2022
    9. 4 remaining items

    10. added
      3.12only security fixes
      3.13only security fixes
      and removed on Feb 26, 2024
    11. added 3 commits that reference this issue on Feb 26, 2024
    12. moved this from Bugs to Doc issues in Argparse issueson Feb 26, 2024
    13. added 2 commits that reference this issue on Feb 26, 2024
    14. added a commit that references this issue on Mar 4, 2024
    15. added a commit that references this issue on Mar 25, 2024
    16. added a commit that references this issue on Apr 17, 2024
    17. added a commit that references this issue on Jan 22, 2025
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.11only security fixes3.12only security fixes3.13only security fixesstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

      Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions