Skip to content

Commit

Permalink
deprecated global _/ngettext was returning None
Browse files Browse the repository at this point in the history
the plurals may still be wrong in the ngettext case, but at least
it should not lead to premature tracebacks
  • Loading branch information
dae committed Mar 4, 2019
1 parent 594095f commit f9f5d9d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion aqt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f9f5d9d

Please sign in to comment.