diff --git a/aqt/__init__.py b/aqt/__init__.py index 2e4a239011c..9ac92045ab2 100644 --- a/aqt/__init__.py +++ b/aqt/__init__.py @@ -137,8 +137,11 @@ def setupLang(pm, app, force=None): # gettext _gtrans = gettext.translation( 'anki', dir, languages=[lang], fallback=True) - builtins.__dict__['_'] = _gtrans.gettext - builtins.__dict__['ngettext'] = _gtrans.ngettext + def fn(*args): + print("accessing _ and ngettext without importing from anki.lang will break in the future") + print("".join(traceback.format_stack()[-2])) + builtins.__dict__['_'] = fn + builtins.__dict__['ngettext'] = fn anki.lang.setLang(lang, local=False) if lang in ("he","ar","fa"): app.setLayoutDirection(Qt.RightToLeft) diff --git a/aqt/profiles.py b/aqt/profiles.py index 6d70d252f0e..ae9b17b36aa 100644 --- a/aqt/profiles.py +++ b/aqt/profiles.py @@ -357,10 +357,6 @@ def ensureProfile(self): # On first run, allow the user to choose the default language def _setDefaultLang(self): - # the dialog expects _ to be defined, but we're running before - # setupLang() has been called. so we create a dummy op for now - import builtins - builtins.__dict__['_'] = lambda x: x # create dialog class NoCloseDiag(QDialog): def reject(self):