Skip to content

Commit

Permalink
simplify things
Browse files Browse the repository at this point in the history
  • Loading branch information
ulfgebhardt committed Mar 26, 2024
1 parent bbc0b8a commit d516d87
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions presenter/src/components/language/LanguageSelector.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<v-select
v-model="$i18n.locale"
v-model="selectedLocale"
density="compact"
name="language"
:items="languages"
Expand Down Expand Up @@ -37,12 +37,15 @@ import { localizedLocale } from '#src/locales'
const pageContext = usePageContext()
const languages = ref(localizedLocale)
const selectedLocale = ref(i18n.global.locale.value)
const updateLanguage = () => {
const { locale } = pageContext
window.location.href = window.location.href.replace(
`/${locale}/`,
`/${i18n.global.locale.value}/`,
)
const { locale, urlOriginal } = pageContext
window.location.href = urlOriginal
// eslint-disable-next-line security/detect-non-literal-regexp
.replace(new RegExp(`/(${locale})?(.*)`, 'g'), `/${selectedLocale.value}/$2`)
.replace(/(\/(#|\?))?/g, '$2')
}
</script>

Expand Down

0 comments on commit d516d87

Please sign in to comment.