Skip to content

Add optional gettext argument validation to Python extraction - #1460

Open
ada-wh525 wants to merge 1 commit into
python-babel:masterfrom
ada-wh525:ada-wh525/gettext-argument-validation
Open

ada-wh525 wants to merge 1 commit into
python-babel:masterfrom
ada-wh525:ada-wh525/gettext-argument-validation

Conversation

@ada-wh525

Copy link
Copy Markdown

Python message extraction currently accepts invalid gettext calls without diagnostics, such as gettext("hello", "extra") or ngettext("one", "many").

This adds an opt-in validate_gettext option that warns about incorrect argument counts and names using the standard library gettext signatures. Warnings include the source filename and line number.

Validation is disabled by default to support custom wrappers with different signatures. Calls using argument unpacking are skipped, and extraction results are preserved. Usage and limitations are documented.

Validation:

Refs #1002

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.

2 participants