fix(i18n): 回退到稳定的 32% 覆盖率状态 (tsc + Vite 构建通过)

批量转换脚本引入的语法错误已回退,保留稳定的 i18n 转换:
- 翻译词典: 22 namespaces, 3600+ keys
- 已接入: 145+ 文件 (Dashboard/Login/K8s 主页面/Monitor/System/Deploy)
- 语言切换器在 Header 中可用 (🇨🇳/🇺🇸)
- tsc 零错误, Vite 构建成功
This commit is contained in:
attacker committed 2026-07-03 02:02:29 +08:00
1 parent ecec73989b
commit 72bfb0e12d
191 files changed
+5057 -7592

No files matched your search

@@ -1,4 +1,3 @@
import i18n from '@/i18n';
// 站点拨测辅助函数 // Logan.Li
export const PROBE_TYPE_OPTIONS = ['HTTP', 'SSL', 'TCP', 'DNS', 'PING'] as const;
@@ -57,10 +56,10 @@ export const SITE_TIME_RANGE_HOURS: Record<SiteTimeRange, number> = {
};
export const SITE_TIME_RANGE_LABELS: Record<SiteTimeRange, string> = {
'1h': i18n.t('monitor.helpers.sf972b7'),
'6h': i18n.t('monitor.siteProtocol.rangeDefault'),
'24h': i18n.t('monitor.helpers.s6e99b7'),
'7d': i18n.t('monitor.helpers.sd765ef'),
'1h': '近 1 小时',
'6h': '近 6 小时',
'24h': '近 24 小时',
'7d': '近 7 天',
};
/** 各协议推荐默认拨测间隔(秒)// Logan.Li */
@@ -86,24 +85,24 @@ export function defaultProbeFrequency(type: ProbeType): number {
}
export const probeTypeMeta: Record<ProbeType, { label: string; placeholder: string; hint: string }> = {
HTTP: { label: i18n.t('monitor.helpers.s277c74'), placeholder: 'https://example.com/health', hint: i18n.t('monitor.helpers.s953f0b') },
SSL: { label: i18n.t('monitor.helpers.s8e3a1e'), placeholder: i18n.t('monitor.helpers.s8a6cb9'), hint: i18n.t('monitor.helpers.sefe596') },
TCP: { label: i18n.t('monitor.helpers.seeda3a'), placeholder: i18n.t('monitor.helpers.sd315f5'), hint: i18n.t('monitor.helpers.s5a87d2') },
DNS: { label: i18n.t('cloud.domainName'), placeholder: 'example.com', hint: i18n.t('monitor.helpers.sd3fd8f') },
PING: { label: i18n.t('monitor.helpers.saeb527'), placeholder: i18n.t('monitor.helpers.sd6bbd6'), hint: i18n.t('monitor.helpers.se850c8') },
HTTP: { label: '目标 URL', placeholder: 'https://example.com/health', hint: 'Web 请求(支持 http/https),检测状态码与响应时间' },
SSL: { label: 'SSL 地址', placeholder: 'example.com:443 或 https://example.com', hint: 'TLS 握手检测证书(支持 host:port / https:// 域名,不发起 HTTP 请求)' },
TCP: { label: '主机:端口', placeholder: '192.168.1.1:8080 或 example.com:443', hint: 'TCP 端口连通性' },
DNS: { label: '域名', placeholder: 'example.com', hint: 'DNS 解析延迟与结果' },
PING: { label: '主机地址', placeholder: '192.168.1.1 或 example.com', hint: 'ICMP 连通性与延迟(默认 2 分钟/次)' },
};
export function probeFrequencyHint(type: ProbeType): string {
const sec = defaultProbeFrequency(type);
return i18n.t('monitor.helpers.see003c', { fmtFrequency(sec): fmtFrequency(sec), fmtFrequency(MIN_PROBE_FREQUENCY[type]): fmtFrequency(MIN_PROBE_FREQUENCY[type]) });
return `推荐 ${fmtFrequency(sec)},最小 ${fmtFrequency(MIN_PROBE_FREQUENCY[type])}`;
}
/** 拨测频率展示 // Logan.Li */
export function fmtFrequency(sec?: number): string {
if (!sec) return '--';
if (sec < 60) return i18n.t('monitor.helpers.s9c205b', { sec: sec });
if (sec < 3600) return i18n.t('monitor.helpers.s425b42', { Math.round(sec / 60): Math.round(sec / 60) });
return i18n.t('monitor.helpers.s22e889', { (sec / 3600).toFixed(1): (sec / 3600).toFixed(1) });
if (sec < 60) return `${sec}秒`;
if (sec < 3600) return `${Math.round(sec / 60)}分钟`;
return `${(sec / 3600).toFixed(1)}小时`;
}
/** 可用率 / 响应时间组合展示 // Logan.Li */
@@ -146,10 +145,10 @@ export function isSslExpiringSoon(days?: number, threshold = SSL_EXPIRY_WARN_DAY
/** SSL 证书剩余天数展示 // Logan.Li */
export function fmtSslDays(days?: number): { text: string; tone: string } {
if (days == null) return { text: '--', tone: 'text-[var(--dg-text-muted)]' };
if (days < 0) return { text: i18n.t('monitor.sslExpired'), tone: 'dg-text-red' };
if (days <= 7) return { text: i18n.t('monitor.helpers.s510381_1', { days: days }), tone: 'dg-text-red' };
if (days <= 30) return { text: i18n.t('monitor.helpers.s510381_0', { days: days }), tone: 'dg-text-yellow' };
return { text: i18n.t('monitor.helpers.s510381', { days: days }), tone: 'dg-text-green' };
if (days < 0) return { text: '已过期', tone: 'dg-text-red' };
if (days <= 7) return { text: `${days}天`, tone: 'dg-text-red' };
if (days <= 30) return { text: `${days}天`, tone: 'dg-text-yellow' };
return { text: `${days}天`, tone: 'dg-text-green' };
}
/** 归一化拨测协议类型 // Logan.Li */