Skip to content

Commit

Permalink
feat: add i18n support to vuetify #194
Browse files Browse the repository at this point in the history
  • Loading branch information
wazolab committed Mar 13, 2024
1 parent 2cfb3de commit d265163
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
11 changes: 10 additions & 1 deletion components/MainMap/NavMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type { LocaleObject } from 'vue-i18n-routing'
import { VDivider } from 'vuetify/components/VDivider'
import { VList, VListItem, VListItemTitle } from 'vuetify/components/VList'
import { VMenu } from 'vuetify/components/VMenu'
import { useLocale } from 'vuetify'
import { defineNuxtComponent } from '#app'
import ExternalLink from '~/components/UI/ExternalLink.vue'
import IconButton from '~/components/UI/IconButton.vue'
Expand Down Expand Up @@ -34,6 +34,14 @@ export default defineNuxtComponent({
},
},
setup() {
const { current } = useLocale()
return {
vuetifyLocale: current,
}
},
computed: {
...mapWritableState(siteStore, ['locale']),
Expand All @@ -46,6 +54,7 @@ export default defineNuxtComponent({
async setLocale(locale: string) {
await this.$i18n.setLocale(locale)
this.locale = locale
this.vuetifyLocale = locale
},
openLink(title: string, url: string) {
this.$tracking({
Expand Down
6 changes: 6 additions & 0 deletions plugins/vuetify.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import { createVuetify } from 'vuetify'
import { aliases, mdi } from 'vuetify/iconsets/mdi-svg'
import { en, es, fr } from 'vuetify/locale'
import 'vuetify/styles'

import { defineNuxtPlugin } from '#app/nuxt'

export default defineNuxtPlugin((nuxtApp) => {
const vuetify = createVuetify({
locale: {
locale: 'en',
fallback: 'en',
messages: { en, es, fr },
},
icons: {
defaultSet: 'mdi',
aliases,
Expand Down

0 comments on commit d265163

Please sign in to comment.