From da8cdb8ca1dd22b0fafe19b83b37953a4a2e73fd Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Tue, 10 Oct 2023 21:52:41 -0400 Subject: [PATCH] enable i18n for vuetify --- src/i18n.js | 1 + src/plugins/vuetify.js | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/i18n.js b/src/i18n.js index 2aaebcc1..0178a1a9 100644 --- a/src/i18n.js +++ b/src/i18n.js @@ -14,6 +14,7 @@ function loadLocaleMessages() { } export default createI18n({ + legacy: false, locale: process.env.VUE_APP_I18N_LOCALE || navigator.language.split('-')[0] || 'en', fallbackLocale: process.env.VUE_APP_I18N_FALLBACK_LOCALE || 'en', messages: loadLocaleMessages(), diff --git a/src/plugins/vuetify.js b/src/plugins/vuetify.js index cb12a1e8..2758a9a5 100644 --- a/src/plugins/vuetify.js +++ b/src/plugins/vuetify.js @@ -3,6 +3,9 @@ import { createVuetify } from 'vuetify'; import { aliases, fa } from 'vuetify/iconsets/fa' import { VDataTable } from 'vuetify/labs/VDataTable' import '@fortawesome/fontawesome-free/css/all.css' +import { createVueI18nAdapter } from 'vuetify/locale/adapters/vue-i18n' +import { useI18n } from 'vue-i18n' +import { i18n } from '../i18n.js' import * as components from 'vuetify/components' import * as directives from 'vuetify/directives' @@ -30,7 +33,10 @@ const vuetify = createVuetify({ } } } - } + }, + locale: { + adapter: createVueI18nAdapter({ i18n, useI18n }), + }, }) export default vuetify;