Author Allie Fitter
Recipients Allie Fitter
Date 2019-03-16.02:07:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1552702047.72.0.770409871236.issue36310@roundup.psfhosted.org>
In-reply-to
Content
pygettext can't see gettext functions calls when they're inside of an fstring:

foo.py

    from gettext import gettext as _
    
    foo = f'{_("foo bar baz")}'

Running `pygettext3.7 -kgt -d message -D -v -o locales/message.pot foo.py` results in:

locale/message.pot
    # SOME DESCRIPTIVE TITLE.
    # Copyright (C) YEAR ORGANIZATION
    # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
    #
    msgid ""
    msgstr ""
    "Project-Id-Version: PACKAGE VERSION\n"
    "POT-Creation-Date: 2019-03-15 21:02-0500\n"
    "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    "Language-Team: LANGUAGE <LL@li.org>\n"
    "MIME-Version: 1.0\n"
    "Content-Type: text/plain; charset=UTF-8\n"
    "Content-Transfer-Encoding: 8bit\n"
    "Generated-By: pygettext.py 1.5\n"

Change foo.py to:

    from gettext import gettext as _
    
    foo = f'' + _("foo bar baz") + ''


Results in:

    # SOME DESCRIPTIVE TITLE.
    # Copyright (C) YEAR ORGANIZATION
    # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
    #
    msgid ""
    msgstr ""
    "Project-Id-Version: PACKAGE VERSION\n"
    "POT-Creation-Date: 2019-03-15 21:05-0500\n"
    "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    "Language-Team: LANGUAGE <LL@li.org>\n"
    "MIME-Version: 1.0\n"
    "Content-Type: text/plain; charset=UTF-8\n"
    "Content-Transfer-Encoding: 8bit\n"
    "Generated-By: pygettext.py 1.5\n"
    
    
    #: foo.py:3
    msgid "foo bar baz"
    msgstr ""


Running on Ubuntu 18.04.
History
Date User Action Args
2019-03-16 02:07:27Allie Fittersetrecipients: + Allie Fitter
2019-03-16 02:07:27Allie Fittersetmessageid: <1552702047.72.0.770409871236.issue36310@roundup.psfhosted.org>
2019-03-16 02:07:27Allie Fitterlinkissue36310 messages
2019-03-16 02:07:27Allie Fittercreate