mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-05-15 07:11:09 -04:00
don't overwrite english defaults from local l10n.json source files with transifex download
This commit is contained in:
parent
e67ce6c6cb
commit
033a0f5dcd
1 changed files with 9 additions and 4 deletions
|
@ -106,7 +106,9 @@ for ( var l in languages ) {
|
||||||
l + '.json'
|
l + '.json'
|
||||||
);
|
);
|
||||||
fs.accessSync(langTranslations);
|
fs.accessSync(langTranslations);
|
||||||
generalLocales[l] = JSON.parse(fs.readFileSync(langTranslations, 'utf8'));
|
if (l !== 'en') {
|
||||||
|
generalLocales[l] = JSON.parse(fs.readFileSync(langTranslations, 'utf8'));
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// just use english
|
// just use english
|
||||||
generalLocales[l] = generalLocales['en'];
|
generalLocales[l] = generalLocales['en'];
|
||||||
|
@ -128,7 +130,7 @@ var localizedAssetUrls = {};
|
||||||
// - the route name
|
// - the route name
|
||||||
// - the transifex resource
|
// - the transifex resource
|
||||||
// Add exceptions:
|
// Add exceptions:
|
||||||
// - txMapping: if the name of the transifex resource is different from the route name
|
// - txMapping: if the name of the transifex resource is different from the route name
|
||||||
var txMapping = {
|
var txMapping = {
|
||||||
'projects': 'preview',
|
'projects': 'preview',
|
||||||
'scratch_1.4': 'scratch_14' // transifex doesn't allow dots in resource names
|
'scratch_1.4': 'scratch_14' // transifex doesn't allow dots in resource names
|
||||||
|
@ -228,8 +230,11 @@ async.forEachLimit(views, 5, function (view, cb) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
viewLocales[isoCode] = merge({}, generalLocales[isoCode], JSON.parse(data));
|
// don't overwrite english view strings
|
||||||
defaults(viewLocales[isoCode], viewLocales['en']);
|
if (isoCode !== 'en') {
|
||||||
|
viewLocales[isoCode] = merge({}, generalLocales[isoCode], JSON.parse(data));
|
||||||
|
defaults(viewLocales[isoCode], viewLocales['en']);
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return cb(e);
|
return cb(e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue