2016-03-22 16:26:16 -04:00
|
|
|
/*
|
2016-03-23 08:22:09 -04:00
|
|
|
* spot check that each language has values for the string id keys on Wedo2 page
|
2016-03-22 16:26:16 -04:00
|
|
|
* that are contained in English (i.e. make sure strings will show up, not ids")
|
|
|
|
*/
|
2016-03-23 08:22:09 -04:00
|
|
|
var merge = require('lodash.merge');
|
|
|
|
var path = require('path');
|
2016-03-22 16:26:16 -04:00
|
|
|
var tap = require('tap');
|
2016-03-23 08:22:09 -04:00
|
|
|
|
2016-03-22 16:26:16 -04:00
|
|
|
var languages = require('../../languages.json');
|
2016-03-23 08:22:09 -04:00
|
|
|
var localeCompare = require('../../bin/lib/locale-compare');
|
2016-03-22 16:26:16 -04:00
|
|
|
|
2016-05-17 15:56:06 -04:00
|
|
|
tap.test('spotCheckWedo2Strings', function (t) {
|
2016-03-22 16:26:16 -04:00
|
|
|
var isoCodes = Object.keys(languages);
|
2016-03-23 08:22:09 -04:00
|
|
|
isoCodes.splice(isoCodes.indexOf('en'), 1);
|
2016-05-17 15:56:06 -04:00
|
|
|
|
2016-05-19 06:56:45 -04:00
|
|
|
var ids = require(path.resolve(__dirname, '../../src/views/wedo2/l10n.json'));
|
2016-05-17 15:56:06 -04:00
|
|
|
var viewLocales = {
|
|
|
|
wedo2: {en: ids}
|
|
|
|
};
|
|
|
|
var idsWithICU = localeCompare.idToICUMap('wedo2', ids);
|
|
|
|
var icuWithIds = localeCompare.icuToIdMap('wedo2', ids);
|
2016-03-23 08:22:09 -04:00
|
|
|
var md5WithIds = localeCompare.getMD5Map(icuWithIds);
|
|
|
|
var keysToCheck = Object.keys(merge(viewLocales['wedo2']['en'])).sort();
|
2016-03-22 16:26:16 -04:00
|
|
|
for (var i in isoCodes) {
|
2016-03-23 08:22:09 -04:00
|
|
|
var translations = localeCompare.getTranslationsForLanguage(isoCodes[i], idsWithICU, md5WithIds);
|
2016-03-22 16:26:16 -04:00
|
|
|
t.same(
|
2016-03-23 08:22:09 -04:00
|
|
|
Object.keys(translations['wedo2'][isoCodes[i]]).sort(),
|
2016-03-22 16:26:16 -04:00
|
|
|
keysToCheck,
|
2016-03-23 08:22:09 -04:00
|
|
|
'check About keys for language ' + isoCodes[i]
|
2016-03-22 16:26:16 -04:00
|
|
|
);
|
|
|
|
}
|
|
|
|
t.end();
|
|
|
|
});
|