refactor(i18n): U27 多模块 phantom key 批量清理 — Cloud/Deploy/Agent/Monitor/System 5 模块 25 文件, 180 个 phantom key → 51 残留, 129 个替换为语义化键, 新增 12 子命名空间, zh/en 7185→7294 +109 键对齐, tsc -b=0, npm build✓ (16.31s), ESLint=0/0/0, go build=0, 17/17 测试通过

This commit is contained in:
attacker committed 2026-07-12 03:00:20 +08:00
1 parent 7f5295cfc2
commit b812b3b20c
27 files changed
+459 -148

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('请填写必填字段'));
toast.error(i18n.t('cloud.billingRecordDialog.fillFields'));
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('编辑成本记录') : i18n.t('cloud.recordCost')}</DialogTitle>
<DialogTitle>{editingRecord ? i18n.t('cloud.billingRecordDialog.editRecord') : 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('主账号')} value={form.account_name} onChange={(e) => setForm({ ...form, account_name: e.target.value })} />
<Input className="mt-1" placeholder={i18n.t('cloud.billingRecordDialog.mainAccount')} 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('请填写规则名称和阈值'));
toast.error(i18n.t('cloud.billingRuleDialog.fillFields'));
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('编辑预警规则') : i18n.t('添加预警规则')}</DialogTitle>
<DialogTitle>{editingRule ? i18n.t('cloud.billingRuleDialog.editRule') : i18n.t('cloud.billingRuleDialog.addRule')}</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('如:日成本超 500 元预警')} value={form.name} onChange={(e) => setForm({ ...form, name: e.target.value })} />
<Input className="mt-1" placeholder={i18n.t('cloud.billingRuleDialog.namePlaceholder')} 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('公有云'),
public: i18n.t('cloud.platform.publicCloud'),
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('搜索平台名称或编码...')}
placeholder={i18n.t('cloud.platform.searchPlaceholder')}
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('公有云')} </SelectItem>
<SelectItem value="public"> {i18n.t('cloud.platform.publicCloud')} </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('管理公有云、私有云与混合云平台信息')}
subtitle={i18n.t('cloud.platform.subtitle')}
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('公有云'), value: stats.public, color: 'cyan' },
{ label: i18n.t('cloud.platform.publicCloud'), value: stats.public, color: 'cyan' },
]}
/>
) : undefined
@@ -180,11 +180,11 @@ export function PlatformManager() {
<>
<Button variant="outline" size="sm" className="dg-btn-secondary" onClick={loadData}>
<RefreshCw className={`h-4 w-4 mr-1 ${loading ? 'animate-spin' : ''}`} />
刷新
{i18n.t('common.refresh')}
</Button>
<Button size="sm" className="dg-btn-primary" onClick={openCreate}>
<Plus className="h-4 w-4 mr-1" />
添加平台
{i18n.t('cloud.platform.addPlatform')}
</Button>
</>
)}
@@ -194,11 +194,11 @@ export function PlatformManager() {
) : filtered.length === 0 ? (
<PageEmpty
icon={<CloudCog className="h-12 w-12" />}
title={i18n.t('暂无云平台数据')}
title={i18n.t('cloud.platform.noData')}
action={(
<Button size="sm" className="dg-btn-primary" onClick={openCreate}>
<Plus className="h-4 w-4 mr-1" />
添加平台
{i18n.t('cloud.platform.addPlatform')}
</Button>
)}
/>
@@ -244,11 +244,11 @@ export function PlatformManager() {
</Badge>
{p.status === 'active' ? (
<Badge className="dg-status-running gap-1 border-0">
<CheckCircle2 className="h-3 w-3" /> 启用
<CheckCircle2 className="h-3 w-3" /> {i18n.t('cloud.platform.enabled')}
</Badge>
) : (
<Badge className="dg-status-stopped gap-1 border-0">
<XCircle className="h-3 w-3" /> 禁用
<XCircle className="h-3 w-3" /> {i18n.t('cloud.platform.disabled')}
</Badge>
)}
</div>
@@ -261,26 +261,26 @@ export function PlatformManager() {
<Dialog open={dialogOpen} onOpenChange={setDialogOpen}>
<DialogContent>
<DialogHeader>
<DialogTitle>{editingItem ? i18n.t('编辑云平台') : i18n.t('添加云平台')}</DialogTitle>
<DialogTitle>{editingItem ? i18n.t('cloud.platform.editPlatform') : i18n.t('cloud.platform.addPlatform')}</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('如:阿里云')} </Label>
<Label> {i18n.t('common.name')} </Label>
<Input
value={formData.name}
onChange={(e) => setFormData({ ...formData, name: e.target.value })}
placeholder={i18n.t('如:阿里云')}
placeholder={i18n.t('cloud.platform.namePlaceholder')}
className="dg-input"
/>
</div>
<div className="space-y-1.5">
<Label> {i18n.t('如:阿里云')} </Label>
<Label> {i18n.t('common.code')} </Label>
<Input
value={formData.code}
onChange={(e) => setFormData({ ...formData, code: e.target.value })}
placeholder={i18n.t('如:阿里云')}
placeholder={i18n.t('cloud.platform.namePlaceholder')}
className="dg-input"
disabled={!!editingItem}
/>
@@ -294,7 +294,7 @@ export function PlatformManager() {
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="public"> {i18n.t('公有云')} </SelectItem>
<SelectItem value="public"> {i18n.t('cloud.platform.publicCloud')} </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('如:阿里云')} </Label>
<Label> {i18n.t('cloud.platform.namePlaceholder')} </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('平台描述...')}
placeholder={i18n.t('cloud.platform.descPlaceholder')}
className="dg-input"
/>
</div>