From f9f5d9d3ab01dcb782fc082f514d2c329f171a5e Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 5 Mar 2019 07:46:27 +1000 Subject: [PATCH] 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 --- aqt/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aqt/__init__.py b/aqt/__init__.py index 8c684f275..05d70af0b 100644 --- a/aqt/__init__.py +++ b/aqt/__init__.py @@ -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)