diff options
author | Sebastian Silva <sebastian@somosazucar.org> | 2013-04-25 05:18:06 (GMT) |
---|---|---|
committer | Sebastian Silva <sebastian@somosazucar.org> | 2013-04-25 05:18:06 (GMT) |
commit | 69682252a2852612ed6c435327f0ed15154a6402 (patch) | |
tree | f2fc4551a96930596d872b376aea543341fc31d7 | |
parent | 64b1ae0505e10de1650522cb739a0eca05f164d2 (diff) |
fix language for embedded webui
-rw-r--r-- | sugar_network_webui/app.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/sugar_network_webui/app.py b/sugar_network_webui/app.py index 8d9e147..f4b13ec 100644 --- a/sugar_network_webui/app.py +++ b/sugar_network_webui/app.py @@ -68,15 +68,13 @@ def event_stream(): @babel.localeselector def get_locale(): global WWW - # try to guess the language from the user accept - # header the browser transmits. - lang = request.accept_languages.best_match(['es', 'en']) - if not lang: - # otherwise we're probably embedded, get from env + if str(request.remote_addr)=='127.0.0.1': + # we're probably embedded, get locale from env lang = locale.getdefaultlocale()[0].split('_')[0] logging.debug('Locale from env: %s' % lang) WWW = False else: + lang = request.accept_languages.best_match(['es', 'en']) logging.debug('Locale from headers: %s' % lang) WWW = True return lang |