From 033a0f5dcd08cc81b0930a245f6075ecd2fa1306 Mon Sep 17 00:00:00 2001 From: Ben Wheeler Date: Mon, 13 May 2019 11:24:38 -0400 Subject: [PATCH] don't overwrite english defaults from local l10n.json source files with transifex download --- bin/build-locales | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/bin/build-locales b/bin/build-locales index 0c2c20d4d..d9af2135b 100755 --- a/bin/build-locales +++ b/bin/build-locales @@ -106,7 +106,9 @@ for ( var l in languages ) { l + '.json' ); fs.accessSync(langTranslations); - generalLocales[l] = JSON.parse(fs.readFileSync(langTranslations, 'utf8')); + if (l !== 'en') { + generalLocales[l] = JSON.parse(fs.readFileSync(langTranslations, 'utf8')); + } } catch (err) { // just use english generalLocales[l] = generalLocales['en']; @@ -128,7 +130,7 @@ var localizedAssetUrls = {}; // - the route name // - the transifex resource // 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 = { 'projects': 'preview', '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 { - viewLocales[isoCode] = merge({}, generalLocales[isoCode], JSON.parse(data)); - defaults(viewLocales[isoCode], viewLocales['en']); + // don't overwrite english view strings + if (isoCode !== 'en') { + viewLocales[isoCode] = merge({}, generalLocales[isoCode], JSON.parse(data)); + defaults(viewLocales[isoCode], viewLocales['en']); + } } catch (e) { return cb(e); }