From 34b34d0c3f055f6923da47c8cf3edcdf66ab11be Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 19 Mar 2015 21:29:30 +0100 Subject: [PATCH] luci: fall back to English if no language matches --- ...none-provided-by-the-browser-matches.patch | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 patches/packages/luci/0002-modules-base-dispatcher-set-default-language-if-none-provided-by-the-browser-matches.patch diff --git a/patches/packages/luci/0002-modules-base-dispatcher-set-default-language-if-none-provided-by-the-browser-matches.patch b/patches/packages/luci/0002-modules-base-dispatcher-set-default-language-if-none-provided-by-the-browser-matches.patch new file mode 100644 index 00000000..2e1da79c --- /dev/null +++ b/patches/packages/luci/0002-modules-base-dispatcher-set-default-language-if-none-provided-by-the-browser-matches.patch @@ -0,0 +1,28 @@ +From: Matthias Schiffer +Date: Thu, 19 Mar 2015 18:44:52 +0100 +Subject: modules/base: dispatcher: set default language if none provided by the browser matches + +diff --git a/modules/base/luasrc/dispatcher.lua b/modules/base/luasrc/dispatcher.lua +index f7e16e7..479ac54 100644 +--- a/modules/base/luasrc/dispatcher.lua ++++ b/modules/base/luasrc/dispatcher.lua +@@ -211,6 +211,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 "" +@@ -222,7 +223,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