Skip to content

Warn about inconsistent plural forms during extraction - #1364

Open
saltnpepper97 wants to merge 1 commit into
python-babel:masterfrom
saltnpepper97:fix/inconsistent-plural-warning
Open

saltnpepper97 wants to merge 1 commit into
python-babel:masterfrom
saltnpepper97:fix/inconsistent-plural-warning

Conversation

@saltnpepper97

@saltnpepper97 saltnpepper97 commented Oct 4, 2026 •

Copy link
Copy Markdown

When plural messages share the same singular text and context but use different plural text, Babel currently keeps the first plural without a warning.

This change checks the existing catalog entry before adding the incoming message and logs a warning with the source location and both plural forms when they conflict. The first plural and merged source locations are preserved.

Tests cover conflicting ngettext and npgettext calls, conflicts across files, identical plural text, separate contexts, and mixed singular/plural calls.

Validation on macOS with Python 3.14.2:

  • New regression cases: 3 failed before the fix; all 8 pass after it.
  • Focused tests: 111 passed.
  • Full test suite: 7,839 passed, 7 skipped, and 2 xfailed.
  • Python compilation completed successfully.
  • Pre-commit checks passed for both changed files.

Fixes #1003.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Warn for inconsistent uses of (p)ngettext plurals?

1 participant