Commit 01166a1d authored by Jérome Perrin's avatar Jérome Perrin

Merge !506 Persist the language cookie when changing language

The fact that ERP5 does not remember the selected language has been reported as a bug to us.

Instead of using a session cookie, this change make the cookie persists. For one year. This is a bit arbitrary, I copied that behavior from the "remember my username" [cookie](https://lab.nexedi.com/nexedi/erp5/blob/557c20bdf0e/product/ERP5Type/patches/CookieCrumbler.py#L138) that we use to have on the login page.

/reviewed-on !506
parents f22ec5fb 6c7a692d
......@@ -37,4 +37,4 @@ else:
if not select_language:
select_language = portal.Localizer.get_selected_language()
portal.Localizer.changeLanguage(select_language)
portal.Localizer.changeLanguage(select_language, expires=(DateTime() + 365).toZone('GMT').rfc822())
......@@ -175,7 +175,7 @@ class DummyLocalizer:
get_languages = get_supported_languages
def changeLanguage(self, lang):
def changeLanguage(self, lang, expires=None):
self.lang = lang
def translate(self, domain, msgid, lang=None, mapping=None, *args, **kw):
......
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