python-babel / babel

The official repository for Babel, the Python Internationalization Library
http://babel.pocoo.org/
BSD 3-Clause "New" or "Revised" License
1.29k stars 433 forks source link

Warn for inconsistent uses of (p)ngettext plurals? #1003

Open tomasr8 opened 1 year ago

tomasr8 commented 1 year ago

Overview Description

Sorry for the issue spam, I swear this is the last one ;)

When the python extractor encounters multiple ngettext calls with differing plurals:

ngettext("foo", "foos", 2)
ngettext("foo", "bars", 2)

I think it would be a good idea to show a warning as this probably not intentional.

The po file entry currently uses the plural from the first call (I don't think it's specified anywhere what we should do in this case)

#: test2.py:1 test2.py:2
msgid "foo"
msgid_plural "foos"
msgstr[0] ""
msgstr[1] ""

Additional Information

babel version 2.12.1