Allow locale definition via request header

Important for session less API calls that might return
localized content (e.g. the system commands).

See #1593
This commit is contained in:
Gina Häußge 2016-11-18 07:50:53 +01:00
parent d1cb8ca98a
commit 1a75dcd5ee
2 changed files with 3 additions and 0 deletions

View file

View file

@ -575,6 +575,9 @@ class Server(object):
if "l10n" in request.values:
return Locale.negotiate([request.values["l10n"]], LANGUAGES)
if "X-Locale" in request.headers:
return Locale.negotiate([request.headers["X-Locale"]], LANGUAGES)
if hasattr(g, "identity") and g.identity and userManager.enabled:
userid = g.identity.id
try: