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

Better argument validation for python *gettext functions #1002

Open tomasr8 opened 1 year ago

tomasr8 commented 1 year ago

Overview Description

*gettext calls should be properly validated for the correct number/type of arguments and an error/warning should be issued if the signature does not match.

Some examples which currently produce po file entries w/o any errors/warnings:

gettext(some_arg="hello") - gettext takes only one positional argument gettext("hello", "asdad") - same for this ngettext("asd", "sdfsdfsd") - missing n argument

These should either be errors or at least warnings as they will result in runtime errors.

Additional Information

babel version 2.12.1