mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-27 07:16:19 +09:00
27 lines
473 B
TypeScript
27 lines
473 B
TypeScript
import { createI18n } from 'vue-i18n'
|
|
import en from '@/i18n/locales/en.json'
|
|
import zh from '@/i18n/locales/zh.json'
|
|
import { computed } from 'vue'
|
|
|
|
export type Locale = 'en' | 'zh'
|
|
|
|
const i18n = createI18n<typeof en | typeof zh, Locale>({
|
|
locale: 'en',
|
|
legacy: false,
|
|
fallbackLocale: 'en',
|
|
messages: {
|
|
en,
|
|
zh
|
|
}
|
|
})
|
|
|
|
export default i18n
|
|
|
|
const t = i18n.global.t
|
|
|
|
export const i18nRef = (arg:string) => {
|
|
return computed(() => {
|
|
return t(arg)
|
|
})
|
|
}
|