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

@@ -24,6 +24,7 @@ import { toast } from 'sonner';
import { billingApi } from '@/api';
import { providerLabels } from './CloudBillingHelpers';
import type { JsonData } from '@/types/common';
import { useTranslation } from 'react-i18next';
const emptyRule = { name: '', provider: '', metric: 'daily', threshold: '', operator: '>', enabled: true };
@@ -35,6 +36,7 @@ interface Props {
}
export function BillingRuleDialog({ open, onOpenChange, editingRule, onSuccess }: Props) {
const { t } = useTranslation();
const [form, setForm] = useState<JsonData>(emptyRule);
const [submitting, setSubmitting] = useState(false);
@@ -57,7 +59,7 @@ export function BillingRuleDialog({ open, onOpenChange, editingRule, onSuccess }
const handleSave = async () => {
if (!form.name || !form.threshold) {
toast.error('请填写规则名称和阈值');
toast.error(t('cloud.billingruledialog.sd36855'));
return;
}
setSubmitting(true);
@@ -70,9 +72,9 @@ export function BillingRuleDialog({ open, onOpenChange, editingRule, onSuccess }
}
onOpenChange(false);
onSuccess();
toast('保存成功');
toast(t('common.savedSuccessfully'));
} catch (e) {
toast.error('保存失败', { description: (e as JsonData).message });
toast.error(t('common.saveFailed'), { description: (e as JsonData).message });
} finally {
setSubmitting(false);
}
@@ -82,21 +84,21 @@ export function BillingRuleDialog({ open, onOpenChange, editingRule, onSuccess }
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className="max-w-md">
<DialogHeader>
<DialogTitle>{editingRule ? '编辑预警规则' : '添加预警规则'}</DialogTitle>
<DialogDescription>设置成本阈值,超标时自动预警</DialogDescription>
<DialogTitle>{editingRule ? t('cloud.billingruledialog.sb8cfa0') : t('cloud.billingruledialog.sd58c54')}</DialogTitle>
<DialogDescription>{t('cloud.billingruledialog.s75227f')}</DialogDescription>
</DialogHeader>
<div className="space-y-3">
<div>
<Label className="text-sm text-[var(--dg-text-secondary)]">规则名称 *</Label>
<Input className="mt-1" placeholder="如:日成本超 500 元预警" value={form.name} onChange={(e) => setForm({ ...form, name: e.target.value })} />
<Label className="text-sm text-[var(--dg-text-secondary)]">{t('cloud.billingruledialog.s34fe90')}</Label>
<Input className="mt-1" placeholder=t('cloud.billingruledialog.sc147ac') value={form.name} onChange={(e) => setForm({ ...form, name: e.target.value })} />
</div>
<div className="grid grid-cols-2 gap-3">
<div>
<Label className="text-sm text-[var(--dg-text-secondary)]">厂商</Label>
<Label className="text-sm text-[var(--dg-text-secondary)]">{t('common.vendor')}</Label>
<Select value={form.provider || 'all'} onValueChange={(v) => setForm({ ...form, provider: v === 'all' ? '' : v })}>
<SelectTrigger className="mt-1"><SelectValue /></SelectTrigger>
<SelectContent>
<SelectItem value="all">全部厂商</SelectItem>
<SelectItem value="all">{t('cloud.billingruledialog.sc356f1')}</SelectItem>
{Object.entries(providerLabels).map(([k, v]) => (
<SelectItem key={k} value={k}>{v}</SelectItem>
))}
@@ -104,41 +106,41 @@ export function BillingRuleDialog({ open, onOpenChange, editingRule, onSuccess }
</Select>
</div>
<div>
<Label className="text-sm text-[var(--dg-text-secondary)]">指标</Label>
<Label className="text-sm text-[var(--dg-text-secondary)]">{t('cloud.colMetric')}</Label>
<Select value={form.metric} onValueChange={(v) => setForm({ ...form, metric: v })}>
<SelectTrigger className="mt-1"><SelectValue /></SelectTrigger>
<SelectContent>
<SelectItem value="daily">日成本</SelectItem>
<SelectItem value="monthly">月累计</SelectItem>
<SelectItem value="daily">{t('cloud.dailyCost')}</SelectItem>
<SelectItem value="monthly">{t('cloud.monthlyAccumulated')}</SelectItem>
</SelectContent>
</Select>
</div>
</div>
<div className="grid grid-cols-2 gap-3">
<div>
<Label className="text-sm text-[var(--dg-text-secondary)]">比较</Label>
<Label className="text-sm text-[var(--dg-text-secondary)]">{t('cloud.billingruledialog.sd7650e')}</Label>
<Select value={form.operator} onValueChange={(v) => setForm({ ...form, operator: v })}>
<SelectTrigger className="mt-1"><SelectValue /></SelectTrigger>
<SelectContent>
<SelectItem value=">">大于 &gt;</SelectItem>
<SelectItem value=">=">大于等于 &ge;</SelectItem>
<SelectItem value="<">小于 &lt;</SelectItem>
<SelectItem value="<=">小于等于 &le;</SelectItem>
<SelectItem value=">">{t('cloud.billingruledialog.s3dba97')}</SelectItem>
<SelectItem value=">=">{t('cloud.billingruledialog.s8e1e26')}</SelectItem>
<SelectItem value="<">{t('cloud.billingruledialog.s0196c1')}</SelectItem>
<SelectItem value="<=">{t('cloud.billingruledialog.s45c301')}</SelectItem>
</SelectContent>
</Select>
</div>
<div>
<Label className="text-sm text-[var(--dg-text-secondary)]">阈值(元) *</Label>
<Label className="text-sm text-[var(--dg-text-secondary)]">{t('cloud.billingruledialog.s11f9fb')}</Label>
<Input type="number" step="0.01" className="mt-1" placeholder="500.00" value={form.threshold} onChange={(e) => setForm({ ...form, threshold: e.target.value })} />
</div>
</div>
<div className="flex items-center gap-2">
<Switch checked={form.enabled} onCheckedChange={(v) => setForm({ ...form, enabled: v })} />
<Label className="text-sm text-[var(--dg-text-secondary)]">启用</Label>
<Label className="text-sm text-[var(--dg-text-secondary)]">{t('common.enable')}</Label>
</div>
</div>
<DialogFooter>
<Button variant="outline" onClick={() => onOpenChange(false)}>取消</Button>
<Button variant="outline" onClick={() => onOpenChange(false)}>{t('common.cancel')}</Button>
<Button onClick={handleSave} disabled={submitting}>
{submitting && <Loader2 className="h-4 w-4 mr-1 animate-spin" />}
保存