refactor: ♻️ (i18n/lang)将语言包从 TypeScript 文件迁移到 JSON 文件

- 将 en.ts 和 zh-cn.ts 文件分别重命名为 en.json 和 zh-cn.json

- 更新导入路径以使用新的 JSON 文件

- 删除旧的 TypeScript 语言包文件

#ICWF9O
This commit is contained in:
zimo493
2025-09-04 20:41:48 +08:00
parent 328e093612
commit 39f9676288
5 changed files with 187 additions and 195 deletions

View File

@@ -2,8 +2,8 @@ import type { App } from "vue";
import { createI18n } from "vue-i18n";
import { useAppStoreHook } from "@/store/modules/app-store";
// 本地语言包
import enLocale from "./package/en";
import zhCnLocale from "./package/zh-cn";
import enLocale from "./package/en.json";
import zhCnLocale from "./package/zh-cn.json";
const appStore = useAppStoreHook();

91
src/lang/package/en.json Normal file
View File

@@ -0,0 +1,91 @@
{
"route": {
"dashboard": "Dashboard",
"document": "Document"
},
"login": {
"themeToggle": "Theme Switch",
"languageToggle": "Language Switch",
"dark": "Dark",
"light": "Light",
"username": "Username",
"password": "Password",
"login": "Login",
"captchaCode": "Verify Code",
"capsLock": "Caps Lock is On",
"rememberMe": "Remember Me",
"forgetPassword": "Forget Password?",
"message": {
"username": {
"required": "Please enter Username"
},
"password": {
"required": "Please enter Password",
"min": "The password can not be less than 6 digits",
"confirm": "Please confirm the password again",
"inconformity": "The two password entries are inconsistent"
},
"captchaCode": {
"required": "Please enter Verify Code"
}
},
"otherLoginMethods": "Other",
"resetPassword": "Reset password",
"thinkOfPasswd": "Remember your password?",
"register": "Register account",
"agree": "I have read and agree to the",
"userAgreement": "User Agreement",
"haveAccount": "Already have an account?",
"noAccount": "Don't have an account?",
"quickFill": "Quick fill",
"reg": "Register"
},
"navbar": {
"dashboard": "Dashboard",
"logout": "Logout",
"document": "Document",
"gitee": "Gitee",
"profile": "User Profile"
},
"sizeSelect": {
"tooltip": "Layout Size",
"default": "Default",
"large": "Large",
"small": "Small",
"message": {
"success": "Switch Layout Size Successful!"
}
},
"langSelect": {
"message": {
"success": "Switch Language Successful!"
}
},
"settings": {
"project": "Project Settings",
"theme": "Theme",
"interface": "Interface",
"navigation": "Navigation",
"themeColor": "Theme Color",
"showTagsView": "Show Tags View",
"showAppLogo": "Show App Logo",
"sidebarColorScheme": "Sidebar Color Scheme",
"showWatermark": "Show Watermark",
"classicBlue": "Classic Blue",
"minimalWhite": "Minimal White",
"copyConfig": "Copy Config",
"resetConfig": "Reset Default",
"copySuccess": "Configuration copied to clipboard",
"resetSuccess": "Reset to default configuration",
"copyDescription": "Copy config will generate current settings code, reset will restore all settings to default",
"confirmReset": "Are you sure to reset all settings to default? This operation cannot be undone.",
"applyToFile": "Apply to File",
"onlyCopy": "Only Copy",
"leftLayout": "Left Mode",
"topLayout": "Top Mode",
"mixLayout": "Mix Mode",
"configManagement": "Config Management",
"copyConfigDescription": "Generate current settings code and copy to clipboard, then overwrite src/settings.ts file",
"resetConfigDescription": "Restore all settings to system default values"
}
}

View File

@@ -1,96 +0,0 @@
export default {
// 菜单国际化
route: {
dashboard: "Dashboard",
document: "Document",
},
// 登录页面国际化
login: {
themeToggle: "Theme Switch",
languageToggle: "Language Switch",
dark: "Dark",
light: "Light",
username: "Username",
password: "Password",
login: "Login",
captchaCode: "Verify Code",
capsLock: "Caps Lock is On",
rememberMe: "Remember Me",
forgetPassword: "Forget Password?",
message: {
username: {
required: "Please enter Username",
},
password: {
required: "Please enter Password",
min: "The password can not be less than 6 digits",
confirm: "Please confirm the password again",
inconformity: "The two password entries are inconsistent",
},
captchaCode: {
required: "Please enter Verify Code",
},
},
otherLoginMethods: "Other",
resetPassword: "Reset password",
thinkOfPasswd: "Remember your password?",
register: "Register account",
agree: "I have read and agree to the",
userAgreement: "User Agreement",
haveAccount: "Already have an account?",
noAccount: "Don't have an account?",
quickFill: "Quick fill",
reg: "Register",
},
// 导航栏国际化
navbar: {
dashboard: "Dashboard",
logout: "Logout",
document: "Document",
gitee: "Gitee",
profile: "User Profile",
},
sizeSelect: {
tooltip: "Layout Size",
default: "Default",
large: "Large",
small: "Small",
message: {
success: "Switch Layout Size Successful!",
},
},
langSelect: {
message: {
success: "Switch Language Successful!",
},
},
settings: {
project: "Project Settings",
theme: "Theme",
interface: "Interface",
navigation: "Navigation",
themeColor: "Theme Color",
showTagsView: "Show Tags View",
showAppLogo: "Show App Logo",
sidebarColorScheme: "Sidebar Color Scheme",
showWatermark: "Show Watermark",
classicBlue: "Classic Blue",
minimalWhite: "Minimal White",
copyConfig: "Copy Config",
resetConfig: "Reset Default",
copySuccess: "Configuration copied to clipboard",
resetSuccess: "Reset to default configuration",
copyDescription:
"Copy config will generate current settings code, reset will restore all settings to default",
confirmReset: "Are you sure to reset all settings to default? This operation cannot be undone.",
applyToFile: "Apply to File",
onlyCopy: "Only Copy",
leftLayout: "Left Mode",
topLayout: "Top Mode",
mixLayout: "Mix Mode",
configManagement: "Config Management",
copyConfigDescription:
"Generate current settings code and copy to clipboard, then overwrite src/settings.ts file",
resetConfigDescription: "Restore all settings to system default values",
},
};

View File

@@ -0,0 +1,94 @@
{
"route": {
"dashboard": "首页",
"document": "项目文档"
},
"login": {
"themeToggle": "主题切换",
"languageToggle": "语言切换",
"dark": "暗黑",
"light": "明亮",
"username": "用户名",
"password": "密码",
"login": "登 录",
"captchaCode": "验证码",
"capsLock": "大写锁定已打开",
"rememberMe": "记住我",
"forgetPassword": "忘记密码?",
"message": {
"username": {
"required": "请输入用户名"
},
"password": {
"required": "请输入密码",
"min": "密码不能少于6位",
"confirm": "请再次确认密码",
"inconformity": "两次密码输入不一致"
},
"captchaCode": {
"required": "请输入验证码"
}
},
"otherLoginMethods": "其他",
"resetPassword": "重置密码",
"thinkOfPasswd": "想起密码?",
"register": "注册账号",
"agree": "我已同意并阅读",
"userAgreement": "用户协议",
"haveAccount": "已有账号?",
"noAccount": "您没有账号?",
"quickFill": "快速填写",
"reg": "注 册"
},
"navbar": {
"dashboard": "首页",
"logout": "退出登录",
"document": "项目文档",
"gitee": "项目地址",
"profile": "个人中心"
},
"sizeSelect": {
"tooltip": "布局大小",
"default": "默认",
"large": "大型",
"small": "小型",
"message": {
"success": "切换布局大小成功!"
}
},
"langSelect": {
"message": {
"success": "切换语言成功!"
}
},
"settings": {
"project": "项目配置",
"theme": "主题设置",
"interface": "界面设置",
"navigation": "导航设置",
"themeColor": "主题颜色",
"themeColorTip": "主题颜色",
"darkMode": "暗黑模式",
"layoutSetting": "布局设置",
"sidebarColorScheme": "侧边栏配色",
"showTagsView": "显示页签",
"showAppLogo": "显示Logo",
"showWatermark": "显示水印",
"classicBlue": "经典蓝",
"minimalWhite": "极简白",
"copyConfig": "复制配置",
"resetConfig": "重置默认",
"copySuccess": "配置已复制到剪贴板",
"resetSuccess": "已重置为默认配置",
"copyDescription": "复制配置将生成当前设置的代码,重置将恢复所有设置为默认值",
"confirmReset": "确定要重置所有设置为默认值吗?此操作不可恢复。",
"applyToFile": "应用到文件",
"onlyCopy": "仅复制",
"leftLayout": "左侧模式",
"topLayout": "顶部模式",
"mixLayout": "混合模式",
"configManagement": "配置管理",
"copyConfigDescription": "生成当前设置的代码并复制到剪贴板,然后覆盖 src/settings.ts 文件",
"resetConfigDescription": "恢复所有设置为系统默认值"
}
}

View File

@@ -1,97 +0,0 @@
export default {
// 菜单国际化
route: {
dashboard: "首页",
document: "项目文档",
},
// 登录页面国际化
login: {
themeToggle: "主题切换",
languageToggle: "语言切换",
dark: "暗黑",
light: "明亮",
username: "用户名",
password: "密码",
login: "登 录",
captchaCode: "验证码",
capsLock: "大写锁定已打开",
rememberMe: "记住我",
forgetPassword: "忘记密码?",
message: {
username: {
required: "请输入用户名",
},
password: {
required: "请输入密码",
min: "密码不能少于6位",
confirm: "请再次确认密码",
inconformity: "两次密码输入不一致",
},
captchaCode: {
required: "请输入验证码",
},
},
otherLoginMethods: "其他",
resetPassword: "重置密码",
thinkOfPasswd: "想起密码?",
register: "注册账号",
agree: "我已同意并阅读",
userAgreement: "用户协议",
haveAccount: "已有账号?",
noAccount: "您没有账号?",
quickFill: "快速填写",
reg: "注 册",
},
// 导航栏国际化
navbar: {
dashboard: "首页",
logout: "退出登录",
document: "项目文档",
gitee: "项目地址",
profile: "个人中心",
},
sizeSelect: {
tooltip: "布局大小",
default: "默认",
large: "大型",
small: "小型",
message: {
success: "切换布局大小成功!",
},
},
langSelect: {
message: {
success: "切换语言成功!",
},
},
settings: {
project: "项目配置",
theme: "主题设置",
interface: "界面设置",
navigation: "导航设置",
themeColor: "主题颜色",
themeColorTip: "主题颜色",
darkMode: "暗黑模式",
layoutSetting: "布局设置",
sidebarColorScheme: "侧边栏配色",
showTagsView: "显示页签",
showAppLogo: "显示Logo",
showWatermark: "显示水印",
classicBlue: "经典蓝",
minimalWhite: "极简白",
copyConfig: "复制配置",
resetConfig: "重置默认",
copySuccess: "配置已复制到剪贴板",
resetSuccess: "已重置为默认配置",
copyDescription: "复制配置将生成当前设置的代码,重置将恢复所有设置为默认值",
confirmReset: "确定要重置所有设置为默认值吗?此操作不可恢复。",
applyToFile: "应用到文件",
onlyCopy: "仅复制",
leftLayout: "左侧模式",
topLayout: "顶部模式",
mixLayout: "混合模式",
configManagement: "配置管理",
copyConfigDescription: "生成当前设置的代码并复制到剪贴板,然后覆盖 src/settings.ts 文件",
resetConfigDescription: "恢复所有设置为系统默认值",
},
};