feat(i18n): 全量中英文国际化改造

- 翻译 en-US.json 中 1006 条未翻译的中文条目为英文
- 提取 30+ 组件文件的硬编码中文到 locale JSON
- 新增 900+ 翻译键覆盖所有业务模块:
  - Layout (Sidebar, Header, Breadcrumb)
  - Server (ServerForm, CloudServerImport, WebShell, RdpTools)
  - Deploy (ReleaseManager, PipelineCreate, AppRelease)
  - Kubernetes (DeploymentEdit, PodExec, PodLogs, ResourceEditor)
  - Monitor (UnifiedQueryPanel, AlertCenter, Prometheus/Grafana Dashboard)
  - AIOps (predictUtils, PredictiveCostTab, AIPredictive)
  - System (useLdapManagement, AgentMonitor, AgentWizard)
- tsc --noEmit 类型检查通过
This commit is contained in:
attacker committed 2026-07-04 03:42:27 +08:00
1 parent 76ec9387f0
commit a9513c2056
44 files changed
+4342 -1792

No files matched your search

@@ -122,13 +122,13 @@ const AlertCenter: React.FC = () => {
const hours = unit === 'd' ? num * 24 : num;
const endTime = new Date(now.getTime() + hours * 3600_000);
await alertCenterApi.createSilence({
name: `静默: ${alert?.title || id} (${duration})`,
name: `${t('monitor.alertCenterPanel.silencePrefix')} ${alert?.title || id} (${duration})`,
description: `${t('alert.silenceDesc')} — ${alert?.source || ''}`,
silence_type: 'onetime',
start_time: now.toISOString(),
end_time: endTime.toISOString(),
});
toast.success(`告警已静默 ${duration}`);
toast.success(t('monitor.alertCenterPanel.silencedFor', { duration }));
setSilenceOpen(false);
refetchAlerts();
} catch {
@@ -173,10 +173,10 @@ const AlertCenter: React.FC = () => {
const pageTabs = [
{ id: 'alerts', label: t('alert.tab.alerts') },
{ id: 'rules', label: t('alert.tab.rules') },
{ id: 'metrics', label: '指标目录' },
{ id: 'metrics', label: t('monitor.alertCenterPanel.metricCatalog') },
{ id: 'contacts', label: t('alert.tab.contacts') },
{ id: 'groups', label: t('alert.tab.groups') },
{ id: 'notify', label: '通知策略' },
{ id: 'notify', label: t('monitor.alertCenterPanel.notifyPolicy') },
];
const alertsToolbar = activeTab === 'alerts' ? (
@@ -215,15 +215,15 @@ const AlertCenter: React.FC = () => {
</Select>
<Select value={sourceFilter} onValueChange={(v) => handleFilterChange('source', v)}>
<SelectTrigger className="w-[120px] h-8 text-xs">
<SelectValue placeholder="来源" />
<SelectValue placeholder={t('monitor.alertCenterPanel.sourcePlaceholder')} />
</SelectTrigger>
<SelectContent>
<SelectItem value="all">全部来源</SelectItem>
<SelectItem value="host">主机监控</SelectItem>
<SelectItem value="middleware">中间件监控</SelectItem>
<SelectItem value="snmp">SNMP 监控</SelectItem>
<SelectItem value="site">站点拨测</SelectItem>
<SelectItem value="log">日志告警</SelectItem>
<SelectItem value="all">{t('monitor.alertCenterPanel.allSources')}</SelectItem>
<SelectItem value="host">{t('monitor.alertCenterPanel.hostMonitor')}</SelectItem>
<SelectItem value="middleware">{t('monitor.alertCenterPanel.middlewareMonitor')}</SelectItem>
<SelectItem value="snmp">{t('monitor.alertCenterPanel.snmpMonitor')}</SelectItem>
<SelectItem value="site">{t('monitor.alertCenterPanel.siteProbe')}</SelectItem>
<SelectItem value="log">{t('monitor.alertCenterPanel.logAlert')}</SelectItem>
</SelectContent>
</Select>
</div>
@@ -239,8 +239,8 @@ const AlertCenter: React.FC = () => {
return (
<PageShell
variant="list"
title="告警中心"
subtitle="告警事件处理、规则与通知配置"
title={t('monitor.alertCenterPanel.alertCenterTitle')}
subtitle={t('monitor.alertCenterPanel.alertCenterSubtitle')}
icon={<AlertTriangle className="h-5 w-5" />}
tabs={pageTabs}
activeTab={activeTab}
@@ -262,7 +262,7 @@ const AlertCenter: React.FC = () => {
</Button>
) : activeTab === 'contacts' ? (
<Button size="sm" className="dg-btn-primary" onClick={() => { setEditingContact(null); setContactDialogOpen(true); }}>
<Plus className="w-4 h-4 mr-1" />添加联系人
<Plus className="w-4 h-4 mr-1" />{t('monitor.alertCenterPanel.addContact')}
</Button>
) : activeTab === 'groups' ? (
<>
@@ -270,7 +270,7 @@ const AlertCenter: React.FC = () => {
<RefreshCw className="w-4 h-4 mr-2" />{t('common.refresh')}
</Button>
<Button className="dg-btn-primary" onClick={() => { setEditingGroup(null); setGroupDialogOpen(true); }}>
<Plus className="w-4 h-4 mr-2" />添加联系组
<Plus className="w-4 h-4 mr-2" />{t('monitor.alertCenterPanel.addContactGroup')}
</Button>
</>
) : undefined}
@@ -407,7 +407,7 @@ const AlertCenter: React.FC = () => {
{activeTab === 'contacts' && (
contacts.length === 0 ? (
<PageEmpty title="暂无报警联系人" description="点击「添加联系人」创建" />
<PageEmpty title={t('monitor.alertCenterPanel.noContactsTitle')} description={t('monitor.alertCenterPanel.noContactsDesc')} />
) : (
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3">
{contacts.map((c) => (
@@ -435,7 +435,7 @@ const AlertCenter: React.FC = () => {
<div className="flex gap-1.5 pt-1.5">
<Button variant="outline" size="sm" className="h-7 text-xs flex-1"
onClick={() => { setEditingContact(c); setContactDialogOpen(true); }}>
编辑
{t("monitor.alertCenterPanel.edit")}
</Button>
<Button variant="outline" size="sm" className="h-7 text-xs"
onClick={async () => {
@@ -444,7 +444,7 @@ const AlertCenter: React.FC = () => {
try { await alertApi.deleteContact(c.id); toast.success(t('alert.deleted')); fetchContacts(); }
catch { toast.error(t('alert.deleteFailed')); }
}}>
删除
{t("monitor.alertCenterPanel.delete")}
</Button>
</div>
</CardContent>
@@ -458,7 +458,7 @@ const AlertCenter: React.FC = () => {
{activeTab === 'groups' && (
contactGroups.length === 0 ? (
<PageEmpty title="暂无报警联系组" description="点击「添加联系组」创建" />
<PageEmpty title={t('monitor.alertCenterPanel.noGroupsTitle')} description={t('monitor.alertCenterPanel.noGroupsDesc')} />
) : (
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
{contactGroups.map((g) => {
@@ -485,7 +485,7 @@ const AlertCenter: React.FC = () => {
<div className="flex gap-2 pt-2">
<Button variant="outline" size="sm" className="flex-1"
onClick={() => { setEditingGroup(g); setGroupDialogOpen(true); }}>
编辑
{t("monitor.alertCenterPanel.edit")}
</Button>
<Button variant="outline" size="sm"
onClick={async () => {
@@ -494,7 +494,7 @@ const AlertCenter: React.FC = () => {
try { await alertApi.deleteContactGroup(g.id); toast.success(t('alert.deleted')); fetchContactGroups(); }
catch { toast.error(t('alert.deleteFailed')); }
}}>
删除
{t("monitor.alertCenterPanel.delete")}
</Button>
</div>
</CardContent>