improve translation linting

master
ansuz 3 years ago
parent 3288dd984f
commit cc141ebee8

@ -18,11 +18,13 @@ var simpleTags = [
'</span>',
];
['a', 'b', 'em', 'p', 'i', 'code', 'li',].forEach(function (tag) {
['a', 'b', 'em',/* 'p',*/ 'i', 'code', 'li',].forEach(function (tag) {
simpleTags.push('<' + tag + '>');
simpleTags.push('</' + tag + '>');
});
var found_tags = {};
// these keys are known to be problematic
var KNOWN_ISSUES = [ // FIXME
//'newVersion',
@ -67,7 +69,10 @@ var processLang = function (map, lang, primary) {
var usesHTML;
s.replace(/<[\s\S]*?>/g, function (html) {
if (simpleTags.indexOf(html) !== -1) { return; }
if (simpleTags.includes(html)) {
found_tags[html] = 1;
return;
}
announce();
usesHTML = true;
if (!primary) {
@ -126,3 +131,8 @@ processLang(EN, 'en', true);
console.error(err);
}
});
simpleTags.forEach(html => {
if (found_tags[html]) { return; }
console.log(`html exemption '${html}' is unnecessary.`);
});

@ -481,7 +481,7 @@ define([
create['notice'] = function () { // TODO make translateable
var key = 'notice';
var $div = makeBlock(key, true);
var $div = makeBlock(key, true); // Messages.admin_noticeHint
var $button = $div.find('button').addClass('cp-listing-action').text(Messages.settings_save);

Loading…
Cancel
Save