Browse Source

Merge pull request #3457 from nocodb/fix/i18n-global-access

fix(gui-v2): make i18n globally available outside setup
pull/2760/head
navi 2 years ago committed by GitHub
parent
commit
9100d00ec9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      packages/nc-gui-v2/plugins/a.i18n.ts

6
packages/nc-gui-v2/plugins/a.i18n.ts

@ -1,6 +1,8 @@
import { defineNuxtPlugin } from 'nuxt/app'
import { createI18n } from 'vue-i18n'
let i18n: ReturnType<typeof createI18n>
export const createI18nPlugin = async () =>
createI18n({
locale: 'en', // Set the initial locale
@ -44,9 +46,11 @@ export const createI18nPlugin = async () =>
})
export default defineNuxtPlugin(async (nuxtApp) => {
const i18n = await createI18nPlugin()
i18n = (await createI18nPlugin()) as any
nuxtApp.vueApp.i18n = i18n.global as any
nuxtApp.vueApp.use(i18n)
})
export const getI18n = () => i18n

Loading…
Cancel
Save