aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/tools
diff options
context:
space:
mode:
authorChristopher Allan Webber <cwebber@dustycloud.org>2012-07-26 11:09:52 -0500
committerChristopher Allan Webber <cwebber@dustycloud.org>2012-07-26 11:09:52 -0500
commita04c07376d9879671996044d734c2983a1bafe97 (patch)
tree76083fb46cf7e37bff144b31ff2f7236eb4d5eca /mediagoblin/tools
parent5e9e2deee68e3368533586fe9d6efdd6fd0d007f (diff)
parentc80982c7a0d64f01cb4dd44bfde334782f2a72c0 (diff)
downloadmediagoblin-a04c07376d9879671996044d734c2983a1bafe97.tar.lz
mediagoblin-a04c07376d9879671996044d734c2983a1bafe97.tar.xz
mediagoblin-a04c07376d9879671996044d734c2983a1bafe97.zip
Merge remote-tracking branch 'refs/remotes/gandaro/369-thread-gettext'
Diffstat (limited to 'mediagoblin/tools')
-rw-r--r--mediagoblin/tools/template.py4
-rw-r--r--mediagoblin/tools/translate.py9
2 files changed, 6 insertions, 7 deletions
diff --git a/mediagoblin/tools/template.py b/mediagoblin/tools/template.py
index 72c87a99..158d5321 100644
--- a/mediagoblin/tools/template.py
+++ b/mediagoblin/tools/template.py
@@ -49,8 +49,8 @@ def get_jinja_env(template_loader, locale):
extensions=['jinja2.ext.i18n', 'jinja2.ext.autoescape'])
template_env.install_gettext_callables(
- mg_globals.translations.ugettext,
- mg_globals.translations.ungettext)
+ mg_globals.thread_scope.translations.ugettext,
+ mg_globals.thread_scope.translations.ungettext)
# All templates will know how to ...
# ... fetch all waiting messages and remove them from the queue
diff --git a/mediagoblin/tools/translate.py b/mediagoblin/tools/translate.py
index 33ee889a..65f636bb 100644
--- a/mediagoblin/tools/translate.py
+++ b/mediagoblin/tools/translate.py
@@ -100,7 +100,7 @@ def setup_gettext(locale):
# TODO: fallback nicely on translations from pt_PT to pt if not
# available, etc.
- if SETUP_GETTEXTS.has_key(locale):
+ if locale in SETUP_GETTEXTS:
this_gettext = SETUP_GETTEXTS[locale]
else:
this_gettext = gettext.translation(
@@ -108,8 +108,7 @@ def setup_gettext(locale):
if exists(locale):
SETUP_GETTEXTS[locale] = this_gettext
- mg_globals.setup_globals(
- translations=this_gettext)
+ mg_globals.thread_scope.translations = this_gettext
# Force en to be setup before anything else so that
@@ -124,7 +123,7 @@ def pass_to_ugettext(*args, **kwargs):
The reason we can't have a global ugettext method is because
mg_globals gets swapped out by the application per-request.
"""
- return mg_globals.translations.ugettext(
+ return mg_globals.thread_scope.translations.ugettext(
*args, **kwargs)
@@ -146,7 +145,7 @@ def pass_to_ngettext(*args, **kwargs):
The reason we can't have a global ngettext method is because
mg_globals gets swapped out by the application per-request.
"""
- return mg_globals.translations.ngettext(
+ return mg_globals.thread_scope.translations.ngettext(
*args, **kwargs)