Merge pull request #659 from NeoRaider/default-language

modules/base: dispatcher: use default language if automatic choice fails
This commit is contained in:
Jo-Philipp Wich 2016-03-01 17:54:49 +01:00
commit ddc893ccc2

View file

@ -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