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:
1 parent
78c27037e3
commit
ecec73989b
166 files changed
+6925
-2800
No files matched your search
@@ -18,6 +18,7 @@ import { toast } from 'sonner';
|
||||
import { alertApi } from '@/api';
|
||||
import { renderRuleChannels } from './alertShared';
|
||||
import type { AlertChannel, AlertRuleRecord } from '@/types';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
const COL_SPAN = 9; // 复选框 + 7 数据列 + 操作列 // Logan.Li
|
||||
|
||||
@@ -32,6 +33,7 @@ export function AlertRulesTab({
|
||||
onReload: () => void;
|
||||
onEditRule: ( rule: AlertRuleRecord) => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const confirm = useConfirm();
|
||||
const [selectedIds, setSelectedIds] = useState<number[]>([]);
|
||||
|
||||
@@ -53,19 +55,19 @@ export function AlertRulesTab({
|
||||
|
||||
const handleDeleteRule = async ( id: number) => {
|
||||
const ok = await confirm({
|
||||
title: '删除告警规则',
|
||||
description: '确定删除此告警规则?',
|
||||
confirmText: '删除',
|
||||
title: t('monitor.alertrulestab.sfa5bfd'),
|
||||
description: t('monitor.alertrulestab.sd30155'),
|
||||
confirmText: t('common.delete'),
|
||||
variant: 'destructive',
|
||||
});
|
||||
if (!ok) return;
|
||||
try {
|
||||
await alertApi.deleteRule(id);
|
||||
toast.success('告警规则已删除');
|
||||
toast.success(t('monitor.alertrulestab.s20b3fd'));
|
||||
onReload();
|
||||
} catch (error) {
|
||||
console.error('Failed to delete rule:', error);
|
||||
toast.error('删除失败');
|
||||
toast.error(t('common.deleteFailed'));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -73,20 +75,20 @@ export function AlertRulesTab({
|
||||
const handleBatchDelete = async () => {
|
||||
if (selectedIds.length === 0) return;
|
||||
const ok = await confirm({
|
||||
title: '批量删除告警规则',
|
||||
description: `确定删除选中的 ${selectedIds.length} 条告警规则吗?此操作不可撤销。`,
|
||||
confirmText: '批量删除',
|
||||
title: t('monitor.alertrulestab.sbb457b'),
|
||||
description: t('monitor.alertrulestab.s12d681', { selectedIds.length: selectedIds.length }),
|
||||
confirmText: t('common.batchDelete'),
|
||||
variant: 'destructive',
|
||||
});
|
||||
if (!ok) return;
|
||||
try {
|
||||
await alertApi.batchDeleteRules(selectedIds);
|
||||
toast.success(`已删除 ${selectedIds.length} 条告警规则`);
|
||||
toast.success(t('monitor.alertrulestab.s327a78', { selectedIds.length: selectedIds.length }));
|
||||
setSelectedIds([]);
|
||||
onReload();
|
||||
} catch (error) {
|
||||
console.error('Failed to batch delete rules:', error);
|
||||
toast.error('批量删除失败');
|
||||
toast.error(t('cloud.batchDeleteFailed'));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -132,14 +134,14 @@ export function AlertRulesTab({
|
||||
className="border-[var(--dg-border-hover)]"
|
||||
/>
|
||||
</TableHead>
|
||||
<TableHead className="dg-text-secondary">规则名称</TableHead>
|
||||
<TableHead className="dg-text-secondary">数据源</TableHead>
|
||||
<TableHead className="dg-text-secondary">触发条件</TableHead>
|
||||
<TableHead className="dg-text-secondary">级别</TableHead>
|
||||
<TableHead className="dg-text-secondary">持续时间</TableHead>
|
||||
<TableHead className="dg-text-secondary">通知渠道</TableHead>
|
||||
<TableHead className="dg-text-secondary">状态</TableHead>
|
||||
<TableHead className="dg-text-secondary text-right">操作</TableHead>
|
||||
<TableHead className="dg-text-secondary">{t('monitor.ruleName')}</TableHead>
|
||||
<TableHead className="dg-text-secondary">{t('menu.datasources')}</TableHead>
|
||||
<TableHead className="dg-text-secondary">{t('monitor.alertrulestab.s65939c')}</TableHead>
|
||||
<TableHead className="dg-text-secondary">{t('common.level')}</TableHead>
|
||||
<TableHead className="dg-text-secondary">{t('monitor.alertDuration')}</TableHead>
|
||||
<TableHead className="dg-text-secondary">{t('monitor.notificationChannel')}</TableHead>
|
||||
<TableHead className="dg-text-secondary">{t('common.status')}</TableHead>
|
||||
<TableHead className="dg-text-secondary text-right">{t('common.actions')}</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
|
||||
Reference in new issue
Block a user