gancio/plugins/i18n.js
2022-11-29 14:40:19 +01:00

36 lines
1,012 B
JavaScript

export default async ({ app, store, res, $vuetify }) => {
$vuetify.lang.current = app.i18n.locale
app.i18n.onLanguageSwitched = (oldLocale, newLocale) => {
$vuetify.lang.current = newLocale
}
// const messages = {}
// if (process.server) {
// if (res.locals) {
// store.commit('setLocale', res.locals.acceptedLocale)
// if (res.locals.user_locale) {
// store.commit('setUserLocale', res.locals.user_locale)
// }
// }
// }
// messages[store.state.locale] = await import(/* webpackChunkName: "lang-[request]" */`../locales/${store.state.locale}.json`)
// always include en fallback locale
// if (store.state.locale !== 'en') {
// messages.en = await import('../locales/en.json')
// }
// if (store.state.user_locale) {
// merge(messages[store.state.locale], store.state.user_locale)
// }
// Set i18n instance on app
// app.i18n = new VueI18n({
// locale: store.state.locale,
// fallbackLocale: 'en',
// messages
// })
}