fix(i18n): U18 幻影 i18n hash 键治理 — 从 git 历史恢复 1540/1696 处原始中文文本 (91%)

问题: i18n 批量转换 (commit 55f216c) 生成了 813 个 hash 键引用但翻译从未写入 JSON,
导致用户在受影响模块看到 hash 键路径(如 monitor.quickquerybarts.s64559524)而非实际文本.
影响范围: 126 个文件、1696 处引用、monitor/kubernetes/aiops/pipeline/task/agent/cloud 11 个命名空间.

修复策略: 用 git 历史中 pre-i18n 版本(commit 7e1c8f5)的原始中文文本,
通过结构相似度匹配(difflib SequenceMatcher)将 hash 键引用替换为实际字符串.
对于组件拆分后产生的新文件,映射到其原始源文件查找中文文本.

修复明细:
- monitor 命名空间: 335 键修复(站点拨测/日志中心/中间件监控/告警规则/SNMP/主机监控)
- kubernetes 命名空间: 195 键修复(资源编辑器/Deployment编辑器/事件/命名空间/Pod日志)
- aiops 命名空间: 70 键修复(容量预测/成本预测/告警分析)
- pipeline/task/agent/cloud/common 命名空间: 其余键修复

验证: tsc -b=0, npm build✓ (16.87s), ESLint=0/0/0, go build=0, 17/17 测试通过, Docker healthy
This commit is contained in:
attacker committed 2026-07-11 05:49:23 +08:00
1 parent be1011eb58
commit 4c4aaf60f6
100 files changed
+688 -688

No files matched your search

@@ -66,7 +66,7 @@ export function BillingRecordDialog({ open, onOpenChange, editingRecord, onSucce
const handleSave = async () => {
if (!form.provider || !form.billing_date || !form.cost) {
toast.error(i18n.t('cloud.billingrecorddi.sd8a97c17'));
toast.error(i18n.t('请填写必填字段'));
return;
}
setSubmitting(true);
@@ -92,7 +92,7 @@ export function BillingRecordDialog({ open, onOpenChange, editingRecord, onSucce
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className="max-w-md">
<DialogHeader>
<DialogTitle>{editingRecord ? i18n.t('cloud.billingrecorddi.s3c91e420') : i18n.t('cloud.recordCost')}</DialogTitle>
<DialogTitle>{editingRecord ? i18n.t('编辑成本记录') : i18n.t('cloud.recordCost')}</DialogTitle>
<DialogDescription> {i18n.t('cloud.billingrecorddi.s09e541fd')} </DialogDescription>
</DialogHeader>
<div className="space-y-3">
@@ -130,7 +130,7 @@ export function BillingRecordDialog({ open, onOpenChange, editingRecord, onSucce
</div>
<div>
<Label className="text-sm text-[var(--dg-text-secondary)]"> {i18n.t('cloud.accountName')} </Label>
<Input className="mt-1" placeholder={i18n.t('cloud.billingrecorddi.s0010795e')} value={form.account_name} onChange={(e) => setForm({ ...form, account_name: e.target.value })} />
<Input className="mt-1" placeholder={i18n.t('主账号')} value={form.account_name} onChange={(e) => setForm({ ...form, account_name: e.target.value })} />
</div>
</div>
<div>
@@ -58,7 +58,7 @@ export function BillingRuleDialog({ open, onOpenChange, editingRule, onSuccess }
const handleSave = async () => {
if (!form.name || !form.threshold) {
toast.error(i18n.t('cloud.billingruledial.sd36855b1'));
toast.error(i18n.t('请填写规则名称和阈值'));
return;
}
setSubmitting(true);
@@ -83,13 +83,13 @@ export function BillingRuleDialog({ open, onOpenChange, editingRule, onSuccess }
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className="max-w-md">
<DialogHeader>
<DialogTitle>{editingRule ? i18n.t('cloud.billingruledial.sb8cfa0c9') : i18n.t('cloud.billingruledial.sd58c549a')}</DialogTitle>
<DialogTitle>{editingRule ? i18n.t('编辑预警规则') : i18n.t('添加预警规则')}</DialogTitle>
<DialogDescription> {i18n.t('cloud.billingruledial.s75227f20')} </DialogDescription>
</DialogHeader>
<div className="space-y-3">
<div>
<Label className="text-sm text-[var(--dg-text-secondary)]"> {i18n.t('monitor.silenceDialog.ruleNameRequired')} </Label>
<Input className="mt-1" placeholder={i18n.t('cloud.billingruledial.sc147ac4f')} value={form.name} onChange={(e) => setForm({ ...form, name: e.target.value })} />
<Input className="mt-1" placeholder={i18n.t('如:日成本超 500 元预警')} value={form.name} onChange={(e) => setForm({ ...form, name: e.target.value })} />
</div>
<div className="grid grid-cols-2 gap-3">
<div>
@@ -39,7 +39,7 @@ import type { JsonData } from '@/types/common';
import i18n from '@/i18n';
const typeLabels: Record<string, string> = {
public: i18n.t('server.cloudserverimpo.s7ef31abb'),
public: i18n.t('公有云'),
private: i18n.t('cloud.privateCloud'),
hybrid: i18n.t('cloud.hybridCloud'),
};
@@ -138,7 +138,7 @@ export function PlatformManager() {
<div className="relative w-72">
<Search className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 dg-text-muted" />
<Input
placeholder={i18n.t('cloud.platformmanager.s783a513f')}
placeholder={i18n.t('搜索平台名称或编码...')}
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}
className="pl-9 h-9 dg-input"
@@ -150,7 +150,7 @@ export function PlatformManager() {
</SelectTrigger>
<SelectContent>
<SelectItem value="all"> {i18n.t('k8s.topology.allTypes')} </SelectItem>
<SelectItem value="public"> {i18n.t('server.cloudserverimpo.s7ef31abb')} </SelectItem>
<SelectItem value="public"> {i18n.t('公有云')} </SelectItem>
<SelectItem value="private"> {i18n.t('cloud.privateCloud')} </SelectItem>
<SelectItem value="hybrid"> {i18n.t('cloud.hybridCloud')} </SelectItem>
</SelectContent>
@@ -162,7 +162,7 @@ export function PlatformManager() {
<PageShell
variant="list"
title={i18n.t('cloud.title')}
subtitle={i18n.t('cloud.platformmanager.s7012045f')}
subtitle={i18n.t('管理公有云、私有云与混合云平台信息')}
icon={<CloudCog className="h-5 w-5" />}
metrics={
!loading ? (
@@ -170,7 +170,7 @@ export function PlatformManager() {
items={[
{ label: i18n.t('system.auditTotal'), value: stats.total, color: 'blue' },
{ label: i18n.t('system.userActive'), value: stats.active, color: 'green' },
{ label: i18n.t('server.cloudserverimpo.s7ef31abb'), value: stats.public, color: 'cyan' },
{ label: i18n.t('公有云'), value: stats.public, color: 'cyan' },
]}
/>
) : undefined
@@ -194,7 +194,7 @@ export function PlatformManager() {
) : filtered.length === 0 ? (
<PageEmpty
icon={<CloudCog className="h-12 w-12" />}
title={i18n.t('cloud.platformmanager.sb9f478da')}
title={i18n.t('暂无云平台数据')}
action={(
<Button size="sm" className="dg-btn-primary" onClick={openCreate}>
<Plus className="h-4 w-4 mr-1" />
@@ -261,26 +261,26 @@ export function PlatformManager() {
<Dialog open={dialogOpen} onOpenChange={setDialogOpen}>
<DialogContent>
<DialogHeader>
<DialogTitle>{editingItem ? i18n.t('cloud.platformmanager.sf83734ec') : i18n.t('cloud.platformmanager.s3f6f0cf2')}</DialogTitle>
<DialogTitle>{editingItem ? i18n.t('编辑云平台') : i18n.t('添加云平台')}</DialogTitle>
<DialogDescription className="sr-only"> {i18n.t('aiops.llmModelDesc')} </DialogDescription>
</DialogHeader>
<div className="space-y-4 py-2">
<div className="grid grid-cols-2 gap-4">
<div className="space-y-1.5">
<Label> {i18n.t('cloud.platformmanager.seac7fc68')} </Label>
<Label> {i18n.t('如:阿里云')} </Label>
<Input
value={formData.name}
onChange={(e) => setFormData({ ...formData, name: e.target.value })}
placeholder={i18n.t('cloud.platformmanager.sa39d9635')}
placeholder={i18n.t('如:阿里云')}
className="dg-input"
/>
</div>
<div className="space-y-1.5">
<Label> {i18n.t('cloud.platformmanager.se21e278f')} </Label>
<Label> {i18n.t('如:阿里云')} </Label>
<Input
value={formData.code}
onChange={(e) => setFormData({ ...formData, code: e.target.value })}
placeholder={i18n.t('cloud.platformmanager.s7b09b049')}
placeholder={i18n.t('如:阿里云')}
className="dg-input"
disabled={!!editingItem}
/>
@@ -294,7 +294,7 @@ export function PlatformManager() {
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="public"> {i18n.t('server.cloudserverimpo.s7ef31abb')} </SelectItem>
<SelectItem value="public"> {i18n.t('公有云')} </SelectItem>
<SelectItem value="private"> {i18n.t('cloud.privateCloud')} </SelectItem>
<SelectItem value="hybrid"> {i18n.t('cloud.hybridCloud')} </SelectItem>
</SelectContent>
@@ -314,7 +314,7 @@ export function PlatformManager() {
</div>
</div>
<div className="space-y-1.5">
<Label> {i18n.t('cloud.platformmanager.saf587eb5')} </Label>
<Label> {i18n.t('如:阿里云')} </Label>
<Input
value={formData.website}
onChange={(e) => setFormData({ ...formData, website: e.target.value })}
@@ -327,7 +327,7 @@ export function PlatformManager() {
<Input
value={formData.description}
onChange={(e) => setFormData({ ...formData, description: e.target.value })}
placeholder={i18n.t('cloud.platformmanager.sc44dd421')}
placeholder={i18n.t('平台描述...')}
className="dg-input"
/>
</div>