mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-04 08:27:46 +08:00
fix(frontend): complete i18n coverage and responsive layouts
This commit is contained in:
+92
-794
@@ -1,3 +1,8 @@
|
||||
import { legacyUiEnglishMessages } from './legacy-ui-messages'
|
||||
import { legacyTermEnglishMessages } from './legacy-term-messages'
|
||||
import { legacyAdminEnglishMessages } from './legacy-admin-messages'
|
||||
import { legacyGuideEnglishMessages } from './legacy-guide-messages'
|
||||
|
||||
export const messages = {
|
||||
'zh-CN': {
|
||||
'common.loading': '加载中...',
|
||||
@@ -6,12 +11,41 @@ export const messages = {
|
||||
'common.copy': '复制',
|
||||
'common.copied': '已复制',
|
||||
'common.cancel': '取消',
|
||||
'common.configure': '配置',
|
||||
'modules.bark.deviceKeyHint': '使用 Bark App 推送地址(例如 https://api.day.app/xxxx)中的 xxxx 部分。',
|
||||
'common.githubRepository': 'GitHub 仓库',
|
||||
'common.settings': '个人设置',
|
||||
'common.logout': '退出登录',
|
||||
'common.language': '语言',
|
||||
'common.chinese': '简体中文',
|
||||
'common.english': 'English',
|
||||
'common.searchPlaceholder': '输入关键词搜索...',
|
||||
'common.noSearchResults': '未找到匹配项',
|
||||
'common.sort': '排序',
|
||||
'common.filter': '筛选',
|
||||
'common.openMenu': '打开导航菜单',
|
||||
'common.closeMenu': '关闭导航菜单',
|
||||
'pagination.range': '显示 {start}-{end} 条,共 {total} 条',
|
||||
'pagination.pageSize': '{size} 条/页',
|
||||
'pagination.goToPage': '跳至',
|
||||
'pagination.pageLabel': '页',
|
||||
'pagination.pageNumber': '第 {page} 页',
|
||||
'pagination.pageSizeLabel': '每页条数',
|
||||
'pagination.jumpToPage': '跳转页码',
|
||||
'chart.actualCost': '实际成本',
|
||||
'chart.forecastCost': '预测成本',
|
||||
'chart.intervalAxis': '间隔 (分钟)',
|
||||
'chart.intervalTooltip': '间隔: {value} 分钟',
|
||||
'chart.crosshairValue': 'Y = {value} 分钟',
|
||||
'chart.pointsBelow': '点在横线以下',
|
||||
'chart.total': '总计',
|
||||
'chart.unknown': '未知',
|
||||
'heatmap.requests': '{count} 次请求',
|
||||
'heatmap.cost': '成本 {value}',
|
||||
'heatmap.actualCost': '实际成本 {value}',
|
||||
'heatmap.less': '少',
|
||||
'heatmap.more': '多',
|
||||
'heatmap.empty': '暂无活跃数据',
|
||||
'auth.expired': '认证已过期,请重新登录',
|
||||
'auth.relogin': '重新登录',
|
||||
'auth.role.admin': '管理员',
|
||||
@@ -423,12 +457,41 @@ export const messages = {
|
||||
'common.copy': 'Copy',
|
||||
'common.copied': 'Copied',
|
||||
'common.cancel': 'Cancel',
|
||||
'common.configure': 'Configure',
|
||||
'modules.bark.deviceKeyHint': 'Use the xxxx part of your Bark app push URL, for example https://api.day.app/xxxx.',
|
||||
'common.githubRepository': 'GitHub repository',
|
||||
'common.settings': 'Profile settings',
|
||||
'common.logout': 'Log out',
|
||||
'common.language': 'Language',
|
||||
'common.chinese': 'Simplified Chinese',
|
||||
'common.english': 'English',
|
||||
'common.searchPlaceholder': 'Search...',
|
||||
'common.noSearchResults': 'No results found',
|
||||
'common.sort': 'Sort',
|
||||
'common.filter': 'Filter',
|
||||
'common.openMenu': 'Open navigation menu',
|
||||
'common.closeMenu': 'Close navigation menu',
|
||||
'pagination.range': 'Showing {start}-{end} of {total} items',
|
||||
'pagination.pageSize': '{size} / page',
|
||||
'pagination.goToPage': 'Go to',
|
||||
'pagination.pageLabel': 'page',
|
||||
'pagination.pageNumber': 'Page {page}',
|
||||
'pagination.pageSizeLabel': 'Items per page',
|
||||
'pagination.jumpToPage': 'Go to page',
|
||||
'chart.actualCost': 'Actual cost',
|
||||
'chart.forecastCost': 'Forecast cost',
|
||||
'chart.intervalAxis': 'Interval (minutes)',
|
||||
'chart.intervalTooltip': 'Interval: {value} minutes',
|
||||
'chart.crosshairValue': 'Y = {value} minutes',
|
||||
'chart.pointsBelow': 'points below the line',
|
||||
'chart.total': 'Total',
|
||||
'chart.unknown': 'Unknown',
|
||||
'heatmap.requests': '{count} requests',
|
||||
'heatmap.cost': 'Cost {value}',
|
||||
'heatmap.actualCost': 'Actual cost {value}',
|
||||
'heatmap.less': 'Less',
|
||||
'heatmap.more': 'More',
|
||||
'heatmap.empty': 'No activity data',
|
||||
'auth.expired': 'Authentication expired. Please sign in again.',
|
||||
'auth.relogin': 'Sign in again',
|
||||
'auth.role.admin': 'Admin',
|
||||
@@ -836,6 +899,15 @@ export const messages = {
|
||||
} as const
|
||||
|
||||
const legacyExactEnglishMessages: Record<string, string> = {
|
||||
...legacyTermEnglishMessages,
|
||||
...Object.fromEntries(
|
||||
Object.entries(messages['zh-CN'])
|
||||
.filter(([, source]) => !source.includes('{'))
|
||||
.map(([key, source]) => [source, messages['en-US'][key as keyof typeof messages['en-US']]]),
|
||||
),
|
||||
...legacyUiEnglishMessages,
|
||||
...legacyAdminEnglishMessages,
|
||||
...legacyGuideEnglishMessages,
|
||||
'关闭': 'Close',
|
||||
'取消': 'Cancel',
|
||||
'确定': 'Confirm',
|
||||
@@ -2859,7 +2931,19 @@ const legacyPhraseEnglishMessages: Array<[string, string]> = [
|
||||
['暂无可用号池', 'No available pools'],
|
||||
]
|
||||
|
||||
const legacyStaticEnglishMessages: Readonly<Record<string, string>> = {
|
||||
...Object.fromEntries(legacyPhraseEnglishMessages),
|
||||
...legacyExactEnglishMessages,
|
||||
}
|
||||
|
||||
const legacyDynamicPatterns: Array<[RegExp, (match: RegExpMatchArray) => string]> = [
|
||||
[/^(\d+) 维度$/u, match => `${match[1]} ${match[1] === '1' ? 'dimension' : 'dimensions'}`],
|
||||
[/^(\d+)天([01]?\d|2[0-3])时$/u, match => `${match[1]}d ${match[2]}h`],
|
||||
[/^(\d+)天\s+([01]?\d|2[0-3]):([0-5]\d):([0-5]\d)$/u, match => `${match[1]}d ${match[2]}:${match[3]}:${match[4]}`],
|
||||
[/^成功率 (\d[\d.,]*%)$/u, match => `Success rate ${match[1]}`],
|
||||
[/^输入 ([\d.,]+[KMB]?) \/ 输出 ([\d.,]+[KMB]?)$/u, match => `Input ${match[1]} / Output ${match[2]}`],
|
||||
[/^节省 (\$[\d.,]+) \((\d[\d.,]*%)\)$/u, match => `Saved ${match[1]} (${match[2]})`],
|
||||
[/^总用户 (\d[\d,]*)$/u, match => `Total users ${match[1]}`],
|
||||
[/^(.+) 次请求 · (.+)$/u, match => `${match[1]} requests · ${match[2]}`],
|
||||
[/^暂无 (.+) 格式的 Key$/u, match => `No ${match[1]} format keys`],
|
||||
[/^会话剩余 (.+)$/u, match => `Session remaining ${match[1]}`],
|
||||
@@ -2869,7 +2953,7 @@ const legacyDynamicPatterns: Array<[RegExp, (match: RegExpMatchArray) => string]
|
||||
[/^发布于 (.+)$/u, match => `Published at ${match[1]}`],
|
||||
[/^已启用 (.+) 项$/u, match => `${match[1]} enabled`],
|
||||
[/^影响 (.+) 行$/u, match => `${match[1]} rows affected`],
|
||||
[/^(.+)月$/u, match => `${match[1]}/`],
|
||||
[/^(1[0-2]|[1-9])月$/u, match => new Intl.DateTimeFormat('en-US', { month: 'short', timeZone: 'UTC' }).format(new Date(Date.UTC(2020, Number(match[1]) - 1, 1)))],
|
||||
[/^总可用:(.+)$/u, match => `Total available: ${match[1]}`],
|
||||
[/^余额:(.+)$/u, match => `Balance: ${match[1]}`],
|
||||
[/^(.+) 秒$/u, match => `${translateLegacyText(match[1], 'en-US')}s`],
|
||||
@@ -2878,14 +2962,13 @@ const legacyDynamicPatterns: Array<[RegExp, (match: RegExpMatchArray) => string]
|
||||
[/^(.+) 天$/u, match => `${translateLegacyText(match[1], 'en-US')} d`],
|
||||
[/^影响用户:(.+) 个$/u, match => `Affected users: ${match[1]}`],
|
||||
[/^等 (.+) 个用户$/u, match => `and ${match[1]} users`],
|
||||
[/^确认(.+)((.+))$/u, match => `Confirm ${translateLegacyByTokens(match[1])} (${match[2]})`],
|
||||
[/^确认(启用|禁用|删除|重置)((.+))$/u, match => `Confirm ${translateLegacyText(match[1], 'en-US').toLowerCase()} (${match[2]})`],
|
||||
[/^成功 (.+) 个,失败 (.+) 个$/u, match => `Succeeded ${match[1]}, failed ${match[2]}`],
|
||||
[/^批量操作完成:成功 (.+) 个,失败 (.+) 个$/u, match => `Batch action complete: succeeded ${match[1]}, failed ${match[2]}`],
|
||||
[/^匹配 (.+) 个,当前页 (.+) 个,已选 (.+) 个$/u, match => `Matched ${match[1]} items, current page ${match[2]} items, selected ${match[3]} items`],
|
||||
[/^已选 (.+) 个$/u, match => `Selected ${match[1]} items`],
|
||||
[/^已强制下线 (.+) 个设备$/u, match => `Signed out ${match[1]} devices`],
|
||||
[/^用户已(.+)$/u, match => `User ${translateLegacyByTokens(match[1]).toLowerCase()}d`],
|
||||
[/^(.+)用户失败$/u, match => `Failed to ${translateLegacyByTokens(match[1]).toLowerCase()} user`],
|
||||
[/^(启用|禁用|删除|创建|更新)用户失败$/u, match => `Failed to ${translateLegacyText(match[1], 'en-US').toLowerCase()} user`],
|
||||
[/^(.+) 个用户$/u, match => `${match[1]} users`],
|
||||
[/^有 (.+) 条格式错误$/u, match => `${match[1]} format errors`],
|
||||
[/^还有 (.+) 条错误未显示$/u, match => `${match[1]} more errors hidden`],
|
||||
@@ -2915,7 +2998,7 @@ const legacyDynamicPatterns: Array<[RegExp, (match: RegExpMatchArray) => string]
|
||||
[/^已向 (.+) 个节点写入升级目标 (.+),(.+) 个节点无需变更$/u, match => `Wrote upgrade target ${match[2]} to ${match[1]} nodes; ${match[3]} nodes did not need changes`],
|
||||
[/^当前没有需要变更的 tunnel 节点,目标版本仍为 (.+)$/u, match => `No tunnel nodes need changes. Target version remains ${match[1]}`],
|
||||
[/^第 (.+) 条 (.+): (.+)$/u, match => `Entry ${match[1]} ${match[2]}: ${translateLegacyText(match[3], 'en-US')}`],
|
||||
[/^(.+)包含无效的 URL 编码$/u, match => `${translateLegacyByTokens(match[1])} contains invalid URL encoding`],
|
||||
[/^(.+)包含无效的 URL 编码$/u, match => `${translateLegacyText(match[1], 'en-US')} contains invalid URL encoding`],
|
||||
[/^(.+) 点$/u, match => `${match[1]} points`],
|
||||
[/^(.+)\/(.+) 样本$/u, match => `${match[1]}/${match[2]} samples`],
|
||||
[/^峰值 (.+)$/u, match => `Peak ${match[1]}`],
|
||||
@@ -2930,755 +3013,6 @@ const legacyDynamicPatterns: Array<[RegExp, (match: RegExpMatchArray) => string]
|
||||
[/^(.+) tokens 命中$/u, match => `${match[1]} tokens hit`],
|
||||
]
|
||||
|
||||
const legacyFallbackTokens: Array<[string, string]> = [
|
||||
...legacyPhraseEnglishMessages,
|
||||
['未启用', 'Disabled'],
|
||||
['允许退款', 'Refunds allowed'],
|
||||
['关闭退款', 'Refunds off'],
|
||||
['允许用户退款', 'User refunds allowed'],
|
||||
['关闭用户退款', 'User refunds off'],
|
||||
['已保存', 'Saved'],
|
||||
['确认', 'Confirm'],
|
||||
['统一查看', 'view in one place'],
|
||||
['健康状态', 'health status'],
|
||||
['概览', 'overview'],
|
||||
['判断', 'identify'],
|
||||
['风险', 'risk'],
|
||||
['具体', 'specific'],
|
||||
['缓存命中率', 'cache hit rate'],
|
||||
['成本缓存命中率', 'cost cache hit rate'],
|
||||
['费用缓存命中率', 'cost cache hit rate'],
|
||||
['请求命中率', 'request hit rate'],
|
||||
['Token 命中率', 'token hit rate'],
|
||||
['缓存读取费用', 'cache read cost'],
|
||||
['缓存读取', 'cache read'],
|
||||
['读取费用', 'read cost'],
|
||||
['命中', 'hit'],
|
||||
['品牌名称右方', 'right of the brand name'],
|
||||
['日志', 'logs'],
|
||||
['本地', 'local'],
|
||||
['表示', 'means'],
|
||||
['未单独配置', 'without separate configuration'],
|
||||
['跟随这里', 'follow this setting'],
|
||||
['心跳', 'heartbeat'],
|
||||
['非流式', 'non-streaming'],
|
||||
['请求记录级别', 'request record level'],
|
||||
['入库方式', 'storage mode'],
|
||||
['详细程度', 'detail level'],
|
||||
['基本信息', 'basic information'],
|
||||
['含请求头', 'includes request headers'],
|
||||
['完整请求响应', 'full request and response'],
|
||||
['自动脱敏', 'automatically redacted'],
|
||||
['脱敏', 'redacted'],
|
||||
['逗号分隔', 'comma-separated'],
|
||||
['这些请求头', 'these request headers'],
|
||||
['脱敏处理', 'redacted'],
|
||||
['分钟级图表', 'minute-level chart'],
|
||||
['后端最少保留', 'backend keeps at least'],
|
||||
['系统操作日志', 'system operation logs'],
|
||||
['细粒度权限控制', 'fine-grained permission control'],
|
||||
['权限控制', 'permission control'],
|
||||
['用户认证', 'user authentication'],
|
||||
['连接信息', 'connection information'],
|
||||
['第三方', 'third-party'],
|
||||
['登录/绑定账号', 'sign-in/bind accounts'],
|
||||
['后台任务', 'background tasks'],
|
||||
['用户通知', 'user notifications'],
|
||||
['推送渠道', 'push channels'],
|
||||
['微信推送', 'WeChat push'],
|
||||
['服务启用状态', 'service enabled state'],
|
||||
['服务等级', 'service tier'],
|
||||
['服务', 'service'],
|
||||
['模型名后缀', 'model name suffix'],
|
||||
['推理参数', 'inference parameters'],
|
||||
['完整数据', 'full data'],
|
||||
['定期备份', 'periodic backup'],
|
||||
['上传的文件', 'uploaded files'],
|
||||
['查看和删除', 'view and delete'],
|
||||
['具有', 'with'],
|
||||
['能力', 'capability'],
|
||||
['支付网关', 'payment gateways'],
|
||||
['配置易支付', 'configure EPay'],
|
||||
['支付宝官方', 'official Alipay'],
|
||||
['微信支付官方', 'official WeChat Pay'],
|
||||
['余额接近不足', 'balance is getting low'],
|
||||
['接近不足', 'getting low'],
|
||||
['公告通知', 'announcement notifications'],
|
||||
['系统公告', 'system announcements'],
|
||||
['注册时间', 'registered at'],
|
||||
['最后登录', 'last sign-in'],
|
||||
['总余额', 'total balance'],
|
||||
['累计消费占比', 'cumulative spending ratio'],
|
||||
['累计消费', 'cumulative spending'],
|
||||
['累计充值', 'cumulative top-up'],
|
||||
['消费', 'spending'],
|
||||
['兑换码充值', 'redeem-code top-up'],
|
||||
['卡密', 'redeem code'],
|
||||
['直接充值', 'top up directly'],
|
||||
['充值余额', 'top-up balance'],
|
||||
['发起充值', 'start top-up'],
|
||||
['申请退款', 'request refund'],
|
||||
['退款模式', 'refund mode'],
|
||||
['变动', 'change'],
|
||||
['余额变化', 'balance changes'],
|
||||
['说明', 'description'],
|
||||
['Server 酱', 'Server Chan'],
|
||||
['酱', 'Chan'],
|
||||
['用于', 'used for'],
|
||||
['稳定性', 'stability'],
|
||||
['系统', 'system'],
|
||||
['签到', 'check-in'],
|
||||
['执行', 'run'],
|
||||
['主动', 'proactive'],
|
||||
['即将过期', 'about to expire'],
|
||||
['动态调度', 'dynamic scheduling'],
|
||||
['调度', 'scheduling'],
|
||||
['构建信息', 'build information'],
|
||||
['清理策略', 'cleanup policy'],
|
||||
['服务level', 'service level'],
|
||||
['邮件', 'email'],
|
||||
['预览', 'Preview'],
|
||||
['注册', 'registration'],
|
||||
['计费', 'billing'],
|
||||
['费率', 'rate'],
|
||||
['仪表盘', 'dashboard'],
|
||||
['按顺序', 'in order'],
|
||||
['同优先级', 'same-priority'],
|
||||
['不同优先级', 'different-priority'],
|
||||
['其他设备', 'other devices'],
|
||||
['其他', 'other'],
|
||||
['Refresh锁', 'refresh lock'],
|
||||
['concurrent锁', 'concurrency lock'],
|
||||
['锁', 'lock'],
|
||||
['运维', 'operations'],
|
||||
['排障', 'troubleshooting'],
|
||||
['视角', 'perspective'],
|
||||
['缓存页', 'cache page'],
|
||||
['亲和性', 'affinity'],
|
||||
['亲和', 'affinity'],
|
||||
['内存', 'memory'],
|
||||
['存储', 'storage'],
|
||||
['通道手续费率', 'channel fee rate'],
|
||||
['手续费率', 'fee rate'],
|
||||
['手续费', 'fee'],
|
||||
['支付币种', 'payment currency'],
|
||||
['币种', 'currency'],
|
||||
['通道值', 'channel value'],
|
||||
['通道', 'channel'],
|
||||
['商户密钥', 'merchant key'],
|
||||
['商户证书', 'merchant certificate'],
|
||||
['商户号', 'merchant ID'],
|
||||
['商户', 'merchant'],
|
||||
['支付模式', 'payment mode'],
|
||||
['应用私钥', 'app private key'],
|
||||
['公钥', 'public key'],
|
||||
['证书序列号', 'certificate serial number'],
|
||||
['扫码单', 'QR-code order'],
|
||||
['扫码支付', 'QR-code payment'],
|
||||
['收银台', 'checkout'],
|
||||
['下单', 'order creation'],
|
||||
['前台', 'frontend'],
|
||||
['二维码', 'QR code'],
|
||||
['开通', 'enable'],
|
||||
['拉起', 'launch'],
|
||||
['未开通', 'not enabled'],
|
||||
['移动端', 'mobile'],
|
||||
['桌面端', 'desktop'],
|
||||
['微信浏览器', 'WeChat browser'],
|
||||
['非微信浏览器', 'non-WeChat browser'],
|
||||
['公众号', 'official account'],
|
||||
['同主体', 'same merchant entity'],
|
||||
['表单', 'form'],
|
||||
['场景', 'scenarios'],
|
||||
['真实请求统计', 'real request statistics'],
|
||||
['端点可用率', 'endpoint availability'],
|
||||
['模型可用率', 'model availability'],
|
||||
['提供商可用率', 'provider availability'],
|
||||
['平均TTFB', 'average TTFB'],
|
||||
['平均首字', 'average first byte'],
|
||||
['邮件等', 'emails and other'],
|
||||
['右方', 'right side'],
|
||||
['后台', 'background'],
|
||||
['备份', 'backup'],
|
||||
['完整备份', 'full backup'],
|
||||
['非管理员', 'non-admin'],
|
||||
['请求候选记录', 'request candidate records'],
|
||||
['统计聚合', 'statistics aggregates'],
|
||||
['同步生图', 'synchronous image generation'],
|
||||
['外层 HTTP 状态', 'outer HTTP status'],
|
||||
['外层', 'outer'],
|
||||
['固定为', 'fixed to'],
|
||||
['上游失败', 'upstream failure'],
|
||||
['标准文本', 'standard text'],
|
||||
['非流式接口', 'non-streaming API'],
|
||||
['响应体', 'response body'],
|
||||
['验证码邮件', 'verification code email'],
|
||||
['隐式加密', 'implicit encryption'],
|
||||
['无加密', 'no encryption'],
|
||||
['邮箱验证', 'email verification'],
|
||||
['后缀限制', 'suffix restriction'],
|
||||
['后缀', 'suffix'],
|
||||
['列出', 'listed'],
|
||||
['均可', 'can all'],
|
||||
['邮件主题', 'email subject'],
|
||||
['收件人', 'recipient'],
|
||||
['邮件预览', 'email preview'],
|
||||
['供应商', 'provider'],
|
||||
['聊天消息', 'chat messages'],
|
||||
['敏感信息', 'sensitive information'],
|
||||
['替换为', 'replace with'],
|
||||
['占位符', 'placeholder'],
|
||||
['返回客户端', 'returning to client'],
|
||||
['自动还原', 'restore automatically'],
|
||||
['服务等级', 'service tier'],
|
||||
['上传文件', 'upload files'],
|
||||
['文件上传', 'file upload'],
|
||||
['对象存储', 'object storage'],
|
||||
['保留策略', 'retention policy'],
|
||||
['推送服务', 'push service'],
|
||||
['推送', 'push'],
|
||||
['微信', 'WeChat'],
|
||||
['备份配置', 'backup configuration'],
|
||||
['映射预览', 'mapping preview'],
|
||||
['活动热力图', 'activity heatmap'],
|
||||
['请求间隔', 'request interval'],
|
||||
['用户请求', 'user requests'],
|
||||
['缓存命中', 'cache hits'],
|
||||
['命中率', 'hit rate'],
|
||||
['预估节省', 'estimated savings'],
|
||||
['可退充值订单', 'refundable top-up orders'],
|
||||
['自助退款', 'self-service refund'],
|
||||
['线下打款', 'offline transfer'],
|
||||
['原路退回', 'original-route refund'],
|
||||
['退款申请', 'refund request'],
|
||||
['钱包迁移', 'wallet migration'],
|
||||
['按日汇总', 'daily summary'],
|
||||
['访问令牌', 'access token'],
|
||||
['管理令牌', 'management token'],
|
||||
['令牌', 'token'],
|
||||
['已创建', 'created'],
|
||||
['已达上限', 'limit reached'],
|
||||
['最后 IP', 'last IP'],
|
||||
['最后使用', 'last used'],
|
||||
['从未使用', 'never used'],
|
||||
['旧版全权限', 'legacy full permissions'],
|
||||
['全权限', 'full permissions'],
|
||||
['全权', 'full access'],
|
||||
['只读', 'read-only'],
|
||||
['禁止', 'deny'],
|
||||
['用途说明', 'usage notes'],
|
||||
['浅色', 'Light'],
|
||||
['深色', 'Dark'],
|
||||
['跟随系统', 'System'],
|
||||
['时区', 'timezone'],
|
||||
['通知设置', 'notification settings'],
|
||||
['使用提醒', 'usage reminders'],
|
||||
['默认用户初始赠款(美元)', 'Default user initial grant (USD)'],
|
||||
['默认速率限制 (请求/分钟)', 'Default rate limit (requests/min)'],
|
||||
['弱密码 - 至少 6 个字符', 'Weak password - at least 6 characters'],
|
||||
['中等密码 - 至少 8 位,含字母和数字', 'Medium password - at least 8 characters with letters and numbers'],
|
||||
['强密码 - 至少 8 位,含大小写字母、数字和特殊字符', 'Strong password - at least 8 characters with uppercase, lowercase, numbers, and symbols'],
|
||||
['Docker 预构建镜像', 'Docker prebuilt image'],
|
||||
['预构建镜像', 'Prebuilt image'],
|
||||
['克隆代码', 'Clone repository'],
|
||||
['启动依赖', 'Start dependencies'],
|
||||
['安装前端依赖', 'Install frontend dependencies'],
|
||||
['启动开发服务', 'Start development services'],
|
||||
['生成密钥并填入 .env', 'Generate keys and write them to .env'],
|
||||
['生成密钥', 'Generate keys'],
|
||||
['生成key并填入.env', 'Generate keys and write them to .env'],
|
||||
['自动执行数据库迁移', 'Runs database migrations automatically'],
|
||||
['自动执行数据库migration', 'Runs database migrations automatically'],
|
||||
['可选,make dev 会自动启动', 'Optional; make dev starts this automatically'],
|
||||
['首次本地开发', 'First local development setup'],
|
||||
['配置流程', 'Configuration flow'],
|
||||
['模型映射', 'Model mapping'],
|
||||
['代理节点', 'Proxy node'],
|
||||
['代理配置', 'Proxy config'],
|
||||
['反向代理', 'Reverse proxy'],
|
||||
['多级代理', 'Multi-level proxy'],
|
||||
['GitHub 仓库 >', 'GitHub repository >'],
|
||||
['OAuth授权登录', 'OAuth authorization login'],
|
||||
['导入RefreshToken, 支持批量导入', 'Import RefreshToken with batch import support'],
|
||||
['导入 RefreshToken, 支持批量导入', 'Import RefreshToken with batch import support'],
|
||||
['支持批量导入', 'batch import supported'],
|
||||
['格式要求', 'format requirements'],
|
||||
['优先级:Key代理 > 提供商代理 > 全局代理', 'Priority: key proxy > provider proxy > global proxy'],
|
||||
['优先级:Key代理 > 提供商代理 > 全局代理', 'Priority: key proxy > provider proxy > global proxy'],
|
||||
['优先级:', 'Priority:'],
|
||||
['优先级:', 'Priority:'],
|
||||
['创建统一模型', 'Create unified model'],
|
||||
['添加提供商', 'Add provider'],
|
||||
['添加端点', 'Add endpoint'],
|
||||
['添加密钥', 'Add key'],
|
||||
['关联全局模型', 'Link global model'],
|
||||
['名称修正示例', 'Name correction example'],
|
||||
['降/升级请求示例', 'Downgrade/upgrade request example'],
|
||||
['官方标准名称为', 'Official standard name is'],
|
||||
['实际提供商叫', 'the actual provider calls it'],
|
||||
['实际请求提供商用', 'actual provider request uses'],
|
||||
['传统密钥', 'traditional key'],
|
||||
['用于 Google Cloud', 'for Google Cloud'],
|
||||
['使用速率限制', 'usage rate limit'],
|
||||
['同一个用户Key', 'same user key'],
|
||||
['优先使用之前使用的提供商、Key响应请求', 'prefer the previously used provider and key for the request'],
|
||||
['提高缓存命中率', 'improve cache hit rate'],
|
||||
['全局代理', 'global proxy'],
|
||||
['提供商代理', 'provider proxy'],
|
||||
['Key代理', 'key proxy'],
|
||||
['系统配置', 'system configuration'],
|
||||
['提供商配置', 'provider configuration'],
|
||||
['Key配置', 'key configuration'],
|
||||
['清理记录', 'cleanup records'],
|
||||
['详细记录', 'detailed records'],
|
||||
['压缩记录', 'compressed records'],
|
||||
['审计日志', 'audit logs'],
|
||||
['候选记录', 'candidate records'],
|
||||
['请求体', 'request body'],
|
||||
['请求头', 'request headers'],
|
||||
['详细体', 'detailed body'],
|
||||
['迁移', 'migration'],
|
||||
['清体', 'body cleanup'],
|
||||
['清头', 'header cleanup'],
|
||||
['删记录', 'delete records'],
|
||||
['删日志', 'delete logs'],
|
||||
['删候选', 'delete candidates'],
|
||||
['执行中', 'running'],
|
||||
['完成', 'complete'],
|
||||
['失败', 'failed'],
|
||||
['手动', 'manual'],
|
||||
['自动', 'automatic'],
|
||||
['时间', 'time'],
|
||||
['类型', 'type'],
|
||||
['来源', 'source'],
|
||||
['状态', 'status'],
|
||||
['结果', 'result'],
|
||||
['耗时', 'duration'],
|
||||
['刷新', 'refresh'],
|
||||
['保存中', 'saving'],
|
||||
['保存', 'save'],
|
||||
['加载中', 'loading'],
|
||||
['暂无', 'no'],
|
||||
['当前', 'current'],
|
||||
['设置', 'settings'],
|
||||
['配置', 'configuration'],
|
||||
['管理', 'management'],
|
||||
['统计', 'statistics'],
|
||||
['分析', 'analysis'],
|
||||
['监控', 'monitor'],
|
||||
['记录', 'records'],
|
||||
['用户', 'user'],
|
||||
['模型', 'model'],
|
||||
['提供商', 'provider'],
|
||||
['密钥', 'key'],
|
||||
['端点', 'endpoint'],
|
||||
['请求', 'request'],
|
||||
['响应', 'response'],
|
||||
['缓存', 'cache'],
|
||||
['代理', 'proxy'],
|
||||
['节点', 'node'],
|
||||
['钱包', 'wallet'],
|
||||
['套餐', 'plan'],
|
||||
['余额', 'balance'],
|
||||
['成本', 'cost'],
|
||||
['金额', 'amount'],
|
||||
['支付', 'payment'],
|
||||
['充值', 'top-up'],
|
||||
['订单', 'order'],
|
||||
['分组', 'group'],
|
||||
['角色', 'role'],
|
||||
['权限', 'permission'],
|
||||
['限额', 'quota'],
|
||||
['用量', 'usage'],
|
||||
['健康', 'health'],
|
||||
['延迟', 'latency'],
|
||||
['失败率', 'failure rate'],
|
||||
['成功率', 'success rate'],
|
||||
['平均', 'average'],
|
||||
['峰值', 'peak'],
|
||||
['并发', 'concurrency'],
|
||||
['速率', 'rate'],
|
||||
['限制', 'limit'],
|
||||
['启用', 'enable'],
|
||||
['停用', 'disable'],
|
||||
['删除', 'delete'],
|
||||
['编辑', 'edit'],
|
||||
['创建', 'create'],
|
||||
['添加', 'add'],
|
||||
['更新', 'update'],
|
||||
['导入', 'import'],
|
||||
['导出', 'export'],
|
||||
['清空', 'clear'],
|
||||
['选择', 'select'],
|
||||
['输入', 'enter'],
|
||||
['留空', 'leave empty'],
|
||||
['默认', 'default'],
|
||||
['全部', 'all'],
|
||||
['可用', 'available'],
|
||||
['不可用', 'unavailable'],
|
||||
['在线', 'online'],
|
||||
['离线', 'offline'],
|
||||
['活跃', 'active'],
|
||||
['已', 'already'],
|
||||
['未', 'not'],
|
||||
['中', 'in progress'],
|
||||
['前', 'before'],
|
||||
['后', 'after'],
|
||||
['全局模型', 'global model'],
|
||||
['系统架构', 'system architecture'],
|
||||
['统一模型规范', 'unified model specification'],
|
||||
['协议聚合', 'protocol aggregation'],
|
||||
['多端鉴权', 'multi-client authentication'],
|
||||
['管控', 'governance'],
|
||||
['全局并发', 'global concurrency'],
|
||||
['智能调度', 'intelligent scheduling'],
|
||||
['故障转移', 'failover'],
|
||||
['原生直通', 'native passthrough'],
|
||||
['多格式兼容接入', 'multi-format compatible access'],
|
||||
['反代', 'reverse proxy'],
|
||||
['持续使用', 'continuous use'],
|
||||
['月卡额度', 'monthly quota'],
|
||||
['不计入成本', 'not counted as cost'],
|
||||
['倍率', 'multiplier'],
|
||||
['流式首字超时时间', 'streaming first-byte timeout'],
|
||||
['非流请求超时时间', 'non-streaming request timeout'],
|
||||
['保持优先级', 'keep priority'],
|
||||
['提供商设置', 'provider settings'],
|
||||
['无视', 'ignore'],
|
||||
['层级', 'level'],
|
||||
['相同用户', 'same user'],
|
||||
['之前处理过', 'previously handled'],
|
||||
['最大化利用', 'maximize use of'],
|
||||
['均匀分配流量', 'evenly distribute traffic'],
|
||||
['随机性', 'randomness'],
|
||||
['动态调整', 'dynamic adjustment'],
|
||||
['遍历尝试', 'iterate attempts'],
|
||||
['备用节点', 'standby node'],
|
||||
['条件匹配', 'condition matching'],
|
||||
['动作', 'actions'],
|
||||
['动态修改', 'dynamically modify'],
|
||||
['发往', 'sent to'],
|
||||
['模型名称', 'model name'],
|
||||
['平台标准名称', 'platform standard name'],
|
||||
['统一模型名', 'unified model name'],
|
||||
['真实需要', 'actually required'],
|
||||
['正则表达式', 'regular expression'],
|
||||
['批量授权', 'bulk authorization'],
|
||||
['正则过滤', 'regex filtering'],
|
||||
['清洗', 'cleanup'],
|
||||
['符合规则', 'matching rules'],
|
||||
['官方接口', 'official APIs'],
|
||||
['常见聚合平台', 'common aggregation platforms'],
|
||||
['自动抓取', 'automatically fetch'],
|
||||
['剩余额度', 'remaining quota'],
|
||||
['阈值', 'threshold'],
|
||||
['触发报警', 'trigger alerts'],
|
||||
['禁用策略', 'disable policy'],
|
||||
['一键导出', 'one-click export'],
|
||||
['部署实例', 'deployment instances'],
|
||||
['迁移导入', 'migration import'],
|
||||
['恶意使用', 'malicious use'],
|
||||
['异常调用', 'abnormal calls'],
|
||||
['高频报错', 'frequent errors'],
|
||||
['永久锁定', 'permanently lock'],
|
||||
['临时', 'temporarily'],
|
||||
['阻断攻击源头', 'block attack source'],
|
||||
['吞吐', 'throughput'],
|
||||
['时长', 'duration'],
|
||||
['首字', 'first byte'],
|
||||
['加载流量趋势中', 'loading traffic trends'],
|
||||
['全局在线', 'global online'],
|
||||
['拒绝', 'rejected'],
|
||||
['独立 Key', 'standalone key'],
|
||||
['批量管理', 'batch management'],
|
||||
['分类', 'category'],
|
||||
['列表', 'list'],
|
||||
['用户套餐中心', 'user billing center'],
|
||||
['查询', 'search'],
|
||||
['策略分组', 'policy groups'],
|
||||
['策略', 'policy'],
|
||||
['维度', 'dimension'],
|
||||
['默认策略', 'default policy'],
|
||||
['更新时间', 'updated at'],
|
||||
['回溯时间', 'lookback time'],
|
||||
['真实请求统计', 'real request statistics'],
|
||||
['可用率', 'availability'],
|
||||
['平均耗时', 'average duration'],
|
||||
['平均速度', 'average speed'],
|
||||
['仅展示', 'only show'],
|
||||
['点击详情查看', 'click details to view'],
|
||||
['关联的', 'linked'],
|
||||
['系统级别', 'system-level'],
|
||||
['副标题', 'subtitle'],
|
||||
['导航栏', 'navigation bar'],
|
||||
['登录页', 'sign-in page'],
|
||||
['指南页面', 'guide pages'],
|
||||
['全站显示', 'site-wide display'],
|
||||
['显示在', 'shown in'],
|
||||
['邮件发送服务', 'email sending service'],
|
||||
['注册邮箱限制', 'registration email limit'],
|
||||
['验证码邮件', 'verification code email'],
|
||||
['服务器地址', 'server address'],
|
||||
['邮件服务器地址', 'mail server address'],
|
||||
['端口', 'port'],
|
||||
['实时性能监控', 'realtime performance monitoring'],
|
||||
['历史延迟趋势', 'historical latency trends'],
|
||||
['实时运行状态', 'realtime runtime status'],
|
||||
['实时与历史性能数据', 'realtime and historical performance data'],
|
||||
['聚合系统健康', 'aggregate system health'],
|
||||
['并发保护', 'concurrency protection'],
|
||||
['代理通道', 'proxy channels'],
|
||||
['降级切换', 'fallback switching'],
|
||||
['网关指标', 'gateway metrics'],
|
||||
['暂不可达', 'currently unreachable'],
|
||||
['未知', 'unknown'],
|
||||
['系统功能模块', 'system feature modules'],
|
||||
['启用状态', 'enablement status'],
|
||||
['搜索模块名称或描述', 'search module name or description'],
|
||||
['内置工具', 'built-in tools'],
|
||||
['通知服务', 'notification service'],
|
||||
['邮件模板', 'email templates'],
|
||||
['发送设置', 'sending settings'],
|
||||
['登录/绑定', 'sign-in/bind'],
|
||||
['添加配置', 'add configuration'],
|
||||
['命中率', 'hit rate'],
|
||||
['数据', 'data'],
|
||||
['按API格式分析', 'by-API-format analysis'],
|
||||
['格式', 'format'],
|
||||
['平均响应', 'average response'],
|
||||
['成功率', 'success rate'],
|
||||
['个人设置', 'profile settings'],
|
||||
['基本信息', 'basic information'],
|
||||
['头像 URL', 'avatar URL'],
|
||||
['个人简介', 'bio'],
|
||||
['默认应用', 'apply by default'],
|
||||
['账户', 'account'],
|
||||
['单独配置', 'separate configuration'],
|
||||
['跟随此设置', 'follow this setting'],
|
||||
['访问令牌', 'access tokens'],
|
||||
['程序化访问管理 API 的令牌', 'tokens for programmatic access to management APIs'],
|
||||
['创建新令牌', 'create new token'],
|
||||
['安全', 'security'],
|
||||
['可信任', 'trusted'],
|
||||
['支持 CIDR 格式', 'CIDR supported'],
|
||||
['和通知', 'and notifications'],
|
||||
['已过期', 'expired'],
|
||||
['阶梯', 'tier'],
|
||||
['认证方式', 'authentication methods'],
|
||||
['平滑接入', 'smooth onboarding'],
|
||||
['对外暴露', 'expose externally'],
|
||||
['对内映射', 'map internally'],
|
||||
['内部模型名', 'internal model name'],
|
||||
['模型名', 'model name'],
|
||||
['变体', 'variants'],
|
||||
['亲和性路由', 'affinity routing'],
|
||||
['跨平台', 'cross-platform'],
|
||||
['兼容格式', 'compatible format'],
|
||||
['原生透传', 'native passthrough'],
|
||||
['生态', 'ecosystem'],
|
||||
['入口', 'entry'],
|
||||
['响应', 'response'],
|
||||
['一般', 'usually'],
|
||||
['自定义', 'custom'],
|
||||
['章节', 'section'],
|
||||
['按周期', 'by cycle'],
|
||||
['首次', 'first'],
|
||||
['重试次数', 'retry count'],
|
||||
['总超时时间', 'total timeout'],
|
||||
['超时时间', 'timeout'],
|
||||
['当前优先级', 'current priority'],
|
||||
['规则', 'rules'],
|
||||
['发送', 'send'],
|
||||
['匹配', 'match'],
|
||||
['一类', 'one class of'],
|
||||
['标准模型列表', 'standard model list'],
|
||||
['模型列表', 'model list'],
|
||||
['低于', 'below'],
|
||||
['各大', 'major'],
|
||||
['金额下单', 'order amount'],
|
||||
['实际收款金额', 'actual received amount'],
|
||||
['通道手续费率', 'channel fee rate'],
|
||||
['币种', 'currency'],
|
||||
['最低充值金额', 'minimum top-up amount'],
|
||||
['商户密钥', 'merchant key'],
|
||||
['回调地址', 'callback URL'],
|
||||
['接口地址', 'API URL'],
|
||||
['后端', 'backend'],
|
||||
['访问地址', 'access URL'],
|
||||
['加密方式', 'encryption method'],
|
||||
['常用端口', 'common ports'],
|
||||
['无加密', 'no encryption'],
|
||||
['应用专用密码', 'app-specific password'],
|
||||
['发件人', 'sender'],
|
||||
['邮箱地址', 'email address'],
|
||||
['邮件服务', 'email service'],
|
||||
['通知项', 'notification items'],
|
||||
['模板', 'templates'],
|
||||
['推送服务', 'push service'],
|
||||
['黑白名单', 'blacklist/whitelist'],
|
||||
['控制系统访问', 'control system access'],
|
||||
['追踪安全事件', 'track security events'],
|
||||
['变更记录', 'change records'],
|
||||
['拖拽卡片调整顺序', 'drag cards to reorder'],
|
||||
['细粒度', 'fine-grained'],
|
||||
['用户认证', 'user authentication'],
|
||||
['配置和参数', 'configuration and parameters'],
|
||||
['清除系统数据', 'clear system data'],
|
||||
['用户数据', 'user data'],
|
||||
['一体化备份', 'integrated backup'],
|
||||
['钱包快照', 'wallet snapshots'],
|
||||
['品牌名称', 'brand name'],
|
||||
['品牌名', 'brand name'],
|
||||
['邮件中', 'emails'],
|
||||
['卡密', 'redeem code'],
|
||||
['兑换', 'redeem'],
|
||||
['赠款余额', 'gift balance'],
|
||||
['充值余额', 'top-up balance'],
|
||||
['可退款余额', 'refundable balance'],
|
||||
['每日额度套餐', 'daily quota plan'],
|
||||
['未配置', 'not configured'],
|
||||
['暂不可修改', 'temporarily cannot be changed'],
|
||||
['退出其他设备', 'sign out other devices'],
|
||||
['再次输入密码', 'enter password again'],
|
||||
['设备', 'devices'],
|
||||
['状态', 'status'],
|
||||
['筛选用户', 'filter user'],
|
||||
['筛选提供商', 'filter provider'],
|
||||
['筛选类型', 'filter type'],
|
||||
['总耗时', 'total duration'],
|
||||
['输出速度', 'output speed'],
|
||||
['最近24小时', 'last 24 hours'],
|
||||
['自动刷新', 'auto refresh'],
|
||||
['隐藏未知模型或提供商的请求', 'hide requests with unknown model or provider'],
|
||||
['开启自动刷新', 'turn on auto refresh'],
|
||||
['映射缓存', 'mapping cache'],
|
||||
['解析缓存', 'resolution cache'],
|
||||
['个键', 'keys'],
|
||||
['因', 'due to'],
|
||||
['次数', 'count'],
|
||||
['读', 'read'],
|
||||
['写', 'write'],
|
||||
['慢请求', 'slow requests'],
|
||||
['错误样本', 'error samples'],
|
||||
['资源', 'resources'],
|
||||
['数据流', 'data flow'],
|
||||
['百分位', 'percentiles'],
|
||||
['无上游样本', 'no upstream samples'],
|
||||
['和', 'and'],
|
||||
['与', 'and'],
|
||||
['或', 'or'],
|
||||
['的', ''],
|
||||
['为', 'as'],
|
||||
['在', 'in'],
|
||||
['到', 'to'],
|
||||
['从', 'from'],
|
||||
['若', 'if'],
|
||||
['请', 'please'],
|
||||
['先', 'first'],
|
||||
['再', 'then'],
|
||||
['可', 'can'],
|
||||
['会', 'will'],
|
||||
['并', 'and'],
|
||||
['且', 'and'],
|
||||
['以', 'to'],
|
||||
['于', 'at'],
|
||||
['将', 'will'],
|
||||
['天', 'days'],
|
||||
['小时', 'hours'],
|
||||
['分钟', 'minutes'],
|
||||
['秒', 'seconds'],
|
||||
]
|
||||
|
||||
const legacySortedPhraseMessages = [...legacyPhraseEnglishMessages]
|
||||
.filter(([source]) => source.length > 1)
|
||||
.sort((a, b) => b[0].length - a[0].length)
|
||||
|
||||
const legacySortedReplacementTokens = [
|
||||
...Object.entries(legacyExactEnglishMessages).filter(([source]) => source.length > 1),
|
||||
...legacyFallbackTokens.filter(([source]) => source.length > 1),
|
||||
].sort((a, b) => b[0].length - a[0].length)
|
||||
|
||||
const legacyParticleTokens: Array<[string, string]> = [
|
||||
['以及', ' and '],
|
||||
['或者', ' or '],
|
||||
['并且', ' and '],
|
||||
['不含', ' excluding '],
|
||||
['暂无', ' no '],
|
||||
['是否', ' whether '],
|
||||
['这里', ' here '],
|
||||
['你的', ' your '],
|
||||
['您的', ' your '],
|
||||
['这个', ' this '],
|
||||
['这种', ' this '],
|
||||
['那个', ' that '],
|
||||
['全部', ' all '],
|
||||
['所有', ' all '],
|
||||
['不同', ' different '],
|
||||
['多种', ' multiple '],
|
||||
['各种', ' various '],
|
||||
['每个', ' each '],
|
||||
['一个', ' one '],
|
||||
['一些', ' some '],
|
||||
['因', ' due to '],
|
||||
['先', ' first '],
|
||||
['再', ' then '],
|
||||
['非', ' non-'],
|
||||
['没有', ' no '],
|
||||
['无法', ' unable to '],
|
||||
['不能', ' cannot '],
|
||||
['不会', ' will not '],
|
||||
['不用', ' do not need to '],
|
||||
['需要', ' need to '],
|
||||
['可以', ' can '],
|
||||
['支持', ' supports '],
|
||||
['使用', ' use '],
|
||||
['通过', ' through '],
|
||||
['根据', ' according to '],
|
||||
['进入', ' enter '],
|
||||
['显示', ' display '],
|
||||
['影响', ' affects '],
|
||||
['包含', ' includes '],
|
||||
['排查', ' troubleshoot '],
|
||||
['关联', ' linked '],
|
||||
['进行', ' perform '],
|
||||
['检查', ' check '],
|
||||
['收到', ' receives '],
|
||||
['开通', ' activate '],
|
||||
['消耗', ' consume '],
|
||||
['累计', ' cumulative '],
|
||||
['待处理', ' pending '],
|
||||
['立即', ' now '],
|
||||
['的', ' '],
|
||||
['与', ' and '],
|
||||
['和', ' and '],
|
||||
['或', ' or '],
|
||||
['及', ' and '],
|
||||
['并', ' and '],
|
||||
['而', ' '],
|
||||
['从', ' from '],
|
||||
['到', ' to '],
|
||||
['在', ' in '],
|
||||
['为', ' as '],
|
||||
['将', ' will '],
|
||||
['可', ' can '],
|
||||
['会', ' will '],
|
||||
['时', ' when '],
|
||||
['后', ' after '],
|
||||
['前', ' before '],
|
||||
['内', ' within '],
|
||||
['上', ' on '],
|
||||
['下', ' next '],
|
||||
['个', ' '],
|
||||
['条', ' items '],
|
||||
['行', ' rows '],
|
||||
['项', ' items '],
|
||||
['方', ' side '],
|
||||
['性', ''],
|
||||
['取', ''],
|
||||
['锁', ' lock'],
|
||||
['次', ' times '],
|
||||
]
|
||||
|
||||
const cjkPattern = /[\u4e00-\u9fff]/
|
||||
|
||||
function preserveOuterWhitespace(source: string, value: string): string {
|
||||
@@ -3687,50 +3021,14 @@ function preserveOuterWhitespace(source: string, value: string): string {
|
||||
return `${leading}${value}${trailing}`
|
||||
}
|
||||
|
||||
function normalizeLegacyEnglish(value: string): string {
|
||||
return value
|
||||
.replace(/(/g, ' (')
|
||||
.replace(/)/g, ')')
|
||||
.replace(/:/g, ': ')
|
||||
.replace(/,/g, ', ')
|
||||
.replace(/。/g, '.')
|
||||
.replace(/;/g, '; ')
|
||||
.replace(/、/g, ' / ')
|
||||
.replace(/“|”/g, '"')
|
||||
.replace(/…/g, '...')
|
||||
.replace(/:([A-Za-z])/g, ': $1')
|
||||
.replace(/Priority:key/g, 'Priority: key')
|
||||
.replace(/\s+/g, ' ')
|
||||
.replace(/\s+([,.:;!?))])/g, '$1')
|
||||
.replace(/([((])\s+/g, '$1')
|
||||
.trim()
|
||||
}
|
||||
|
||||
function translateLegacyByTokens(source: string): string {
|
||||
let value = source
|
||||
|
||||
for (const [from, to] of legacySortedPhraseMessages) {
|
||||
value = value.split(from).join(to)
|
||||
}
|
||||
|
||||
for (const [from, to] of legacySortedReplacementTokens) {
|
||||
value = value.split(from).join(to)
|
||||
}
|
||||
|
||||
for (const [from, to] of legacyParticleTokens) {
|
||||
value = value.split(from).join(to)
|
||||
}
|
||||
|
||||
return normalizeLegacyEnglish(value)
|
||||
}
|
||||
|
||||
export function translateLegacyText(source: string, locale: keyof typeof messages): string {
|
||||
if (locale !== 'en-US' || !cjkPattern.test(source)) {
|
||||
return source
|
||||
}
|
||||
|
||||
const trimmed = source.trim()
|
||||
const exact = legacyExactEnglishMessages[trimmed]
|
||||
const normalized = trimmed.replace(/\s+/gu, ' ')
|
||||
const exact = legacyStaticEnglishMessages[trimmed] ?? legacyStaticEnglishMessages[normalized]
|
||||
if (exact) {
|
||||
return preserveOuterWhitespace(source, exact)
|
||||
}
|
||||
@@ -3742,8 +3040,8 @@ export function translateLegacyText(source: string, locale: keyof typeof message
|
||||
}
|
||||
}
|
||||
|
||||
const fallback = translateLegacyByTokens(trimmed)
|
||||
return preserveOuterWhitespace(source, fallback)
|
||||
// Unknown text may contain user-provided names or content, so never translate fragments.
|
||||
return source
|
||||
}
|
||||
|
||||
export type Locale = keyof typeof messages
|
||||
|
||||
Reference in New Issue
Block a user