From d39512db0ac8969d44d6b7564c2a5815ebb7eda7 Mon Sep 17 00:00:00 2001 From: absidue <48293849+absidue@users.noreply.github.com> Date: Wed, 19 Oct 2022 03:25:13 +0200 Subject: [PATCH] Minor performance improvement in the general-settings component (#2723) --- .../general-settings/general-settings.js | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/renderer/components/general-settings/general-settings.js b/src/renderer/components/general-settings/general-settings.js index d7332c93..692dbce6 100644 --- a/src/renderer/components/general-settings/general-settings.js +++ b/src/renderer/components/general-settings/general-settings.js @@ -109,26 +109,27 @@ export default Vue.extend({ }, localeOptions: function () { - return ['system'].concat(this.$i18n.allLocales) + return [ + 'system', + ...this.$i18n.allLocales + ] }, localeNames: function () { + if (process.env.NODE_ENV !== 'development' || !process.env.IS_ELECTRON) { + return [ + this.$t('Settings.General Settings.System Default'), + ...process.env.LOCALE_NAMES + ] + } + const names = [ this.$t('Settings.General Settings.System Default') ] - if (process.env.NODE_ENV === 'development' && process.env.IS_ELECTRON) { - Object.entries(this.$i18n.messages).forEach(([locale, localeData]) => { - const localeName = localeData['Locale Name'] - if (typeof localeName !== 'undefined') { - names.push(localeName) - } else { - names.push(locale) - } - }) - } else { - names.push(...process.env.LOCALE_NAMES) - } + Object.entries(this.$i18n.messages).forEach(([locale, localeData]) => { + names.push(localeData['Locale Name'] ?? locale) + }) return names },