mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.9 KiB
57 lines
1.9 KiB
3 years ago
|
import { defineNuxtPlugin } from 'nuxt/app'
|
||
|
import { createI18n } from 'vue-i18n'
|
||
|
|
||
2 years ago
|
let i18n: ReturnType<typeof createI18n>
|
||
|
|
||
3 years ago
|
export const createI18nPlugin = async () =>
|
||
|
createI18n({
|
||
3 years ago
|
locale: 'en', // Set the initial locale
|
||
3 years ago
|
|
||
3 years ago
|
fallbackLocale: 'en', // Set the fallback locale in case the current locale can't be found
|
||
3 years ago
|
|
||
3 years ago
|
legacy: false, // disable legacy API (we use the composition API and inject utilities)
|
||
3 years ago
|
|
||
3 years ago
|
globalInjection: true, // enable global injection, so all utilities are injected into all components
|
||
3 years ago
|
|
||
3 years ago
|
// Associate each locale to a content file
|
||
|
messages: {
|
||
|
en: await import('~/lang/en.json'),
|
||
|
zh_HK: await import('~/lang/zh_HK.json'),
|
||
|
zh_TW: await import('~/lang/zh_TW.json'),
|
||
|
zh_CN: await import('~/lang/zh_CN.json'),
|
||
|
ja: await import('~/lang/ja.json'),
|
||
|
fr: await import('~/lang/fr.json'),
|
||
|
es: await import('~/lang/es.json'),
|
||
|
de: await import('~/lang/de.json'),
|
||
|
id: await import('~/lang/id.json'),
|
||
|
it_IT: await import('~/lang/it_IT.json'),
|
||
|
ko: await import('~/lang/ko.json'),
|
||
|
lv: await import('~/lang/lv.json'),
|
||
|
nl: await import('~/lang/nl.json'),
|
||
|
ru: await import('~/lang/ru.json'),
|
||
|
sv: await import('~/lang/sv.json'),
|
||
|
da: await import('~/lang/da.json'),
|
||
|
vi: await import('~/lang/vi.json'),
|
||
|
no: await import('~/lang/no.json'),
|
||
|
iw: await import('~/lang/iw.json'),
|
||
|
fi: await import('~/lang/fi.json'),
|
||
|
uk: await import('~/lang/uk.json'),
|
||
|
hr: await import('~/lang/hr.json'),
|
||
|
th: await import('~/lang/th.json'),
|
||
|
sl: await import('~/lang/sl.json'),
|
||
|
pt_BR: await import('~/lang/pt_BR.json'),
|
||
|
fa: await import('~/lang/fa.json'),
|
||
|
tr: await import('~/lang/tr.json'),
|
||
|
},
|
||
3 years ago
|
})
|
||
3 years ago
|
|
||
3 years ago
|
export default defineNuxtPlugin(async (nuxtApp) => {
|
||
2 years ago
|
i18n = (await createI18nPlugin()) as any
|
||
3 years ago
|
|
||
2 years ago
|
nuxtApp.vueApp.i18n = i18n.global as any
|
||
3 years ago
|
|
||
3 years ago
|
nuxtApp.vueApp.use(i18n)
|
||
3 years ago
|
})
|
||
2 years ago
|
|
||
|
export const getI18n = () => i18n
|