UNPKG

@cataract6545/tmui

Version:

tm-vuetify是一个新势力由主题驱动的UI组件库,相比其它优势大,组件全,设计趋势紧跟未来。具有主题生成,主题实时切换,暗黑实时切换,lottie动画,图表等新颖功能,tmui TMUI

37 lines (36 loc) 914 B
//配置国际化标准语言。 import en from '../../locale/en.json' import zhHans from '../../locale/zh-Hans.json' import { createI18n, I18nOptions, } from 'vue-i18n' import { initVueI18n} from '@dcloudio/uni-i18n' export const language= function(key:string){ const messages:any = { en, 'zh-Hans':zhHans } let i18nConfig:I18nOptions | undefined = { locale: uni.getLocale(),// 获取已设置的语言 messages } // #ifndef APP-NVUE const i18n = createI18n(i18nConfig) return i18n.global.t(key) // #endif // #ifdef APP-NVUE const { t } = initVueI18n(messages) return t(key); // #endif } //保留原始调用方法。 export const languageByGlobal= function(){ const messages = { en, 'zh-Hans':zhHans } let i18nConfig = { locale: uni.getLocale(),// 获取已设置的语言 messages } const i18n = createI18n(i18nConfig) return i18n }