mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-30 10:58:23 -05:00
c448b15dd4
This makes a couple of procedure-specific parts into methods in `locale-compare`, so that they can be tested more readily.
36 lines
1.2 KiB
JavaScript
36 lines
1.2 KiB
JavaScript
/*
|
|
* spot check that each language has values for the string id keys on About page
|
|
* that are contained in English (i.e. make sure strings will show up, not ids")
|
|
*/
|
|
var merge = require('lodash.merge');
|
|
var path = require('path');
|
|
var tap = require('tap');
|
|
|
|
var languages = require('../../languages.json');
|
|
var localeCompare = require('../../bin/lib/locale-compare');
|
|
|
|
tap.test('spotCheckAboutStrings', function (t) {
|
|
var isoCodes = Object.keys(languages);
|
|
isoCodes.splice(isoCodes.indexOf('en'), 1);
|
|
var viewLocales = {};
|
|
var idsWithICU = {};
|
|
var icuWithIds = {};
|
|
localeCompare.getIdsForView(
|
|
'about',
|
|
path.resolve(__dirname, '../../src/views/about/l10n.json'),
|
|
viewLocales,
|
|
idsWithICU,
|
|
icuWithIds
|
|
);
|
|
var md5WithIds = localeCompare.getMD5Map(icuWithIds);
|
|
var keysToCheck = Object.keys(merge(viewLocales['about']['en'])).sort();
|
|
for (var i in isoCodes) {
|
|
var translations = localeCompare.getTranslationsForLanguage(isoCodes[i], idsWithICU, md5WithIds);
|
|
t.same(
|
|
Object.keys(translations['about'][isoCodes[i]]).sort(),
|
|
keysToCheck,
|
|
'check About keys for language ' + isoCodes[i]
|
|
);
|
|
}
|
|
t.end();
|
|
});
|