From 774c6864d505fc55576d3482dcde9a6bbf45a95d Mon Sep 17 00:00:00 2001 From: ansuz Date: Tue, 23 Mar 2021 10:58:06 +0530 Subject: [PATCH] identify translations with complex inline HTML --- scripts/find-html-translations.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 scripts/find-html-translations.js diff --git a/scripts/find-html-translations.js b/scripts/find-html-translations.js new file mode 100644 index 000000000..fd5a01f54 --- /dev/null +++ b/scripts/find-html-translations.js @@ -0,0 +1,27 @@ +var EN = require("../www/common/translations/messages.json"); + +var simpleTags = [ + '
', + '
', +]; + +['a', 'b', 'em', 'p'].forEach(function (tag) { + simpleTags.push('<' + tag + '>'); + simpleTags.push(''); +}); + +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); + } +});