Skip to content

Commit 237fc4a

Browse files
hacherawkarngyan
authored andcommitted
Adds a language switcher
1 parent 407a32e commit 237fc4a

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Diff for: components/TheNavBar.vue

+6
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
</div>
2828
</div>
2929
<div class="hidden md:flex flex-row space-x-2 items-center justify-center">
30+
<div v-if="$config.laguageSwitcher.enabled">
31+
<nuxt-link v-for="locale in availableLocales" :key="locale.code" :to="switchLocalePath(locale.code)" class="text-gray-300 hover:text-white" >{{ locale.name }}</nuxt-link>
32+
</div>
3033
<div v-if="$config.firebase.enabled">
3134
<div v-if="!user" @click="signInUser" class="active cursor-pointer text-gray-300 hover:bg-gray-700 hover:text-white px-3 py-2 rounded-md text-sm font-bold">{{ $t('nav.signIn')}}</div>
3235
<div v-else @click="signOutUser" class="active cursor-pointer text-gray-300 hover:bg-gray-700 hover:text-white px-3 py-2 rounded-md text-sm font-bold">{{ $t('nav.signOut')}}</div>
@@ -93,6 +96,9 @@ export default {
9396
computed: {
9497
user() {
9598
return this.$store.state.user
99+
},
100+
availableLocales () {
101+
return this.$i18n.locales.filter(i => i.code !== this.$i18n.locale)
96102
}
97103
},
98104
data() {

Diff for: karngyan.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ export default {
8686
// three-bounce
8787
// wandering-cubes
8888
},
89+
laguageSwitcher: {
90+
enabled: true,
91+
},
8992
strings: {
9093
en_US: {
9194
download: 'download',

0 commit comments

Comments
 (0)