only set session (cookie) lang on changes
This commit is contained in:
parent
7420b4107e
commit
f8a3676555
@ -1,9 +1,10 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import os.path
|
||||||
import re
|
import re
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
import quart
|
import quart
|
||||||
import os.path
|
|
||||||
|
|
||||||
from .app import app
|
from .app import app
|
||||||
|
|
||||||
@ -53,7 +54,8 @@ def detect_language():
|
|||||||
if 'setlang' in r.args:
|
if 'setlang' in r.args:
|
||||||
lang = r.args.get('setlang').strip().lower()
|
lang = r.args.get('setlang').strip().lower()
|
||||||
if lang and _VALID_LANGUAGE_NAMES.match(lang):
|
if lang and _VALID_LANGUAGE_NAMES.match(lang):
|
||||||
s['lang'] = lang
|
if s.get('lang') != lang:
|
||||||
|
s['lang'] = lang
|
||||||
g.langs = [lang]
|
g.langs = [lang]
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user