Skip to content

Commit

Permalink
🐛 Fix translations not updating correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
greengiraffe committed Sep 15, 2023
1 parent 820651e commit 360d7e5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 19 deletions.
20 changes: 10 additions & 10 deletions src/components/LanguageSelect.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<template>
<div class="action language-select">
<select v-model="currentLanguage">
<select v-model="language">
<option
v-for="(lang, i) in langs"
:key="`Lang${i}`"
:key="lang"
:value="lang"
>
{{ lang }}
Expand All @@ -13,7 +13,6 @@
</template>

<script>
import {mapActions} from 'vuex'
export default {
name: 'LanguageSelect',
data() {
Expand All @@ -23,17 +22,18 @@ export default {
'de',
'zh'
],
currentLanguage: 'en'
}
},
watch: {
currentLanguage(v) {
this.setLanguage(v)
computed: {
language: {
get() {
return this.$store.state.language
},
set(value) {
this.$store.dispatch('setLanguage', value)
}
}
},
methods: {
...mapActions(['setLanguage'])
},
}
</script>

Expand Down
5 changes: 1 addition & 4 deletions src/components/ScoringTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<div class="cell cell--label">
<ToggleButton
v-model="showResults"
:name="totalText"
:name="$t('total')"
/>
</div>
<div
Expand Down Expand Up @@ -101,9 +101,6 @@ export default {
'showTotal',
'touchedPlayerTitles'
]),
totalText () {
return this.$t('total')
}
},
methods: {
score (scoreType, playerNum) {
Expand Down
6 changes: 1 addition & 5 deletions src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const loadState = () => {
state = defaultState;
}
}
i18n.global.locale = state.language;
return state;
};

Expand Down Expand Up @@ -152,10 +153,5 @@ export const store = createStore({
i18n.global.locale = language;
commit("setLanguage", language);
},

toggleLanguage({ state, dispatch }) {
const newLang = state.language === "en" ? "de" : "en";
dispatch("setLanguage", newLang);
},
},
});

1 comment on commit 360d7e5

@vercel
Copy link

@vercel vercel bot commented on 360d7e5 Sep 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.