新增中英文切换

This commit is contained in:
eoao
2025-07-22 22:02:23 +08:00
parent 249edb9e19
commit bbcff4908d
64 changed files with 1951 additions and 1298 deletions

View File

@@ -0,0 +1,93 @@
const en = {
IncorrectPwd: 'Incorrect password',
addAccountDisabled: 'Add email account function is disabled',
regDisabled: 'Sign up is disabled',
emptyEmail: 'Email cannot be empty',
notEmail: 'Invalid email',
notExistDomain: 'Email domain does not exist',
isDelAccount: 'This Email has been deleted',
isRegAccount: 'This Email is already signed up',
accountLimit: 'Email account limit reached',
delMyAccount: 'Cannot delete your own email account',
noUserAccount: 'This email does not belong to the current user',
usernameLengthLimit: 'Username length exceeds the limit',
noOsDomainSendPic: 'Cannot send body images: R2 domain not configured',
noOsSendPic: 'Cannot send body images: R2 object storage not configured',
noOsDomainSendAtt: 'Cannot send attachments: R2 domain not configured',
noOsSendAtt: 'Cannot send attachments: R2 object storage not configured',
disabledSend: 'Email sending is disabled',
noSeparateSend: 'Attachments are not supported in separate sending',
userNoSendTotal: 'User has no remaining sends',
daySendLimit: 'Daily send limit reached',
totalSendLimit: 'Total send limit reached',
daySendLack: 'Not enough remaining sends today',
totalSendLack: 'Not enough total remaining sends',
senderAccountNotExist: 'Sender email does not exist',
noResendToken: 'Resend API token not configured',
sendEmailNotCurUser: 'Sender email does not belong to current user',
notExistEmailReply: 'Mail does not exist and cannot be replied to',
pwdLengthLimit: 'Password length exceeds the limit',
emailLengthLimit: 'Email length exceeds the limit',
pwdMinLengthLimit: 'Password must be at least 6 characters',
notEmailDomain: 'Invalid email domain',
emptyRegKey: 'Invite code cannot be empty',
notExistRegKey: 'Invite code does not exist',
noRegKeyTotal: 'Invite code usage limit reached',
regKeyExpire: 'Invite code has expired',
emailAndPwdEmpty: 'Email and password cannot be empty',
notExistUser: 'Email does not exist',
isDelUser: 'This email has been deleted',
isBanUser: 'This email has been banned',
regKeyUseCount: 'Usage count cannot be empty',
emptyRegKeyExpire: 'Valid until time cannot be empty',
isExistRegKye: 'Invite code already exists',
roleNotExist: 'Role does not exist',
emptyRoleName: 'Role name cannot be empty',
roleNameExist: 'Role name already exists',
delDefRole: 'Default role cannot be deleted',
notJsonDomain: 'Environment variable "domain" must be in JSON format',
noOsUpBack: 'Cannot upload background: R2 object storage not configured',
noOsDomainUpBack: 'Cannot upload background: R2 domain not configured',
starNotExistEmail: 'Starred email does not exist',
emptyBotToken: 'Verification token cannot be empty',
botVerifyFail: 'Bot verification failed, please try again',
authExpired: 'Authentication expired, please log in again',
unauthorized: 'Unauthorized',
perms: {
"邮件": "Email",
"邮件发送": "Send email",
"邮件删除": "Delete email",
"邮箱侧栏": "Account",
"邮箱查看": "View account",
"邮箱添加": "Add account",
"邮箱删除": "Delete account",
"个人设置": "Settings",
"用户注销": "Delete user",
"分析页": "Analytics",
"数据查看": "View data",
"用户信息": "All users",
"用户查看": "View user",
"用户添加": "Add user",
"密码修改": "Change password",
"状态修改": "Change status",
"权限修改": "Change role",
"用户删除": "Delete user",
"邮件列表": "All mail",
"邮件查看": "View email",
"权限控制": "Role",
"身份查看": "View role",
"身份修改": "Change role",
"身份删除": "Delete role",
"注册密钥": "Invite code",
"密钥查看": "View code",
"密钥添加": "Add code",
"密钥删除": "Delete code",
"系统设置": "System settings",
"设置查看": "View settings",
"设置修改": "Change settings",
"物理清空": "Physical purge",
"发件重置": "Reset send count"
}
};
export default en;

View File

@@ -0,0 +1,30 @@
import i18next from 'i18next';
import zh from './zh.js'
import en from './en.js'
import app from '../hono/hono';
app.use('*', async (c, next) => {
const lang = c.req.header('accept-language').split('-')[0]
i18next.init({
lng: lang,
});
return await next()
})
const resources = {
en: {
translation: en
},
zh: {
translation: zh,
},
};
i18next.init({
fallbackLng: 'en',
resources,
});
export const t = (key) => i18next.t(key)
export default i18next;

View File

@@ -0,0 +1,93 @@
const zh = {
IncorrectPwd: '密码输入错误',
addAccountDisabled: '添加邮箱功能已关闭',
regDisabled: '注册功能已关闭',
emptyEmail: '邮箱不能为空',
notEmail: '非法邮箱',
notExistDomain: '不存在的邮箱域名',
isDelAccount: '该邮箱已被注销',
isRegAccount: '该邮箱已被注册',
accountLimit: '添加邮箱数量到达限制',
delMyAccount: '不可以删除自己的邮箱',
noUserAccount: '该邮箱不属于当前用户',
usernameLengthLimit: '用户名长度超出限制',
noOsDomainSendPic: 'r2域名未配置不能发送正文图片',
noOsSendPic: 'r2对象存储未配置不能发送正文图片',
noOsDomainSendAtt: 'r2域名未配置不能发送附件',
noOsSendAtt: 'r2对象存储未配置不能发送附件',
disabledSend: '邮件发送功能已停用',
noSeparateSend: '分别发送暂时不支持附件',
userNoSendTotal: '用户无发送次数',
daySendLimit: '发送次数已到达每日限制',
totalSendLimit: '发送次数已到达限制',
daySendLack: '当日剩余发送次数不足',
totalSendLack: '剩余发送次数不足',
senderAccountNotExist: '发件人邮箱不存在',
noResendToken: 'resend密钥未配置',
sendEmailNotCurUser: '发件人邮箱非当前用户所有',
notExistEmailReply: '邮件不存在无法回复',
pwdLengthLimit: '密码长度超出限制',
emailLengthLimit: '邮箱长度超出限制',
pwdMinLengthLimit: '密码不能小于6位',
notEmailDomain: '非法邮箱域名',
emptyRegKey: '注册码不能为空',
notExistRegKey: '注册码不存在',
noRegKeyTotal: '注册码使用次数已耗尽',
regKeyExpire: '注册码已过期',
emailAndPwdEmpty: '邮箱和密码不能为空',
notExistUser: '该邮箱不存在',
isDelUser: '该邮箱已被注销',
isBanUser: '该邮箱已被禁用',
regKeyUseCount: '使用次数不能为空',
emptyRegKeyExpire: '有效时间不能为空',
isExistRegKye: '注册码已存在',
roleNotExist: '权限身份不存在',
emptyRoleName: '身份名不能为空',
roleNameExist: '身份名已存在',
delDefRole: '默认身份不能删除',
notJsonDomain: '环境变量domain必须是JSON类型',
noOsUpBack: 'r2对象存储未配置不能上传背景',
noOsDomainUpBack: 'r2域名未配置不上传背景',
starNotExistEmail: '星标的邮件不存在',
emptyBotToken: '验证token不能为空',
botVerifyFail: '人机验证失败,请重试',
authExpired: '身份认证失效,请重新登录',
unauthorized: '权限不足',
perms: {
"邮件": "邮件",
"邮件发送": "邮件发送",
"邮件删除": "邮件删除",
"邮箱侧栏": "邮箱侧栏",
"邮箱查看": "邮箱查看",
"邮箱添加": "邮箱添加",
"邮箱删除": "邮箱删除",
"个人设置": "个人设置",
"用户注销": "用户注销",
"分析页": "分析页",
"数据查看": "数据查看",
"用户信息": "用户信息",
"用户查看": "用户查看",
"用户添加": "用户添加",
"密码修改": "密码修改",
"状态修改": "状态修改",
"权限修改": "权限修改",
"用户删除": "用户删除",
"邮件列表": "全部邮件",
"邮件查看": "邮件查看",
"权限控制": "权限控制",
"身份查看": "身份查看",
"身份修改": "身份修改",
"身份删除": "身份删除",
"注册密钥": "注册密钥",
"密钥查看": "密钥查看",
"密钥添加": "密钥添加",
"密钥删除": "密钥删除",
"系统设置": "系统设置",
"设置查看": "设置查看",
"设置修改": "设置修改",
"物理清空": "物理清空",
'发件重置': '发件重置'
}
}
export default zh