Skip to content

Extract Python messages in nested gettext calls #487

@sublee

Description

@sublee

When Babel extracts messages from Python code, it ignores _(...) in another _(...).

My _ is slightly customized to accept **kwargs for formatting. I guess it is one of common patterns. So I can write like this code:

#: TRANSLATOR: Users can have one or more fruits.
text = _('You have {fruit}!', fruit=_('an apple'))

Babel extracts only You have {fruit}! in the above code. There's no an apple. But at the same case in C#, xgettext can extract both of the messages. So I think this is a bug in Babel.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions