[FIX] website: The default language does not use the configuration

The request language must be a fallback if the current website does not
have a default language
This commit is contained in:
Christophe Matthieu
2017-05-22 11:57:41 +02:00
parent 57f7c68106
commit 174d7e8e49
+2 -2
View File
@@ -179,8 +179,8 @@ class Http(models.AbstractModel):
nearest_lang = not func and cls.get_nearest_lang(path[1])
url_lang = nearest_lang and path[1]
preferred_lang = ((cook_lang if cook_lang in langs else False)
or (not is_a_bot and cls.get_nearest_lang(request.lang))
or request.website.default_lang_code)
or request.website.default_lang_code
or (not is_a_bot and cls.get_nearest_lang(request.lang)))
request.lang = context['lang'] = nearest_lang or preferred_lang
# if lang in url but not the displayed or default language --> change or remove