lingua
lingua copied to clipboard
Python extractor: --keyword doesn't work with function that uses type annotations
Our pluralization function (ngettext) is defined as follows (using Python 3 type annotations).
def _p(
singular: str,
plural: str,
n: int,
mapping: Dict=None
) -> TranslationString:
pass
We extract the strings from the source with following command:
pot-create --keyword=_ts --keyword=_p:1,2 "$SEARCH_PATH" -o "$LOCALES_PATH"/$DOMAIN.pot
This breaks with following error:
Aborting due to parse error in ./xyz/utils.py[140]: Unexpected token: :
In utils.py on line 140 you will of course find the _p() function.
#93 might have fixed this