Commit 45a3a238 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Added a switch in order to be able to use static vs. dynamic language selection in web sites.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23563 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f288742b
...@@ -115,7 +115,7 @@ class WebSiteTraversalHook(Persistent): ...@@ -115,7 +115,7 @@ class WebSiteTraversalHook(Persistent):
# Set default language if any # Set default language if any
default_language = container.getDefaultAvailableLanguage() default_language = container.getDefaultAvailableLanguage()
if default_language: if default_language and container.isStaticLanguageSelection():
if request.get('AcceptLanguage') is not None: if request.get('AcceptLanguage') is not None:
request['AcceptLanguage'].set(default_language, 80) request['AcceptLanguage'].set(default_language, 80)
...@@ -156,7 +156,7 @@ class WebSite(WebSection): ...@@ -156,7 +156,7 @@ class WebSite(WebSection):
# Static Language Selection support # Static Language Selection support
def _getExtensibleContent(self, request, name): def _getExtensibleContent(self, request, name):
language_list = self.getAvailableLanguageList() language_list = self.getAvailableLanguageList()
if language_list: if language_list and self.isStaticLanguageSelection():
# Interprete names which could be a language # Interprete names which could be a language
# as a language selection only if language_list # as a language selection only if language_list
# was defined or set default language # was defined or set default language
......
...@@ -36,5 +36,11 @@ class WebSite: ...@@ -36,5 +36,11 @@ class WebSite:
'type' : 'string', 'type' : 'string',
'default' : None, 'default' : None,
'mode' : 'rw' }, 'mode' : 'rw' },
{ 'id' : 'static_language_selection',
'description' : 'If set to True, the language selection is based on the URL rather than '
'on cookie. This property impacts the behaviour of Base_doLanguage',
'type' : 'boolean',
'default' : 0,
'mode' : 'rw' },
) )
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