From 7b9f9d1edb96aabab7e35818824b71efbdd4efb9 Mon Sep 17 00:00:00 2001 From: Sebastian Spaeth Date: Sat, 1 Dec 2012 23:35:52 +0100 Subject: Fix i18n in our browser We only ever served english pages since the switch to werkzeug's requests. Fix this by actually checking the accepted languages that our web browser sends and using that or falling back to english. This is not optimal, imaging our browser sends "klingon, de" as accepted languages and we happen to not have a klingon translation ready (a deficiency that should be corrected immediately anyway!!). We would then fall back to english rather than sending the sensible and pleasant German language which the user would understand. This will require more backend work though. Removing the gettext.find() in mg_globals.py. It looked in the wrong directory anyway (mediagoblin/translations) and as that does not exist, had always returned None without anyone noticing. Signed-off-by: Sebastian Spaeth --- mediagoblin/mg_globals.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'mediagoblin/mg_globals.py') diff --git a/mediagoblin/mg_globals.py b/mediagoblin/mg_globals.py index fffa1dda..356a944d 100644 --- a/mediagoblin/mg_globals.py +++ b/mediagoblin/mg_globals.py @@ -45,11 +45,8 @@ workbench_manager = None # A thread-local scope thread_scope = threading.local() -# gettext -thread_scope.translations = gettext.find( - 'mediagoblin', - pkg_resources.resource_filename( - 'mediagoblin', 'translations'), ['en']) +# gettext (this will be populated on demand with gettext.Translations) +thread_scope.translations = None # app and global config objects app_config = None -- cgit v1.2.3