aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Allan Webber <cwebber@dustycloud.org>2011-08-08 22:51:03 -0500
committerChristopher Allan Webber <cwebber@dustycloud.org>2011-08-08 22:51:03 -0500
commit03e5bd6d352f9479eefd3c7ad1f39137bd9ba17d (patch)
tree6a5c9bce6874a18d368902efff74ebbdb0a7c95f
parent1eec9c88445ca73e4b237ce39190fda0775fc4f1 (diff)
downloadmediagoblin-03e5bd6d352f9479eefd3c7ad1f39137bd9ba17d.tar.lz
mediagoblin-03e5bd6d352f9479eefd3c7ad1f39137bd9ba17d.tar.xz
mediagoblin-03e5bd6d352f9479eefd3c7ad1f39137bd9ba17d.zip
Provide a pass_to_ugettext method and set up gettext to default to English.
-rw-r--r--mediagoblin/util.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/mediagoblin/util.py b/mediagoblin/util.py
index d26dc6dc..ed7be841 100644
--- a/mediagoblin/util.py
+++ b/mediagoblin/util.py
@@ -478,6 +478,22 @@ def setup_gettext(locale):
translations=this_gettext)
+# Force en to be setup before anything else so that
+# mg_globals.translations is never None
+setup_gettext('en')
+
+
+def pass_to_ugettext(*args, **kwargs):
+ """
+ Pass a translation on to the appropriate ugettext method.
+
+ 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(
+ *args, **kwargs)
+
+
PAGINATION_DEFAULT_PER_PAGE = 30
class Pagination(object):