From b2ed8f4fb0ff94626b253bdd7d1e91a2dd1ef8d0 Mon Sep 17 00:00:00 2001 From: ansuz Date: Tue, 6 Jul 2021 15:44:10 +0530 Subject: [PATCH] handle missing languages and other errors ...when checking translations for HTML --- scripts/find-html-translations.js | 15 ++++++++++----- scripts/pin-test.js | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 scripts/pin-test.js diff --git a/scripts/find-html-translations.js b/scripts/find-html-translations.js index dabdbac4b..fc1d4a18e 100644 --- a/scripts/find-html-translations.js +++ b/scripts/find-html-translations.js @@ -9,6 +9,7 @@ var simpleTags = [ // FIXME "", + '', '

', '

', @@ -70,7 +71,7 @@ processLang(EN, 'en', true); [ 'ar', - 'bn_BD', + //'bn_BD', 'ca', 'de', 'es', @@ -86,11 +87,15 @@ processLang(EN, 'en', true); 'ro', 'ru', 'sv', - 'te', + //'te', 'tr', 'zh', ].forEach(function (lang) { - var map = require("../www/common/translations/messages." + lang + ".json"); - if (!Object.keys(map).length) { return; } - processLang(map, lang); + try { + var map = require("../www/common/translations/messages." + lang + ".json"); + if (!Object.keys(map).length) { return; } + processLang(map, lang); + } catch (err) { + console.error(err); + } }); diff --git a/scripts/pin-test.js b/scripts/pin-test.js new file mode 100644 index 000000000..fe313c45b --- /dev/null +++ b/scripts/pin-test.js @@ -0,0 +1,19 @@ +var Pins = require("../lib/pins"); +var Fs = require("fs"); + +var content = Fs.readFileSync('./data/pins/Bp/BpL3pEyX2IlfsvxQELB9uz5qh+40re0gD6J6LOobBm8=.ndjson', 'utf8'); + +//var lines = content.split("\n"); + +//console.log(content); + +var result; + +for (var i = 0; i < 10000; i++) { + result = Pins.calculateFromLog(content, function (label, data) { + console.log([label, data]); + }); +} + +//console.log(result, result.length); +