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,7 +1,6 @@
// 站点拨测可观测分析 — 按协议聚合指标与异常事件 // Logan.Li
import type { SiteResult, SiteTask } from '../helpers';
import { fmtMs, fmtTime, normalizeProbeType } from '../helpers';
import i18n from '@/i18n';
export interface ProbeEvent {
id: string;
@@ -93,16 +92,16 @@ export function analyzeHttpResults(results: SiteResult[], task: SiteTask): HttpO
}
if (code >= 500) {
err5xx++;
pushEvent(events, r, `HTTP ${code}`, 'error', r.error_message || i18n.t('monitor.analytics.s71de8a'));
pushEvent(events, r, `HTTP ${code}`, 'error', r.error_message || '服务端错误');
} else if (code >= 400) {
err4xx++;
pushEvent(events, r, `HTTP ${code}`, 'warn', r.error_message || i18n.t('monitor.analytics.sdc751c'));
pushEvent(events, r, `HTTP ${code}`, 'warn', r.error_message || '客户端/鉴权错误');
} else if (r.status === 'timeout') {
otherErr++;
pushEvent(events, r, i18n.t('common.timeoutError'), 'error', r.error_message);
pushEvent(events, r, '请求超时', 'error', r.error_message);
} else {
otherErr++;
pushEvent(events, r, code > 0 ? `HTTP ${code}` : i18n.t('monitor.analytics.sf50bf4'), 'error', r.error_message);
pushEvent(events, r, code > 0 ? `HTTP ${code}` : '请求失败', 'error', r.error_message);
}
}
const latest = results[0];
@@ -128,9 +127,9 @@ export function analyzeSslResults(results: SiteResult[], task: SiteTask): SslObs
const events: ProbeEvent[] = [];
for (const r of results) {
if (r.status !== 'success') {
pushEvent(events, r, i18n.t('monitor.analytics.sddbae5'), 'error', r.error_message);
pushEvent(events, r, 'TLS 握手失败', 'error', r.error_message);
} else if (r.ssl_days_remaining != null && r.ssl_days_remaining < 30) {
pushEvent(events, r, i18n.t('monitor.analytics.s819918', { r.ssl_days_remaining: r.ssl_days_remaining }), r.ssl_days_remaining <= 7 ? 'error' : 'warn', expiry);
pushEvent(events, r, `证书剩余 ${r.ssl_days_remaining} 天`, r.ssl_days_remaining <= 7 ? 'error' : 'warn', expiry);
}
}
const chart = tooltipOrder(results)
@@ -158,10 +157,10 @@ function analyzeLatencyResults(results: SiteResult[], label: string): LatencyObs
const latency = r.response_time ?? r.total_time ?? 0;
const failed = r.status !== 'success';
const spike = !failed && latency > spikeThreshold;
if (failed) pushEvent(events, r, i18n.t('monitor.analytics.s6fce61', { label: label }), 'error', r.error_message || r.remote_ip);
if (failed) pushEvent(events, r, `${label}失败`, 'error', r.error_message || r.remote_ip);
else if (spike) {
spikeCount++;
pushEvent(events, r, i18n.t('monitor.analytics.s80bda9', { label: label }), 'warn', fmtMs(latency));
pushEvent(events, r, `${label}延迟波动`, 'warn', fmtMs(latency));
}
return { time: fmtTime(r.checked_at).slice(-5), latency, failed, spike };
});
@@ -173,7 +172,7 @@ export function analyzePingResults(results: SiteResult[]): LatencyObsSummary {
}
export function analyzeDnsResults(results: SiteResult[]): LatencyObsSummary {
return analyzeLatencyResults(results, i18n.t('cloud.domainResolve'));
return analyzeLatencyResults(results, 'DNS 解析');
}
export function analyzeTcpResults(results: SiteResult[]): ConnectivityObsSummary {
@@ -186,7 +185,7 @@ export function analyzeTcpResults(results: SiteResult[]): ConnectivityObsSummary
const failed = r.status !== 'success';
if (failed) {
lastFailAt = r.checked_at;
pushEvent(events, r, i18n.t('monitor.analytics.s0614a3'), 'error', r.error_message || i18n.t('aiops.llmTestFailed'));
pushEvent(events, r, 'TCP 不通', 'error', r.error_message || '连接失败');
}
return { time: fmtTime(r.checked_at).slice(-5), up: failed ? 0 : 100, failed };
});