2015-03-19 20:29:30 +00:00
|
|
|
From: Matthias Schiffer <mschiffer@universe-factory.net>
|
|
|
|
Date: Thu, 19 Mar 2015 18:44:52 +0100
|
|
|
|
Subject: modules/base: dispatcher: set default language if none provided by the browser matches
|
|
|
|
|
2015-05-21 23:09:19 +00:00
|
|
|
diff --git a/modules/luci-base/luasrc/dispatcher.lua b/modules/luci-base/luasrc/dispatcher.lua
|
2016-06-16 02:40:45 +00:00
|
|
|
index 2526950..be2fc34 100644
|
2015-05-21 23:09:19 +00:00
|
|
|
--- a/modules/luci-base/luasrc/dispatcher.lua
|
|
|
|
+++ b/modules/luci-base/luasrc/dispatcher.lua
|
|
|
|
@@ -182,6 +182,7 @@ function dispatch(request)
|
2015-03-19 20:29:30 +00:00
|
|
|
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 ""
|
2015-05-21 23:09:19 +00:00
|
|
|
@@ -193,7 +194,10 @@ function dispatch(request)
|
2015-03-19 20:29:30 +00:00
|
|
|
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
|