aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/mg_globals.py
diff options
context:
space:
mode:
authorChristopher Allan Webber <cwebber@dustycloud.org>2013-02-27 13:25:42 -0600
committerChristopher Allan Webber <cwebber@dustycloud.org>2013-02-27 13:25:42 -0600
commita808364e7f4b5e08e06bcd25c584fe9d956f9bb4 (patch)
tree6abc240beb5fa7a9876c739dbf630ae34f94d2c2 /mediagoblin/mg_globals.py
parentaecd65b789c1c6094a6bf5d8c75987675fd9e4f3 (diff)
downloadmediagoblin-a808364e7f4b5e08e06bcd25c584fe9d956f9bb4.tar.lz
mediagoblin-a808364e7f4b5e08e06bcd25c584fe9d956f9bb4.tar.xz
mediagoblin-a808364e7f4b5e08e06bcd25c584fe9d956f9bb4.zip
Fixing translations stuff for command line tools and such.
We had switched mg_globals to have the default translations set to None so that it would be set up by the mediagoblin app later. However, this would mean that things like scripts would try to call gettext and error out. Thanks to Tumulte for catching this. This commit sponsored by Aurimas FiĊĦeras. Thank you!
Diffstat (limited to 'mediagoblin/mg_globals.py')
-rw-r--r--mediagoblin/mg_globals.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/mediagoblin/mg_globals.py b/mediagoblin/mg_globals.py
index 8c7c64c2..e4b94bdc 100644
--- a/mediagoblin/mg_globals.py
+++ b/mediagoblin/mg_globals.py
@@ -42,8 +42,13 @@ workbench_manager = None
# A thread-local scope
thread_scope = threading.local()
-# gettext (this will be populated on demand with gettext.Translations)
-thread_scope.translations = None
+# gettext (this needs to default to English so it doesn't break
+# in case we're running a script without the app like
+# ./bin/gmg theme assetlink)
+thread_scope.translations = gettext.translation(
+ 'mediagoblin',
+ pkg_resources.resource_filename(
+ 'mediagoblin', 'i18n'), ['en'], fallback=True)
# app and global config objects
app_config = None