add translation completeness test to assertion page

pull/1/head
ansuz 8 years ago
parent 54615932f8
commit b1370c05b7

@ -4,7 +4,8 @@ define([
'/bower_components/hyperjson/hyperjson.js', '/bower_components/hyperjson/hyperjson.js',
'/bower_components/textpatcher/TextPatcher.amd.js', '/bower_components/textpatcher/TextPatcher.amd.js',
'json.sortify', 'json.sortify',
], function (jQuery, Hyperjson, TextPatcher, Sortify) { '/common/cryptpad-common.js',
], function (jQuery, Hyperjson, TextPatcher, Sortify, Cryptpad) {
var $ = window.jQuery; var $ = window.jQuery;
window.Hyperjson = Hyperjson; window.Hyperjson = Hyperjson;
window.TextPatcher = TextPatcher; window.TextPatcher = TextPatcher;
@ -140,6 +141,19 @@ define([
strungJSON(orig); strungJSON(orig);
}); });
assert(function () {
var missing = Cryptpad.Messages._checkTranslationState();
if (missing.length !== 0) {
missing.forEach(function (msg) {
console.log('* ' + msg);
});
return false;
}
return true;
}, "expected all translation keys in default language to be present in all translations. See console for details.");
var swap = function (str, dict) { var swap = function (str, dict) {
return str.replace(/\{\{(.*?)\}\}/g, function (all, key) { return str.replace(/\{\{(.*?)\}\}/g, function (all, key) {
return typeof dict[key] !== 'undefined'? dict[key] : all; return typeof dict[key] !== 'undefined'? dict[key] : all;

Loading…
Cancel
Save