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

@@ -30,6 +30,7 @@ import {
ResponsiveContainer,
} from 'recharts';
import type { JsonData } from '@/types/common';
import { useTranslation } from 'react-i18next';
export function HostDetailDialog({
host,
@@ -40,6 +41,7 @@ export function HostDetailDialog({
onClose: () => void;
onCommand: (hostname: string) => void;
}) {
const { t } = useTranslation();
const [history, setHistory] = useState<JsonData[]>([]);
const [loading, setLoading] = useState(false);
const [hours, setHours] = useState(1);
@@ -78,21 +80,21 @@ export function HostDetailDialog({
<Server className="h-5 w-5 dg-text-blue" />
{host.hostname}
{online ? (
<Badge className="bg-emerald-500/15 dg-text-green border border-emerald-500/30">在线</Badge>
<Badge className="bg-emerald-500/15 dg-text-green border border-emerald-500/30">{t('common.online')}</Badge>
) : (
<Badge className="bg-red-500/15 dg-text-red border border-red-500/30">离线</Badge>
<Badge className="bg-red-500/15 dg-text-red border border-red-500/30">{t('common.offline')}</Badge>
)}
</DialogTitle>
<DialogDescription className="sr-only">查看主机详情和指标趋势</DialogDescription>
<DialogDescription className="sr-only">{t('agent.hostdetaildialog.sffa4f7')}</DialogDescription>
</DialogHeader>
<div className="space-y-4">
{/* 基本信息 */}
<div className="grid grid-cols-2 md:grid-cols-4 gap-3 text-sm">
<InfoCell label="IP 地址" value={host.ip || '--'} />
<InfoCell label="操作系统" value={host.os || host.platform || '--'} />
<InfoCell label="最后上报" value={timeAgo(host.last_report || host.last_reported_at || host.updated_at)} />
<InfoCell label="端口数" value={String(ports.length)} />
<InfoCell label=t('agent.agentIp') value={host.ip || '--'} />
<InfoCell label=t('server.csv.os') value={host.os || host.platform || '--'} />
<InfoCell label=t('agent.agentLastSeen') value={timeAgo(host.last_report || host.last_reported_at || host.updated_at)} />
<InfoCell label=t('agent.hostdetaildialog.s6ad4fc') value={String(ports.length)} />
</div>
{/* 趋势图 */}
@@ -107,9 +109,9 @@ export function HostDetailDialog({
<SelectValue />
</SelectTrigger>
<SelectContent className="dg-input">
<SelectItem value="1">最近 1 小时</SelectItem>
<SelectItem value="6">最近 6 小时</SelectItem>
<SelectItem value="24">最近 24 小时</SelectItem>
<SelectItem value="1">{t('agent.hostdetaildialog.s3851af')}</SelectItem>
<SelectItem value="6">{t('agent.hostdetaildialog.s2d59b1')}</SelectItem>
<SelectItem value="24">{t('agent.hostdetaildialog.s768a1b')}</SelectItem>
</SelectContent>
</Select>
</div>
@@ -119,7 +121,7 @@ export function HostDetailDialog({
<Loader2 className="h-5 w-5 animate-spin dg-text-muted" />
</div>
) : chartData.length === 0 ? (
<div className="h-full flex items-center justify-center text-sm dg-text-muted">暂无历史数据</div>
<div className="h-full flex items-center justify-center text-sm dg-text-muted">{t('agent.hostdetaildialog.sdc73db')}</div>
) : (
<ResponsiveContainer width="100%" height="100%">
<AreaChart data={chartData} margin={{ top: 5, right: 5, bottom: 0, left: -20 }}>
@@ -144,8 +146,8 @@ export function HostDetailDialog({
contentStyle={{ backgroundColor: '#0f172a', border: '1px solid #1e293b', borderRadius: '6px', color: '#f8fafc', fontSize: '12px' }}
/>
<Area type="monotone" dataKey="cpu" stroke="#3b82f6" fill="url(#gCpu)" name="CPU" />
<Area type="monotone" dataKey="mem" stroke="#10b981" fill="url(#gMem)" name="内存" />
<Area type="monotone" dataKey="disk" stroke="#f59e0b" fill="url(#gDisk)" name="磁盘" />
<Area type="monotone" dataKey="mem" stroke="#10b981" fill="url(#gMem)" name=t('k8s.pods.memory') />
<Area type="monotone" dataKey="disk" stroke="#f59e0b" fill="url(#gDisk)" name=t('dashboard.topUsage.disk') />
</AreaChart>
</ResponsiveContainer>
)}
@@ -159,7 +161,7 @@ export function HostDetailDialog({
端口发现 ({ports.length})
</span>
{ports.length === 0 ? (
<p className="text-xs dg-text-muted">暂无端口数据</p>
<p className="text-xs dg-text-muted">{t('agent.hostdetaildialog.se7887d')}</p>
) : (
<div className="flex flex-wrap gap-1.5 max-h-32 overflow-y-auto">
{ports.map((p, idx) => (
@@ -191,6 +193,7 @@ export function HostDetailDialog({
}
function InfoCell({ label, value }: { label: string; value: string }) {
const { t } = useTranslation();
return (
<div className="bg-[var(--dg-bg-primary)] border border-[var(--dg-border)] rounded-lg px-3 py-2">
<div className="text-xs dg-text-muted">{label}</div>