feat(i18n): U5 Kubernetes 模块国际化 — 新增 k8s 命名空间(184键) + KubernetesClusterDetail/TopologyView 全量迁移硬编码中文改翻译键

- 新增 k8s 翻译命名空间: cluster/tab/column/empty/label/topology/resource/workload 8 子命名空间
- KubernetesClusterDetail.tsx: 7 Tab(概览/节点/Pod/Deployment/Service/Ingress/事件) 表头+空状态+趋势图标签全量国际化
- TopologyView.tsx: 标题/编辑模式/连线模式/节点编辑弹框/Toast/搜索栏全量国际化
- 新增 common.duration.minAgo 插值键
- 翻译键 1019→1204(+185), 11 命名空间, zh-CN/en-US 完全对齐
- tsc --noEmit=0, npm build✅(17.81s), 17/17 测试通过
This commit is contained in:
attacker committed 2026-07-01 02:28:33 +08:00
1 parent 3b19ae6e98
commit 6db6acc6bd
7 files changed
+611 -129

No files matched your search

+52
View File
@@ -1036,3 +1036,55 @@ cd /srv/aiops/frontend && npm run build
- [x] U8: `go build` 零错误
- [x] U9: `npm run build` 零错误(✓ built in 19.08s)
- [x] 17/17 集成回归测试通过(零回归)
---
## P3-U5: Kubernetes 模块国际化
### 验证用例
```bash
# U1: k8s 命名空间存在且 zh/en 对齐
cd /srv/aiops/frontend && python3 -c "
import json
zh = json.load(open('src/locales/zh-CN.json', encoding='utf-8'))
en = json.load(open('src/locales/en-US.json', encoding='utf-8'))
assert 'k8s' in zh and 'k8s' in en, 'k8s namespace missing'
def count(d):
n = 0
for v in d.values():
n += count(v) if isinstance(v, dict) else 1
return n
assert count(zh['k8s']) == count(en['k8s']), 'zh/en k8s mismatch'
print(f'k8s namespace: {count(zh[\"k8s\"])} keys (zh==en: True)')
"
# 期望: k8s namespace: 184 keys
# U2: TypeScript 编译零错误
npx tsc --noEmit 2>&1 | tail -3
# 期望: 退出码 0
# U3: Vite 构建
npm run build 2>&1 | tail -3
# 期望: built in Ns
# U4: KubernetesClusterDetail 无 JSX 硬编码中文
grep -v '^\s*//' src/components/kubernetes/KubernetesClusterDetail.tsx | grep -cP '[\x{4e00}-\x{9fff}]'
# 期望: 0 (仅注释中有 CJK)
# U5: TopologyView 无 JSX 硬编码中文
grep -v '^\s*//' src/components/kubernetes/TopologyView.tsx | grep -cP '[\x{4e00}-\x{9fff}]'
# 期望: 0 (仅注释中有 CJK)
# U6: 集成回归
python3 ../tests/integration_test.py --host 127.0.0.1 --port 8080
# 期望: 17/17 passed
```
### 通过标准
- [x] U1: `k8s` 命名空间存在,zh/en 完全对齐(184 键)
- [x] U2: `tsc --noEmit` 零错误
- [x] U3: `npm run build` 零错误(✓ built in 17.81s)
- [x] U4: KubernetesClusterDetail 非注释 CJK = 0
- [x] U5: TopologyView 非注释 CJK = 0
- [x] U6: 17/17 集成回归测试通过