refactor(i18n): U29 phantom key 全项目清零 — 28 个 phantom key → 0

AlertRuleDialog.tsx (9处) + DeployTargetFields.tsx (3处) + HealthProbeSection.tsx (2处+1处硬编码) + PodLogsViewer.tsx (2处终端ANSI字符串) + AlertChannelDialog.tsx (2处) + PodMetricsPage.tsx/CapacityPage.tsx (各1处) + PodExecTerminal.tsx (1处终端ANSI) + BuildNodesManager.tsx (1处) + HostDetailDialog.tsx (1处)

修复类型:
- 批量正则损坏的 i18n.t('>中文 <span className=') → 语义化键
- 终端 ANSI 转义字符串 (PodLogsViewer/PodExecTerminal) → 移除 i18n.t() 包裹改纯字符串
- 硬编码中文 (取消/通知渠道提示/日志数据源提示) → i18n.t() 调用

新增 16 个翻译键 (monitor.alertRuleDialog2.* + monitor.alertChannel.name + agent.portCount + monitor.lbl.noProbeHint)
zh/en 7358→7375 +17 键对齐
phantom key 28→0 (全项目零 phantom key)
tsc -b=0, npm build✓ (17.00s), ESLint=0/53/0, go build=0, 17/17 测试通过
This commit is contained in:
attacker committed 2026-07-12 07:34:42 +08:00
1 parent b2715ca3bd
commit 064b6c4ec2
12 files changed
+71 -37

No files matched your search

@@ -131,7 +131,7 @@ export function AlertChannelDialog({
{/* 渠道列表 */}
<div className="space-y-2">
<div className="flex items-center justify-between">
<Label className="text-[var(--dg-text-secondary)] text-sm"> {i18n.t('>渠道名称 <span className=')} </Label>
<Label className="text-[var(--dg-text-secondary)] text-sm"> {i18n.t('monitor.alertChannel.name')} </Label>
<Button
size="sm"
variant="outline"
@@ -210,7 +210,7 @@ export function AlertChannelDialog({
{editingChannel ? i18n.t('monitor.alertChannelDialog2.editChannel') : i18n.t('monitor.alertChannelDialog2.newChannel')}
</Label>
<div className="space-y-1.5">
<Label className="dg-text-secondary text-xs"> {i18n.t('>渠道名称 <span className=')} <span className="dg-text-red">*</span></Label>
<Label className="dg-text-secondary text-xs"> {i18n.t('monitor.alertChannel.name')} <span className="dg-text-red">*</span></Label>
<Input
value={channelForm.name}
onChange={(e) => setChannelForm({ ...channelForm, name: e.target.value })}
@@ -147,7 +147,7 @@ export function AlertRuleDialog({
</div>
<div className="space-y-1.5">
<Label className="text-[var(--dg-text-secondary)]"> {i18n.t('aiops.llmModelDesc')} </Label>
<Label className="text-[var(--dg-text-secondary)]"> {i18n.t('monitor.alertRuleDialog2.ruleDesc')} </Label>
<Textarea
value={ruleForm.description}
onChange={(e) => setRuleForm({ ...ruleForm, description: e.target.value })}
@@ -159,7 +159,7 @@ export function AlertRuleDialog({
<div className="grid grid-cols-2 gap-3">
<div className="space-y-1.5">
<Label className="text-[var(--dg-text-secondary)]"> {i18n.t('>日志数据源 <span className=')} </Label>
<Label className="text-[var(--dg-text-secondary)]"> {i18n.t('monitor.alertRuleDialog2.alertType')} </Label>
<select
value={ruleForm.type}
onChange={(e) => {
@@ -169,9 +169,9 @@ export function AlertRuleDialog({
}}
className="w-full h-9 px-3 rounded-md bg-[var(--dg-bg-tertiary)]/50 border border-[var(--dg-border)] text-[var(--dg-text-primary)] text-sm"
>
<option value="metric"> {i18n.t('>请先前往「日志库」添加 {ruleForm.source === ')} </option>
<option value="metric"> {i18n.t('monitor.alertRuleDialog2.metricAlert')} </option>
<option value="log"> {i18n.t('monitor.alertHelper.srcLog')} </option>
<option value="event"> {i18n.t('>请先前往「日志库」添加 {ruleForm.source === ')} </option>
<option value="event"> {i18n.t('monitor.alertRuleDialog2.eventAlert')} </option>
</select>
</div>
<div className="space-y-1.5">
@@ -199,25 +199,25 @@ export function AlertRuleDialog({
{ruleForm.type === 'log' && (
<div className="space-y-1.5">
<Label className="text-[var(--dg-text-secondary)]"> {i18n.t('>日志数据源 <span className=')} <span className="dg-text-red">*</span></Label>
<Label className="text-[var(--dg-text-secondary)]"> {i18n.t('monitor.alertRuleDialog2.logDatasource')} <span className="dg-text-red">*</span></Label>
<select
value={ruleForm.datasource_id || ''}
onChange={(e) => setRuleForm({ ...ruleForm, datasource_id: Number(e.target.value) || undefined })}
className="w-full h-9 px-3 rounded-md bg-[var(--dg-bg-tertiary)]/50 border border-[var(--dg-border)] text-[var(--dg-text-primary)] text-sm"
>
<option value=""> {i18n.t('PromQL 或指标表达式,例如 cpu_usage > 80')} </option>
<option value=""> {i18n.t('monitor.alertRuleDialog2.selectLogSource')} </option>
{logSources.map((s) => (
<option key={s.id} value={s.id}>{s.name}{s.is_default ? i18n.t('monitor.logPanel.defaultSuffix') : ''}</option>
))}
</select>
{logSources.length === 0 && (
<p className="text-xs dg-text-yellow/80">请先前往「日志库」添加 {ruleForm.source === 'loki' ? 'Loki' : 'Elasticsearch'} 数据源</p>
<p className="text-xs dg-text-yellow/80">{i18n.t('monitor.alertRuleDialog2.addLogSourceFirst', { type: ruleForm.source === 'loki' ? 'Loki' : 'Elasticsearch' })}</p>
)}
</div>
)}
<div className="space-y-1.5">
<Label className="text-[var(--dg-text-secondary)]"> {i18n.t('>规则名称 <span className=')} <span className="dg-text-red">*</span></Label>
<Label className="text-[var(--dg-text-secondary)]"> {i18n.t('monitor.alertRuleDialog2.expression')} <span className="dg-text-red">*</span></Label>
<Input
value={ruleForm.expression}
onChange={(e) => setRuleForm({ ...ruleForm, expression: e.target.value })}
@@ -226,14 +226,14 @@ export function AlertRuleDialog({
/>
<p className="text-xs dg-text-muted">
{ruleForm.type === 'log'
? (ruleForm.source === 'loki' ? i18n.t('LogQL 查询或 count_over_time 表达式') : i18n.t('Elasticsearch Lucene 查询'))
: i18n.t('PromQL 或指标表达式,例如 cpu_usage > 80')}
? (ruleForm.source === 'loki' ? i18n.t('monitor.alertRuleDialog2.logqlHint') : i18n.t('monitor.alertRuleDialog2.esHint'))
: i18n.t('monitor.alertRuleDialog2.promqlHint')}
</p>
</div>
<div className="grid grid-cols-2 gap-3">
<div className="space-y-1.5">
<Label className="text-[var(--dg-text-secondary)]"> {i18n.t('>日志数据源 <span className=')} </Label>
<Label className="text-[var(--dg-text-secondary)]"> {i18n.t('monitor.alertRuleDialog2.severity')} </Label>
<select
value={ruleForm.severity}
onChange={(e) => setRuleForm({ ...ruleForm, severity: e.target.value })}
@@ -245,7 +245,7 @@ export function AlertRuleDialog({
</select>
</div>
<div className="space-y-1.5">
<Label className="text-[var(--dg-text-secondary)]"> {i18n.t('>日志数据源 <span className=')} </Label>
<Label className="text-[var(--dg-text-secondary)]"> {i18n.t('monitor.alertRuleDialog2.duration')} </Label>
<Input
type="number"
value={ruleForm.duration}
@@ -259,7 +259,7 @@ export function AlertRuleDialog({
<Label className="text-[var(--dg-text-secondary)]"> {i18n.t('monitor.notificationChannel')} </Label>
{notifyChannels.length === 0 ? (
<div className="text-xs dg-text-yellow/80 bg-amber-500/5 border border-amber-500/20 rounded-md px-3 py-2">
暂无已配置的通知渠道,请先在「通知渠道配置」中添加
{i18n.t('monitor.alertRuleDialog2.noChannels')}
</div>
) : (
<div className="flex flex-wrap gap-3 pt-1">
@@ -295,7 +295,7 @@ export function AlertRuleDialog({
className="border-[var(--dg-border)] text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-hover)]"
onClick={() => onOpenChange(false)}
>
取消
{i18n.t('common.cancel')}
</Button>
<Button
className="bg-blue-600 hover:bg-blue-700 text-white"