Commit de0b1774 authored by Xiaowu Zhang's avatar Xiaowu Zhang

Document/WebSite&erp5_web: introduce web site language priority convention to...

Document/WebSite&erp5_web: introduce web site language priority convention to fix report language issue on renderjs ui

1. [Browser is supposed to send something between 0 and 1]( https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language )

2. [Localizer will set 2 or 3 for cases where user selected language]( https://lab.nexedi.com/nexedi/erp5/blob/08be2f8cc936fbdc3d5bafb4355c3a475198abc1/product/Localizer/Localizer.py#L149-172 )

3. all print scripts seems set selected language priority to 10

so here we introduce a convention that site language priority should be 8(>3 and < 10) to fix report language issue
parent ee6119c7
......@@ -79,7 +79,7 @@ class WebSite(WebSection):
if name in language_list:
default_language = self.getDefaultAvailableLanguage()
if request.get('AcceptLanguage') is not None:
request['AcceptLanguage'].set(name, 100)
request['AcceptLanguage'].set(name, 10)
request.set(WEBSITE_LANGUAGE_KEY, name)
if self.isTempObject() or name == default_language:
redirect_path_list = [self.getOriginalDocument().absolute_url()]
......
......@@ -114,13 +114,13 @@ class WebSiteTraversalHook(WebSectionTraversalHook):
default_language = container.getDefaultAvailableLanguage()
if default_language and container.isStaticLanguageSelection():
if request.get('AcceptLanguage') is not None:
request['AcceptLanguage'].set(default_language, 80)
request['AcceptLanguage'].set(default_language, 8)
else:
accept_language = request.get('AcceptLanguage')
if accept_language is not None:
selected_language = accept_language.select_language(
container.getAvailableLanguageList())
if selected_language:
request['AcceptLanguage'].set(selected_language, 80)
request['AcceptLanguage'].set(selected_language, 8)
elif default_language:
request['AcceptLanguage'].set(default_language, 80)
request['AcceptLanguage'].set(default_language, 8)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment