Start localization

Trac 30310
This commit is contained in:
Arlo Breault 2019-08-14 13:45:15 -04:00
parent f94ef87c46
commit 4e5a50f2b5
9 changed files with 115 additions and 26 deletions

View file

@ -38,4 +38,16 @@ class Popup {
setToggleText(txt) {
document.getElementById('toggle').innerText = txt;
}
static fill(n, func) {
switch(n.nodeType) {
case 3: { // Node.TEXT_NODE
const m = /^__MSG_([^_]*)__$/.exec(n.nodeValue);
if (m) { n.nodeValue = func(m[1]); }
break;
}
case 1: // Node.ELEMENT_NODE
n.childNodes.forEach(c => Popup.fill(c, func));
break;
}
}
}