[issue10497] Incorrect use of gettext in argparse
report at bugs.python.org
Thu Nov 25 13:11:55 CET 2010
Éric Araujo <merwok at netwok.org> added the comment:
A bit of rationale behind the patch. You probably know that the gettext/_ functions serves two roles: Identifying the strings to translate, and retrieving the translation from a catalog.
At strings extraction time, the string in the line
msg = _('unknown parser %r (choices: %s)' % tup)
will be found by xgettext (just checked), so the .pot and .po files will include it. So far, so good.
At runtime however, the gettext function will get "unknown parser 'parserr' (choices: ('some', 'tuple'))" as argument, which isn’t in the translation catalogs. Doing the string interpolation after the gettext call (my patch) avoids this problem.
I will write a test for those two strings.
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list