Commit a1d47205 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 nexedi/erp5!506
parents b16313d1 6c7a692d
...@@ -37,4 +37,4 @@ else: ...@@ -37,4 +37,4 @@ else:
if not select_language: if not select_language:
select_language = portal.Localizer.get_selected_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: ...@@ -175,7 +175,7 @@ class DummyLocalizer:
get_languages = get_supported_languages get_languages = get_supported_languages
def changeLanguage(self, lang): def changeLanguage(self, lang, expires=None):
self.lang = lang self.lang = lang
def translate(self, domain, msgid, lang=None, mapping=None, *args, **kw): 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