Skip to content

argparse uses %s in gettext calls causing xgettext warnings #81966

Closed

Description

@kulikjak
mannequin
BPO 37785
Nosy @merwok, @serhiy-storchaka, @JulienPalard, @CuriousLearner, @miss-islington, @kulikjak
PRs
  • bpo-37785: argparse uses %s in gettext calls causing xgettext warnings #15161
  • [3.8] bpo-37785: Fix xgettext warning in argparse (GH-15161) #16080
  • [3.7] bpo-37785: Fix xgettext warning in argparse (GH-15161) #16081
  • [3.7] Revert "bpo-37785: Fix xgettext warning in argparse (GH-15161)" #16082
  • 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 = <Date 2019-09-13.10:33:59.348>
    created_at = <Date 2019-08-07.12:49:16.176>
    labels = ['3.7', '3.8', 'type-bug', 'library', '3.9']
    title = 'argparse uses %s in gettext calls causing xgettext warnings'
    updated_at = <Date 2019-09-13.10:33:59.348>
    user = 'https://github.com/kulikjak'

    bugs.python.org fields:

    activity = <Date 2019-09-13.10:33:59.348>
    actor = 'mdk'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-09-13.10:33:59.348>
    closer = 'mdk'
    components = ['Library (Lib)']
    creation = <Date 2019-08-07.12:49:16.176>
    creator = 'kulikjak'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 37785
    keywords = ['patch']
    message_count = 12.0
    messages = ['349166', '349305', '349445', '349449', '352251', '352256', '352263', '352267', '352272', '352274', '352275', '352279']
    nosy_count = 8.0
    nosy_names = ['bethard', 'eric.araujo', 'paul.j3', 'serhiy.storchaka', 'mdk', 'CuriousLearner', 'miss-islington', 'kulikjak']
    pr_nums = ['15161', '16080', '16081', '16082']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue37785'
    versions = ['Python 3.7', 'Python 3.8', 'Python 3.9']

    Activity

    1. kulikjak commented on Aug 7, 2019

      kulikjakmannequin
      MannequinAuthor

      Running xgettext on argparse.py (of any currently supported Python 3.x) return following warning:

      ./Lib/argparse.py: warning: 'msgid' format string with unnamed arguments cannot be properly localized: The translator cannot reorder the arguments. Please consider using a format string with named arguments, and a mapping instead of a tuple for the arguments.

      Same problem was already partially fixed here: https://bugs.python.org/issue10528. I guess that this occurrence was either missed or is new since.

      It would be nice to have this backported to all supported releases but considering incompatibility worries in issue linked above, it may be fixed only in 3.8+ (which is still nice).

    2. added
      3.7 (EOL)
      3.8 (EOL)
      3.9 (EOL)
      stdlib
      on Aug 7, 2019
    3. changed the title [-]argparse uses %s in gettext calls[/-] [+]argparse uses %s in gettext calls causing xgettext warnings[/+] on Aug 7, 2019
    4. CuriousLearner commented on Aug 9, 2019

      @CuriousLearner
      Member

      Hi Jakub,

      Welcome and thank you for contributing. I've added a suggestion on your pull request.

      Python 3.6 and Python 3.5 are in security fixes stage, so I've removed those tags from this bug.

    5. added
      type-bug
      on Aug 9, 2019
    6. kulikjak commented on Aug 12, 2019

      kulikjakmannequin
      MannequinAuthor

      Thanks,

      I see; this is not a change for security only stage. I merged your suggestion.

    7. CuriousLearner commented on Aug 12, 2019

      @CuriousLearner
      Member

      Hi Eric,

      This is with reference to https://bugs.python.org/issue10528.

      I've looked at the PR and it's ready for a core-review: #15161

      Can you please take a look at this?

      Many thanks!

    8. JulienPalard commented on Sep 13, 2019

      @JulienPalard
      Member

      New changeset 42671ae by Julien Palard (Jakub Kulík) in branch 'master':
      bpo-37785: Fix xgettext warning in argparse (GH-15161)
      42671ae

    9. serhiy-storchaka commented on Sep 13, 2019

      @serhiy-storchaka
      Member

      It is a backward incompatible change. It will break existing translations. It should not be backported.

    10. miss-islington commented on Sep 13, 2019

      @miss-islington
      Contributor

      New changeset b50eff6 by Miss Islington (bot) in branch '3.7':
      bpo-37785: Fix xgettext warning in argparse (GH-15161)
      b50eff6

    11. miss-islington commented on Sep 13, 2019

      @miss-islington
      Contributor

      New changeset 8750dfe by Miss Islington (bot) in branch '3.8':
      bpo-37785: Fix xgettext warning in argparse (GH-15161)
      8750dfe

    12. serhiy-storchaka commented on Sep 13, 2019

      @serhiy-storchaka
      Member

      I think it would be safer to revert changes in maintained versions. At least in 3.7.

    13. JulienPalard commented on Sep 13, 2019

      @JulienPalard
      Member

      OK to revert in 3.7, got your point.

    14. JulienPalard commented on Sep 13, 2019

      @JulienPalard
      Member

      Thanks for noticing Serhiy!

    15. JulienPalard commented on Sep 13, 2019

      @JulienPalard
      Member

      New changeset f14fcbf by Julien Palard in branch '3.7':
      Revert "bpo-37785: Fix xgettext warning in argparse (GH-15161)" (GH-16082)
      f14fcbf

    16. transferred this issue fromon Apr 10, 2022
    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.7 (EOL)3.8 (EOL)3.9 (EOL)stdlibtype-bug

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions