mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-27 15:45:56 -05:00
[web] Fix settings page not displaying properly when the language is not found
When the user is using a language that is not available in OwnTone, the fallback language is set to English.
This commit is contained in:
parent
f934aadb67
commit
dcbdee6598
@ -197,25 +197,20 @@ export default {
|
||||
},
|
||||
|
||||
computed: {
|
||||
settings_option_show_composer_now_playing() {
|
||||
return this.$store.getters.settings_option_show_composer_now_playing
|
||||
},
|
||||
|
||||
settings_option_show_filepath_now_playing() {
|
||||
return this.$store.getters.settings_option_show_filepath_now_playing
|
||||
},
|
||||
|
||||
locale: {
|
||||
get() {
|
||||
const languages = this.$i18n.availableLocales
|
||||
let locale = languages.find((lang) => lang === this.$i18n.locale)
|
||||
let partial = this.$i18n.locale.split('-')[0]
|
||||
const [partial] = this.$i18n.locale.split('-')
|
||||
if (!locale) {
|
||||
locale = languages.find((lang) => lang === partial)
|
||||
}
|
||||
if (!locale) {
|
||||
locale = languages.forEach((lang) => lang.split('-')[0] === partial)
|
||||
}
|
||||
if (!locale) {
|
||||
locale = this.$i18n.fallbackLocale
|
||||
}
|
||||
return locale
|
||||
},
|
||||
set(locale) {
|
||||
@ -224,10 +219,17 @@ export default {
|
||||
},
|
||||
locales: {
|
||||
get() {
|
||||
return this.$i18n.availableLocales.map((item) => {
|
||||
return { id: item, name: this.$t('language.' + item) }
|
||||
})
|
||||
return this.$i18n.availableLocales.map((item) => ({
|
||||
id: item,
|
||||
name: this.$t(`language.${item}`)
|
||||
}))
|
||||
}
|
||||
},
|
||||
settings_option_show_composer_now_playing() {
|
||||
return this.$store.getters.settings_option_show_composer_now_playing
|
||||
},
|
||||
settings_option_show_filepath_now_playing() {
|
||||
return this.$store.getters.settings_option_show_filepath_now_playing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user