Do not load all the translations anymore, only the needed one

This commit is contained in:
yflory
2017-02-20 18:29:06 +01:00
parent 434c3a220c
commit 454d1c2052
11 changed files with 111 additions and 138 deletions

View File

@@ -142,16 +142,18 @@ define([
});
assert(function () {
var missing = Cryptpad.Messages._checkTranslationState();
var todo = function (missing) {
if (missing.length !== 0) {
missing.forEach(function (msg) {
console.log('* ' + msg);
});
if (missing.length !== 0) {
missing.forEach(function (msg) {
console.log('* ' + msg);
});
// No, this is crappy, it's going to cause tests to fail basically all of the time.
//return false;
}
};
Cryptpad.Messages._checkTranslationState(todo);
// No, this is crappy, it's going to cause tests to fail basically all of the time.
//return false;
}
return true;
}, "expected all translation keys in default language to be present in all translations. See console for details.");

View File

@@ -5,17 +5,19 @@ define([
var $ = window.jQuery;
var $body = $('body');
var missing = Cryptpad.Messages._checkTranslationState();
var pre = function (text, opt) {
return $('<pre>', opt).text(text);
};
if (missing.length) {
$body.append(pre(missing.map(function (msg) {
return '* ' + msg;
}).join('\n')));
} else {
$body.text('All keys are present in all translations');
}
var todo = function (missing) {
if (missing.length) {
$body.append(pre(missing.map(function (msg) {
return '* ' + msg;
}).join('\n')));
} else {
$body.text('All keys are present in all translations');
}
};
Cryptpad.Messages._checkTranslationState(todo);
});