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>
This commit is contained in:
parent
1d562672cd
commit
c8675d0c55
1 changed files with 5 additions and 1 deletions
|
@ -197,6 +197,7 @@ function dispatch(request)
|
||||||
assert(conf.main,
|
assert(conf.main,
|
||||||
"/etc/config/luci seems to be corrupt, unable to find section '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"
|
local lang = conf.main.lang or "auto"
|
||||||
if lang == "auto" then
|
if lang == "auto" then
|
||||||
local aclang = http.getenv("HTTP_ACCEPT_LANGUAGE") or ""
|
local aclang = http.getenv("HTTP_ACCEPT_LANGUAGE") or ""
|
||||||
|
@ -208,7 +209,10 @@ function dispatch(request)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
require "luci.i18n".setlanguage(lang)
|
if lang == "auto" then
|
||||||
|
lang = i18n.default
|
||||||
|
end
|
||||||
|
i18n.setlanguage(lang)
|
||||||
|
|
||||||
local c = ctx.tree
|
local c = ctx.tree
|
||||||
local stat
|
local stat
|
||||||
|
|
Loading…
Reference in a new issue