Skip to content
Snippets Groups Projects
Commit 899972ae authored by Pierre-Jean CHANCELLIER's avatar Pierre-Jean CHANCELLIER
Browse files

keep the good language when going back in history

parent 6ad86b0b
No related branches found
No related tags found
No related merge requests found
<template> <template>
<div> <div>
<select class="form-control" @change="saveLocale($event)" v-model="lang"> <select class="form-control" @change="saveLocale($event)" v-model="$i18n.locale">
<option v-for="lang in $i18n.locales" :key="lang.code" :value="lang.code">{{ lang.name }}</option> <option v-for="lang in $i18n.locales" :key="lang.code" :value="lang.code">{{ lang.name }}</option>
</select> </select>
</div> </div>
...@@ -8,14 +8,9 @@ ...@@ -8,14 +8,9 @@
<script> <script>
export default { export default {
data() {
return {
lang: this.$i18n.locale
}
},
methods: { methods: {
saveLocale(e) { saveLocale(e) {
this.lang = e.target.value this.$i18n.locale = e.target.value
this.$i18n.setLocaleCookie(e.target.value) this.$i18n.setLocaleCookie(e.target.value)
this.$router.push(this.switchLocalePath(e.target.value)) this.$router.push(this.switchLocalePath(e.target.value))
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment