diff --git a/app/localization/translateMissing.js b/app/localization/translateMissing.js index 082e19c..017c9c8 100644 --- a/app/localization/translateMissing.js +++ b/app/localization/translateMissing.js @@ -66,11 +66,11 @@ async function updateTranslations() { // For each language, read in any missing translations // and translate - for (let i = 0; i < languageDirectories.length; i++) { + for (const languageDirectory of languageDirectories) { // Check to make sure each language has the proper files try { - const languageRoot = `${root}/${languageDirectories[i]}`; + const languageRoot = `${root}/${languageDirectory}`; const translationFile = `${languageRoot}/translation.json`; const missingTranslationFile = `${languageRoot}/translation.missing.json`; @@ -80,7 +80,7 @@ async function updateTranslations() { if (translationExists && translationMissingExists) { // Read in contents of files - let translations = JSON.parse(fs.readFileSync(translationFile, { + const translations = JSON.parse(fs.readFileSync(translationFile, { encoding: "utf8" })); const missing = JSON.parse(fs.readFileSync(missingTranslationFile, { @@ -92,15 +92,15 @@ async function updateTranslations() { if (missingKeys.length > 0){ // Translate each of the missing keys to the target language - for (let j = 0; j < missingKeys.length; j++){ - const googleTranslation = await translate.translate(missingKeys[j], { + for (const missingKey of missingKeys){ + const googleTranslation = await translate.translate(missingKey, { from: fromLanguage, - to: languageDirectories[i] + to: languageDirectory }); // Only set if a value is returned if (googleTranslation.length > 0){ - translations[missingKeys[j]] = googleTranslation[0]; + translations[missingKey] = googleTranslation[0]; } } @@ -108,17 +108,17 @@ async function updateTranslations() { fs.writeFileSync(translationFile, JSON.stringify(translations, null, 2)); fs.writeFileSync(missingTranslationFile, JSON.stringify({}, null, 2)); - console.log(`Successfully updated translations for ${languageDirectories[i]}`); + console.log(`Successfully updated translations for ${languageDirectory}`); } else { - console.log(`Skipped creating translations for ${languageDirectories[i]}; none found!`); + console.log(`Skipped creating translations for ${languageDirectory}; none found!`); } } else { // Log if we failed if (!translationExists) { - console.error(`Could not generate translations for language '${languageDirectories[i]}' because ${translationFile} does not exist, skipping!`); + console.error(`Could not generate translations for language '${languageDirectory}' because ${translationFile} does not exist, skipping!`); } else if (!translationMissingExists) { - console.error(`Could not generate translations for language '${languageDirectories[i]}' because ${missingTranslationFile} does not exist, skipping!`); + console.error(`Could not generate translations for language '${languageDirectory}' because ${missingTranslationFile} does not exist, skipping!`); } } } catch (error) { diff --git a/app/localization/whitelist.js b/app/localization/whitelist.js index 255963c..3708e91 100644 --- a/app/localization/whitelist.js +++ b/app/localization/whitelist.js @@ -70,10 +70,10 @@ const Whitelist = (function() { buildSubmenu: function(channel, i18nextMainBackend) { let submenu = []; - for (let i = 0; i < keys.length; i++) { + for (const key of keys) { submenu.push({ - label: whitelistMap[keys[i]], - click: clickFunction(channel, keys[i], i18nextMainBackend) + label: whitelistMap[key], + click: clickFunction(channel, key, i18nextMainBackend) }); } diff --git a/package-lock.json b/package-lock.json index e375d11..681acad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { "name": "secure-electron-template", - "version": "10.1.0", + "version": "10.1.1", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "10.1.0", + "version": "10.1.1", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index c0e3fa5..e40cd6b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "secure-electron-template", - "version": "10.1.0", + "version": "10.1.1", "description": "The best way to build Electron apps with security in mind.", "private": true, "main": "app/electron/main.js",