全局语言切换为中文
This commit is contained in:
parent
9fa13db1ad
commit
c68c3abb73
@ -14,8 +14,8 @@ const messages = {
|
||||
'en-US': {} // 英文使用key作为默认值
|
||||
}
|
||||
|
||||
// 全局语言状态 - 默认英文
|
||||
export const locale = ref('en-US')
|
||||
// 全局语言状态
|
||||
export const locale = ref('zh-CN')
|
||||
|
||||
// 翻译函数 - 支持 t("自然英文") 语法
|
||||
export function t(key: string) {
|
||||
@ -45,9 +45,6 @@ export function initLocale() {
|
||||
const saved = localStorage.getItem('locale')
|
||||
if (saved && locales.some(l => l.code === saved)) {
|
||||
locale.value = saved
|
||||
} else {
|
||||
// 如果没有保存的语言,默认使用英文
|
||||
locale.value = 'en-US'
|
||||
}
|
||||
// 初始化时设置 HTML 的 lang 属性
|
||||
if (typeof document !== 'undefined') {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user