deprecated global _/ngettext was returning None

the plurals may still be wrong in the ngettext case, but at least
it should not lead to premature tracebacks
This commit is contained in:
Damien Elmes 2019-03-05 07:46:27 +10:00
parent 594095f332
commit f9f5d9d3ab

View file

@ -137,9 +137,10 @@ def setupLang(pm, app, force=None):
# gettext
_gtrans = gettext.translation(
'anki', dir, languages=[lang], fallback=True)
def fn(*args):
def fn(arg, *args):
print("accessing _ and ngettext without importing from anki.lang will break in the future")
print("".join(traceback.format_stack()[-2]))
return arg
builtins.__dict__['_'] = fn
builtins.__dict__['ngettext'] = fn
anki.lang.setLang(lang, local=False)