Fall back to "en" if we don't find matching translations

In case of no matching translations, target_lang was "None" which
blew up things. Fall back to "en" in case we don't find a
corresponding translation.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This commit is contained in:
Sebastian Spaeth 2012-12-02 01:38:09 +01:00
parent 1aac6a3c3c
commit d53ca5e506

View File

@ -88,7 +88,7 @@ def get_locale_from_request(request):
# of accepted locales, and serve the best available locale rather than
# the most preferred, or fall back to 'en' immediately.
target_lang = request.accept_languages.best_match(
mg_globals.available_locales)
mg_globals.available_locales) or 'en'
return locale_to_lower_upper(target_lang)
SETUP_GETTEXTS = {}