Browse Source

fix(gui-v2): make i18n globally available outside setup

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3457/head
Pranav C 2 years ago
parent
commit
33a4a08811
  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 { defineNuxtPlugin } from 'nuxt/app'
import { createI18n } from 'vue-i18n' import { createI18n } from 'vue-i18n'
let i18n: ReturnType<typeof createI18n>
export const createI18nPlugin = async () => export const createI18nPlugin = async () =>
createI18n({ createI18n({
locale: 'en', // Set the initial locale locale: 'en', // Set the initial locale
@ -44,9 +46,11 @@ export const createI18nPlugin = async () =>
}) })
export default defineNuxtPlugin(async (nuxtApp) => { export default defineNuxtPlugin(async (nuxtApp) => {
const i18n = await createI18nPlugin() i18n = (await createI18nPlugin()) as any
nuxtApp.vueApp.i18n = i18n.global as any nuxtApp.vueApp.i18n = i18n.global as any
nuxtApp.vueApp.use(i18n) nuxtApp.vueApp.use(i18n)
}) })
export const getI18n = () => i18n

Loading…
Cancel
Save