From b1370c05b7501f1da167c96caabe8565f080f06c Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 24 Oct 2016 11:51:16 +0200 Subject: [PATCH] add translation completeness test to assertion page --- www/assert/main.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/www/assert/main.js b/www/assert/main.js index dc3c2087e..f3b6c6fe2 100644 --- a/www/assert/main.js +++ b/www/assert/main.js @@ -4,7 +4,8 @@ define([ '/bower_components/hyperjson/hyperjson.js', '/bower_components/textpatcher/TextPatcher.amd.js', 'json.sortify', -], function (jQuery, Hyperjson, TextPatcher, Sortify) { + '/common/cryptpad-common.js', +], function (jQuery, Hyperjson, TextPatcher, Sortify, Cryptpad) { var $ = window.jQuery; window.Hyperjson = Hyperjson; window.TextPatcher = TextPatcher; @@ -140,6 +141,19 @@ define([ 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) { return str.replace(/\{\{(.*?)\}\}/g, function (all, key) { return typeof dict[key] !== 'undefined'? dict[key] : all;