Skip to content

Commit

Permalink
[web] Fix settings page not displaying properly when the language is …
Browse files Browse the repository at this point in the history
…not found

When the user is using a language that is not available in OwnTone, the fallback language is set to English.
  • Loading branch information
hacketiwack committed Aug 6, 2023
1 parent f934aad commit dcbdee6
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions web-src/src/pages/PageSettingsWebinterface.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
}
}
}
Expand Down

0 comments on commit dcbdee6

Please sign in to comment.