summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2016-03-01 17:25:55 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2016-03-01 17:25:55 +0100
commitc8675d0c5560fb47eace7db531c381edbef25db7 (patch)
treeb7c7187fff5df9a3c1fa0cc828f54972f6f971dd /modules/luci-base
parent1d562672cdcfb84222b9e01ac07775d74e53c7cf (diff)
modules/base: dispatcher: use default language if automatic choice fails
Fall back to default language if "auto" is configured, but none provided by the browser matches. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Diffstat (limited to 'modules/luci-base')
-rw-r--r--modules/luci-base/luasrc/dispatcher.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/luci-base/luasrc/dispatcher.lua b/modules/luci-base/luasrc/dispatcher.lua
index c7903e638..0876ce658 100644
--- a/modules/luci-base/luasrc/dispatcher.lua
+++ b/modules/luci-base/luasrc/dispatcher.lua
@@ -197,6 +197,7 @@ function dispatch(request)
assert(conf.main,
"/etc/config/luci seems to be corrupt, unable to find section 'main'")
+ local i18n = require "luci.i18n"
local lang = conf.main.lang or "auto"
if lang == "auto" then
local aclang = http.getenv("HTTP_ACCEPT_LANGUAGE") or ""
@@ -208,7 +209,10 @@ function dispatch(request)
end
end
end
- require "luci.i18n".setlanguage(lang)
+ if lang == "auto" then
+ lang = i18n.default
+ end
+ i18n.setlanguage(lang)
local c = ctx.tree
local stat