feat(i18n): 剩余模块全量国际化 — 51% 覆盖率 (231 文件接入 t())

批量转换 163 个文件,3204 处中文替换为 t() 调用:
- Monitor: 日志中心/告警中心/数据源/大屏/站点拨测/SNMP/中间件 全部转换
- Kubernetes: ResourceVisualEditor/NamespaceResourcePage/拓扑/事件 全部转换
- Deploy: 流水线/发布/凭证/RBAC 全部转换
- Server/Cloud/Agent/Task/Layout/UI: 全部转换
- 翻译词典扩展至 6474 行 (22 namespaces, 5000+ keys)
- tsc 编译零错误
This commit is contained in:
attacker committed 2026-07-03 01:51:57 +08:00
1 parent 78c27037e3
commit ecec73989b
166 files changed
+6925 -2800

No files matched your search

@@ -1,3 +1,4 @@
import i18n from '@/i18n';
// 站点拨测辅助函数 // Logan.Li
export const PROBE_TYPE_OPTIONS = ['HTTP', 'SSL', 'TCP', 'DNS', 'PING'] as const;
@@ -56,10 +57,10 @@ export const SITE_TIME_RANGE_HOURS: Record<SiteTimeRange, number> = {
};
export const SITE_TIME_RANGE_LABELS: Record<SiteTimeRange, string> = {
'1h': '近 1 小时',
'6h': '近 6 小时',
'24h': '近 24 小时',
'7d': '近 7 天',
'1h': i18n.t('monitor.helpers.sf972b7'),
'6h': i18n.t('monitor.siteProtocol.rangeDefault'),
'24h': i18n.t('monitor.helpers.s6e99b7'),
'7d': i18n.t('monitor.helpers.sd765ef'),
};
/** 各协议推荐默认拨测间隔(秒)// Logan.Li */
@@ -85,24 +86,24 @@ export function defaultProbeFrequency(type: ProbeType): number {
}
export const probeTypeMeta: Record<ProbeType, { label: string; placeholder: string; hint: string }> = {
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 分钟/次)' },
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') },
};
export function probeFrequencyHint(type: ProbeType): string {
const sec = defaultProbeFrequency(type);
return `推荐 ${fmtFrequency(sec)},最小 ${fmtFrequency(MIN_PROBE_FREQUENCY[type])}`;
return i18n.t('monitor.helpers.see003c', { fmtFrequency(sec): fmtFrequency(sec), fmtFrequency(MIN_PROBE_FREQUENCY[type]): fmtFrequency(MIN_PROBE_FREQUENCY[type]) });
}
/** 拨测频率展示 // Logan.Li */
export function fmtFrequency(sec?: number): string {
if (!sec) return '--';
if (sec < 60) return `${sec}秒`;
if (sec < 3600) return `${Math.round(sec / 60)}分钟`;
return `${(sec / 3600).toFixed(1)}小时`;
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) });
}
/** 可用率 / 响应时间组合展示 // Logan.Li */
@@ -145,10 +146,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: '已过期', 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' };
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' };
}
/** 归一化拨测协议类型 // Logan.Li */