fix(i18n): 回退到稳定的 32% 覆盖率状态 (tsc + Vite 构建通过)

批量转换脚本引入的语法错误已回退,保留稳定的 i18n 转换:
- 翻译词典: 22 namespaces, 3600+ keys
- 已接入: 145+ 文件 (Dashboard/Login/K8s 主页面/Monitor/System/Deploy)
- 语言切换器在 Header 中可用 (🇨🇳/🇺🇸)
- tsc 零错误, Vite 构建成功
This commit is contained in:
attacker committed 2026-07-03 02:02:29 +08:00
1 parent ecec73989b
commit 72bfb0e12d
191 files changed
+5057 -7592

No files matched your search

@@ -23,7 +23,6 @@ import { toast } from 'sonner';
import { billingApi } from '@/api';
import { providerLabels } from './CloudBillingHelpers';
import type { JsonData } from '@/types/common';
import { useTranslation } from 'react-i18next';
const emptyRecord = {
provider: 'aliyun',
@@ -43,7 +42,6 @@ interface Props {
}
export function BillingRecordDialog({ open, onOpenChange, editingRecord, onSuccess }: Props) {
const { t } = useTranslation();
const [form, setForm] = useState<JsonData>(emptyRecord);
const [submitting, setSubmitting] = useState(false);
@@ -67,7 +65,7 @@ export function BillingRecordDialog({ open, onOpenChange, editingRecord, onSucce
const handleSave = async () => {
if (!form.provider || !form.billing_date || !form.cost) {
toast.error(t('cloud.billingrecorddialog.sd8a97c'));
toast.error('请填写必填字段');
return;
}
setSubmitting(true);
@@ -81,9 +79,9 @@ export function BillingRecordDialog({ open, onOpenChange, editingRecord, onSucce
}
onOpenChange(false);
onSuccess();
toast(t('common.savedSuccessfully'));
toast('保存成功');
} catch (e) {
toast.error(t('common.saveFailed'), { description: (e as JsonData).message });
toast.error('保存失败', { description: (e as JsonData).message });
} finally {
setSubmitting(false);
}
@@ -93,13 +91,13 @@ export function BillingRecordDialog({ open, onOpenChange, editingRecord, onSucce
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className="max-w-md">
<DialogHeader>
<DialogTitle>{editingRecord ? t('cloud.billingrecorddialog.s3c91e4') : t('cloud.recordCost')}</DialogTitle>
<DialogDescription>{t('cloud.billingrecorddialog.s09e541')}</DialogDescription>
<DialogTitle>{editingRecord ? '编辑成本记录' : '记录成本'}</DialogTitle>
<DialogDescription>记录一条每日云资源成本</DialogDescription>
</DialogHeader>
<div className="space-y-3">
<div className="grid grid-cols-2 gap-3">
<div>
<Label className="text-sm text-[var(--dg-text-secondary)]">{t('cloud.billingrecorddialog.sb11d84')}</Label>
<Label className="text-sm text-[var(--dg-text-secondary)]">厂商 *</Label>
<Select value={form.provider} onValueChange={(v) => setForm({ ...form, provider: v })}>
<SelectTrigger className="mt-1"><SelectValue /></SelectTrigger>
<SelectContent>
@@ -110,37 +108,37 @@ export function BillingRecordDialog({ open, onOpenChange, editingRecord, onSucce
</Select>
</div>
<div>
<Label className="text-sm text-[var(--dg-text-secondary)]">{t('cloud.billingrecorddialog.s3abdef')}</Label>
<Label className="text-sm text-[var(--dg-text-secondary)]">日期 *</Label>
<Input type="date" className="mt-1" value={form.billing_date} onChange={(e) => setForm({ ...form, billing_date: e.target.value })} />
</div>
</div>
<div className="grid grid-cols-2 gap-3">
<div>
<Label className="text-sm text-[var(--dg-text-secondary)]">{t('cloud.billingrecorddialog.s6f2526')}</Label>
<Label className="text-sm text-[var(--dg-text-secondary)]">费用(元) *</Label>
<Input type="number" step="0.01" className="mt-1" placeholder="0.00" value={form.cost} onChange={(e) => setForm({ ...form, cost: e.target.value })} />
</div>
<div>
<Label className="text-sm text-[var(--dg-text-secondary)]">{t('cloud.colService')}</Label>
<Label className="text-sm text-[var(--dg-text-secondary)]">服务</Label>
<Input className="mt-1" placeholder="ECS, RDS..." value={form.service} onChange={(e) => setForm({ ...form, service: e.target.value })} />
</div>
</div>
<div className="grid grid-cols-2 gap-3">
<div>
<Label className="text-sm text-[var(--dg-text-secondary)]">{t('cloud.colRegion')}</Label>
<Label className="text-sm text-[var(--dg-text-secondary)]">区域</Label>
<Input className="mt-1" placeholder="cn-hangzhou" value={form.region} onChange={(e) => setForm({ ...form, region: e.target.value })} />
</div>
<div>
<Label className="text-sm text-[var(--dg-text-secondary)]">{t('cloud.accountName')}</Label>
<Input className="mt-1" placeholder=t('cloud.billingrecorddialog.s001079') value={form.account_name} onChange={(e) => setForm({ ...form, account_name: e.target.value })} />
<Label className="text-sm text-[var(--dg-text-secondary)]">账号名称</Label>
<Input className="mt-1" placeholder="主账号" value={form.account_name} onChange={(e) => setForm({ ...form, account_name: e.target.value })} />
</div>
</div>
<div>
<Label className="text-sm text-[var(--dg-text-secondary)]">{t('common.remark')}</Label>
<Input className="mt-1" placeholder=t('common.optional') value={form.description} onChange={(e) => setForm({ ...form, description: e.target.value })} />
<Label className="text-sm text-[var(--dg-text-secondary)]">备注</Label>
<Input className="mt-1" placeholder="可选" value={form.description} onChange={(e) => setForm({ ...form, description: e.target.value })} />
</div>
</div>
<DialogFooter>
<Button variant="outline" onClick={() => onOpenChange(false)}>{t('common.cancel')}</Button>
<Button variant="outline" onClick={() => onOpenChange(false)}>取消</Button>
<Button onClick={handleSave} disabled={submitting}>
{submitting && <Loader2 className="h-4 w-4 mr-1 animate-spin" />}
保存