mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-27 17:45:52 -05:00
b123650988
1. checks the localization for a few reference languages for the nav bar 2. for our localized pages (splash, about, wedo2), it checks to see that there are locale strings, whether or not they're english (to make sure at least something is on the page).
50 lines
1.5 KiB
JavaScript
50 lines
1.5 KiB
JavaScript
/*
|
|
* spot checks the translation of the nav bar for a select set
|
|
* of languages that cover a number of types of translations.
|
|
*
|
|
* Languages checked:
|
|
* - Hebrew
|
|
* - Edible Scratch (fake language)
|
|
* - Mandarin
|
|
* - Japanese
|
|
* - Brasilian Portuguese
|
|
* - Polish
|
|
* - Norwegian
|
|
* - German
|
|
*/
|
|
var tap = require('tap');
|
|
window = {};
|
|
require('../../intl/splash.intl.js');
|
|
|
|
var languagesToCheck = [
|
|
'he', 'zh-cn', 'ja', 'pt-br', 'pl', 'nb'
|
|
];
|
|
var idsToCheck = [
|
|
'general.about', 'general.create', 'general.help', 'general.joinScratch',
|
|
'general.signIn', 'general.discuss'
|
|
];
|
|
|
|
tap.test('spotCheckNavBar', function (t) {
|
|
for (var i in languagesToCheck) {
|
|
for (var j in idsToCheck) {
|
|
t.notEqual(
|
|
window._messages[languagesToCheck[i]][idsToCheck[j]],
|
|
window._messages['en'][idsToCheck[j]],
|
|
'check localization of ' + idsToCheck[j] + ' for ' + languagesToCheck[i]
|
|
);
|
|
}
|
|
}
|
|
t.end();
|
|
});
|
|
|
|
var fakeLanguageIdsToCheck = ['news.scratchNews', 'splash.featuredProjects', 'splash.featuredStudios'];
|
|
tap.test('spotCheckNavBarFakeLanguage', function (t) {
|
|
for (var i in fakeLanguageIdsToCheck) {
|
|
t.notEqual(
|
|
window._messages['yum'][fakeLanguageIdsToCheck[i]],
|
|
window._messages['en'][fakeLanguageIdsToCheck[i]],
|
|
'check localization of ' + fakeLanguageIdsToCheck[i] + ' for yum'
|
|
);
|
|
}
|
|
t.end();
|
|
});
|