mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Fix api18n : it should return a wrapper and not the callback directly. Current code led to some weird incorrect locale sometimes
This commit is contained in:
parent
dbc4716b48
commit
d9fa6c7858
1 changed files with 8 additions and 6 deletions
|
@ -776,12 +776,14 @@ class Interface(BaseInterface):
|
||||||
|
|
||||||
# Attempt to retrieve and set locale
|
# Attempt to retrieve and set locale
|
||||||
def api18n(callback):
|
def api18n(callback):
|
||||||
|
def wrapper(*args, **kwargs):
|
||||||
try:
|
try:
|
||||||
locale = request.params.pop("locale")
|
locale = request.params.pop("locale")
|
||||||
except KeyError:
|
except KeyError:
|
||||||
locale = m18n.default_locale
|
locale = m18n.default_locale
|
||||||
m18n.set_locale(locale)
|
m18n.set_locale(locale)
|
||||||
return callback
|
return callback(*args, **kwargs)
|
||||||
|
return wrapper
|
||||||
|
|
||||||
# Install plugins
|
# Install plugins
|
||||||
app.install(filter_csrf)
|
app.install(filter_csrf)
|
||||||
|
|
Loading…
Add table
Reference in a new issue