Skip to content

Skip dynamic Python arguments during message extraction - #1448

Open
Denny-j-mangalathu wants to merge 1 commit into
python-babel:masterfrom
Denny-j-mangalathu:fix/python-extraction-expressions
Open

Denny-j-mangalathu wants to merge 1 commit into
python-babel:masterfrom
Denny-j-mangalathu:fix/python-extraction-expressions

Conversation

@Denny-j-mangalathu

Copy link
Copy Markdown

Python message extraction can emit fragments of dynamic arguments. For example, _('prefix' + suffix) currently adds prefix to the catalog even though gettext receives the computed value.

Track whether each argument consists of string literals. Skip dynamic arguments while preserving argument positions, adjacent literal concatenation, and the existing translator comment handling.

Closes #415.

The regression test fails on upstream master. With the fix, 86 extraction, lexer, and extraction frontend tests pass. The frontend tests used locale data from the published Babel package because the CLDR source download did not complete.

Prepared with Codex assistance.

@akx akx left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is in the same vein as #1350 - we should warn about the skipped cases.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

extract will return literals that are part of an expression

2 participants