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 uses %s in gettext calls causing xgettext warnings #81966

Closed
kulikjak mannequin opened this issue Aug 7, 2019 · 12 comments
Closed

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

kulikjak mannequin opened this issue Aug 7, 2019 · 12 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@kulikjak
Copy link
Mannequin

kulikjak mannequin commented Aug 7, 2019

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']

    @kulikjak
    Copy link
    Mannequin Author

    kulikjak mannequin commented Aug 7, 2019

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

    @kulikjak kulikjak 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 labels Aug 7, 2019
    @kulikjak kulikjak mannequin changed the title argparse uses %s in gettext calls argparse uses %s in gettext calls causing xgettext warnings Aug 7, 2019
    @CuriousLearner
    Copy link
    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.

    @CuriousLearner CuriousLearner added the type-bug An unexpected behavior, bug, or error label Aug 9, 2019
    @kulikjak
    Copy link
    Mannequin Author

    kulikjak mannequin commented Aug 12, 2019

    Thanks,

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

    @CuriousLearner
    Copy link
    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!

    @JulienPalard
    Copy link
    Member

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

    @serhiy-storchaka
    Copy link
    Member

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

    @miss-islington
    Copy link
    Contributor

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

    @miss-islington
    Copy link
    Contributor

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

    @serhiy-storchaka
    Copy link
    Member

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

    @JulienPalard
    Copy link
    Member

    OK to revert in 3.7, got your point.

    @JulienPalard
    Copy link
    Member

    Thanks for noticing Serhiy!

    @JulienPalard
    Copy link
    Member

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

    @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.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants