Fixed a bug where templates (t:) was loaded after string replacements (s:)

This commit is contained in:
Niko 2022-02-16 19:51:36 +01:00
parent 2089c786b3
commit 1a1ff39df0
1 changed files with 7 additions and 0 deletions

View File

@ -58,6 +58,13 @@ app.template = {
if (k.startsWith('t:')) if (k.startsWith('t:'))
tpl = tpl.replace('{'+k+'}', app.template.get(k.substr(2))); tpl = tpl.replace('{'+k+'}', app.template.get(k.substr(2)));
} }
for (var i = 0; i < matches.length; i++) {
const k = matches[i];
if (!k.match(/^[a-zA-Z0-9\:_\.]+$/))
continue;
if (k.startsWith('s:'))
tpl = tpl.replace('{'+k+'}', eval('app.strings.'+k.substr(2)));
}
}; _(); }; _();
const res = Array.from(tpl.matchAll(/\{\.[^\{\}]+\}/g)); const res = Array.from(tpl.matchAll(/\{\.[^\{\}]+\}/g));
var matches = []; var matches = [];