From: Jo-Philipp Wich Date: Thu, 16 Jan 2020 17:10:04 +0000 (+0100) Subject: luci-base: cbi.js: collapse whitespace before language string hashing X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=f463570590ae88c1d00e1460c0da2bc886b411c5;p=oweals%2Fluci.git luci-base: cbi.js: collapse whitespace before language string hashing To mirror the behavior of the Lua runtime, we need to collapse whitepace in translation source strings before doing the string table lookup. Signed-off-by: Jo-Philipp Wich (cherry picked from commit aca2c4ba4e4c847e5ae86e5539537f213678a0f3) --- diff --git a/modules/luci-base/htdocs/luci-static/resources/cbi.js b/modules/luci-base/htdocs/luci-static/resources/cbi.js index 4c3128bfd..ff198027e 100644 --- a/modules/luci-base/htdocs/luci-static/resources/cbi.js +++ b/modules/luci-base/htdocs/luci-static/resources/cbi.js @@ -95,7 +95,7 @@ function sfh(s) { } function _(s) { - return (window.TR && TR[sfh(s)]) || s; + return (window.TR && TR[sfh(String(s).trim().replace(/[ \t\n]+/g, ' '))]) || s; }