Initial commit of akmon project
This commit is contained in:
47
i18n/index.uts
Normal file
47
i18n/index.uts
Normal file
@@ -0,0 +1,47 @@
|
||||
// i18n配置文件
|
||||
import { createI18n } from '@/uni_modules/ak-i18n/index.uts'
|
||||
|
||||
// 导入语言包
|
||||
import zhCNCommon from './zh-CN/common.uts'
|
||||
import zhCNUser from './zh-CN/user.uts'
|
||||
import zhCNMtCommon from './zh-CN/mt/common.uts'
|
||||
|
||||
import enUSCommon from './en-US/common.uts'
|
||||
import enUSUser from './en-US/user.uts'
|
||||
import enUSMtCommon from './en-US/mt/common.uts'
|
||||
|
||||
|
||||
// 组织 zh-CN 语言包 (使用对象扩展避免修改readonly对象)
|
||||
const mt_zhCN = {
|
||||
...zhCNMtCommon
|
||||
}
|
||||
|
||||
const zhCN = {
|
||||
...zhCNCommon,
|
||||
user: zhCNUser,
|
||||
mt: mt_zhCN
|
||||
}
|
||||
|
||||
// 组织 en-US 语言包 (仿照 zhCN 的 UTSJSONObject 结构)
|
||||
const mt_enUS = {
|
||||
...enUSMtCommon,
|
||||
}
|
||||
|
||||
const enUS = {
|
||||
...enUSCommon,
|
||||
user: enUSUser,
|
||||
mt: mt_enUS
|
||||
}
|
||||
|
||||
// 创建i18n实例
|
||||
const i18n = createI18n({
|
||||
// locale: (uni.getStorageSync('uVueI18nLocale') as string) ?? 'zh-CN', // 默认语言,从缓存获取或使用中文
|
||||
locale: 'zh-CN',
|
||||
fallbackLocale: 'en-US',
|
||||
messages: {
|
||||
'zh-CN': zhCN,
|
||||
'en-US': enUS
|
||||
}
|
||||
})
|
||||
|
||||
export default i18n
|
||||
Reference in New Issue
Block a user