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