diff options
-rw-r--r-- | mediagoblin/_compat.py | 6 | ||||
-rw-r--r-- | mediagoblin/tools/template.py | 5 |
2 files changed, 8 insertions, 3 deletions
diff --git a/mediagoblin/_compat.py b/mediagoblin/_compat.py index 38c71524..a6b775fc 100644 --- a/mediagoblin/_compat.py +++ b/mediagoblin/_compat.py @@ -2,9 +2,15 @@ import sys from six import PY3, iteritems +from mediagoblin import mg_globals + if PY3: from email.mime.text import MIMEText from urllib import parse as urlparse + ugettext = mg_globals.thread_scope.translations.gettext + ungettext = mg_globals.thread_scope.translations.ngettext else: from email.MIMEText import MIMEText import urlparse + ugettext = mg_globals.thread_scope.translations.ugettext + ungettext = mg_globals.thread_scope.translations.ungettext diff --git a/mediagoblin/tools/template.py b/mediagoblin/tools/template.py index e5acdf45..359ddd38 100644 --- a/mediagoblin/tools/template.py +++ b/mediagoblin/tools/template.py @@ -33,6 +33,7 @@ from mediagoblin.tools.pluginapi import get_hook_templates, hook_transform from mediagoblin.tools.timesince import timesince from mediagoblin.meddleware.csrf import render_csrf_form_token +from mediagoblin._compat import ugettext, ungettext SETUP_JINJA_ENVS = {} @@ -66,9 +67,7 @@ def get_jinja_env(template_loader, locale): 'jinja2.ext.i18n', 'jinja2.ext.autoescape', TemplateHookExtension] + local_exts) - template_env.install_gettext_callables( - mg_globals.thread_scope.translations.ugettext, - mg_globals.thread_scope.translations.ungettext) + template_env.install_gettext_callables(ugettext, ungettext) # All templates will know how to ... # ... fetch all waiting messages and remove them from the queue |