python-babel / babel

The official repository for Babel, the Python Internationalization Library

Home Page:http://babel.pocoo.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: Support gettext-like "t" specifier in keywords

jeanas opened this issue · comments

The full description of xgettext's --keyword option is here.

pybabel extract supports a similar syntax, but it does not support the trailing "nt" to indicate that this keyword only applies when there are n arguments. This can be useful in some Python projects (example) where the _ function is variadic for convenience. (In this particular project, it behaves like gettext with 1 arg, pgettext with 2 args, ngettext with 3 args and npgettext with 4 args, i.e., _(message), _(context, message), _(singular, plural, number) or _(context, singular, plural, number).)