From 1a75dcd5ee52f381fae43e7e9d1446df688aa6ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 18 Nov 2016 07:50:53 +0100 Subject: [PATCH] Allow locale definition via request header Important for session less API calls that might return localized content (e.g. the system commands). See #1593 --- src/octoprint/cli/config.py | 0 src/octoprint/server/__init__.py | 3 +++ 2 files changed, 3 insertions(+) create mode 100644 src/octoprint/cli/config.py diff --git a/src/octoprint/cli/config.py b/src/octoprint/cli/config.py new file mode 100644 index 00000000..e69de29b diff --git a/src/octoprint/server/__init__.py b/src/octoprint/server/__init__.py index 14009965..f7b63ec6 100644 --- a/src/octoprint/server/__init__.py +++ b/src/octoprint/server/__init__.py @@ -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: