diff --git a/external/importL10n/locales.js b/external/importL10n/locales.js index 0a0e7cb72..54191ecbf 100644 --- a/external/importL10n/locales.js +++ b/external/importL10n/locales.js @@ -46,6 +46,13 @@ function downloadLanguageCodes() { response.on('end', function() { content = content.trim(); // Remove any leading/trailing white-space. var langCodes = normalizeText(content).split('\n'); + // Remove all locales that we don't want to download below. + for (var langCode of [DEFAULT_LOCALE, ...EXCLUDE_LANG_CODES]) { + var i = langCodes.indexOf(langCode); + if (i > -1) { + langCodes.splice(i, 1); + } + } resolve(langCodes); }); } else { @@ -107,8 +114,7 @@ async function downloadL10n(root, callback) { var langCodes = await downloadLanguageCodes(); for (var langCode of langCodes) { - if (!langCode || langCode === DEFAULT_LOCALE || - EXCLUDE_LANG_CODES.includes(langCode)) { + if (!langCode) { continue; } await downloadLanguageFiles(root, langCode); @@ -119,7 +125,7 @@ async function downloadL10n(root, callback) { var dirPath = path.join(root, entry), stat = fs.lstatSync(dirPath); if (stat.isDirectory() && entry !== DEFAULT_LOCALE && - (!langCodes.includes(entry) || EXCLUDE_LANG_CODES.includes(entry))) { + !langCodes.includes(entry)) { removeCodes.push(entry); } }