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 <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich 2020-01-16 18:10:04 +01:00
parent 3eeb9ef303
commit aca2c4ba4e

View file

@ -95,7 +95,7 @@ function sfh(s) {
} }
function _(s) { function _(s) {
return (window.TR && TR[sfh(s)]) || s; return (window.TR && TR[sfh(String(s).trim().replace(/[ \t\n]+/g, ' '))]) || s;
} }