lang url parameter (#296)

* lang url parameter

* add ?lang to readme.

---------

Co-authored-by: Miroslav Šedivý <sedivy.miro@gmail.com>
This commit is contained in:
mbattista
2023-04-22 01:24:23 +02:00
committed by GitHub
parent a32be0b44a
commit cd4acb5eec
4 changed files with 10 additions and 0 deletions

View File

@ -76,5 +76,12 @@
about() {
this.$accessor.client.toggleAbout()
}
mounted() {
const default_lang = new URL(location.href).searchParams.get('lang')
if (default_lang && this.langs.includes(default_lang)) {
this.$i18n.locale = default_lang
}
}
}
</script>

View File

@ -6,5 +6,6 @@ Vue.use(VueI18n)
export const i18n = new VueI18n({
locale: 'en',
fallbackLocale: 'en',
messages,
})