Minor performance improvement in the general-settings component (#2723)

This commit is contained in:
absidue 2022-10-19 03:25:13 +02:00 committed by GitHub
parent d8f7d073ce
commit d39512db0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 13 deletions

View File

@ -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)
}
names.push(localeData['Locale Name'] ?? locale)
})
} else {
names.push(...process.env.LOCALE_NAMES)
}
return names
},