identify translations with complex inline HTML

This commit is contained in:
ansuz 2021-03-23 10:58:06 +05:30
parent 60b3728164
commit 774c6864d5
1 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,27 @@
var EN = require("../www/common/translations/messages.json");
var simpleTags = [
'<br>',
'<br />',
];
['a', 'b', 'em', 'p'].forEach(function (tag) {
simpleTags.push('<' + tag + '>');
simpleTags.push('</' + tag + '>');
});
Object.keys(EN).forEach(function (k) {
var s = EN[k];
if (typeof(s) !== 'string') { return; }
var usesHTML;
s.replace(/<.*?>/g, function (html) {
if (simpleTags.indexOf(html) !== -1) { return; }
usesHTML = true;
console.log("{%s}", html);
});
if (usesHTML) {
console.log("[%s] %s\n", k, s);
}
});