refactor(i18n): U37 全量 JSX 文本节点硬编码中文清零 — 65 文件 151 处→0, 新增 common.* 98 翻译键, zh/en 对齐, tsc -b=0, npm build✓ (17.96s), ESLint=0/43/any=0, go build=0, 17/17 测试通过

This commit is contained in:
attacker committed 2026-07-13 06:39:08 +08:00
1 parent e274ba7b9b
commit 7c80e35411
68 files changed
+11819 -11622

No files matched your search

@@ -188,10 +188,10 @@ export default function BuildNodesManager({ embedded = false }: { embedded?: boo
<span className="text-sm font-medium text-[var(--dg-text-primary)]"> {i18n.t('pipeline.buildNodes')} </span>
<div className="flex gap-2">
<Button variant="ghost" size="sm" onClick={load} disabled={loading}>
<RefreshCw className={`h-3.5 w-3.5 mr-1${loading ? ' animate-spin' : ''}`} />刷新
<RefreshCw className={`h-3.5 w-3.5 mr-1${loading ? ' animate-spin' : ''}`} />{i18n.t("common.refresh")}
</Button>
<Button size="sm" onClick={openCreate}>
<Plus className="h-3.5 w-3.5 mr-1" />添加
<Plus className="h-3.5 w-3.5 mr-1" />{i18n.t("common.add")}
</Button>
</div>
</div>
@@ -269,7 +269,7 @@ export default function DeployCredentials() {
<>
<div className="flex items-center justify-end mb-3">
<Button size="sm" className="dg-btn-primary" onClick={() => { setEditEnv(null); setEnvDialogOpen(true); }}>
<Plus className="w-4 h-4 mr-1" />新增环境
<Plus className="w-4 h-4 mr-1" />{t("common.newEnv")}
</Button>
</div>
{environments.length === 0 ? (
@@ -279,7 +279,7 @@ export default function DeployCredentials() {
description={t('deploy.clickEnvConfigHint')}
action={(
<Button size="sm" onClick={() => { setEditEnv(null); setEnvDialogOpen(true); }}>
<Plus className="w-4 h-4 mr-1" />新增环境
<Plus className="w-4 h-4 mr-1" />{t("common.newEnv")}
</Button>
)}
/>
@@ -289,13 +289,13 @@ export default function DeployCredentials() {
<table className="w-full text-sm">
<thead className="bg-[var(--dg-bg-tertiary)] border-b border-[var(--dg-border)]">
<tr>
<th className="px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]">环境标识</th>
<th className="px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]">显示名称</th>
<th className="px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]">类型</th>
<th className="px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]">颜色</th>
<th className="px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]">排序</th>
<th className="px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]">状态</th>
<th className="px-3 py-2 text-right font-medium text-[var(--dg-text-secondary)]">操作</th>
<th className="px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]">{t("common.envLabel")}</th>
<th className="px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]">{t("common.displayName")}</th>
<th className="px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]">{t("common.type")}</th>
<th className="px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]">{t("common.color")}</th>
<th className="px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]">{t("common.sort")}</th>
<th className="px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]">{t("common.status")}</th>
<th className="px-3 py-2 text-right font-medium text-[var(--dg-text-secondary)]">{t("common.actions")}</th>
</tr>
</thead>
<tbody>
@@ -208,7 +208,7 @@ export default function DeployRBAC() {
onTabChange={setActiveTab}
actions={activeTab === 'groups' ? undefined : (
<Button className="dg-btn-primary" onClick={() => setCreateOpen(true)}>
<Plus className="w-4 h-4 mr-1" />新建权限
<Plus className="w-4 h-4 mr-1" />{i18n.t("common.newPermission")}
</Button>
)}
contentClassName="space-y-4"
@@ -88,10 +88,10 @@ export default function UserGroupsManager({ embedded = false }: { embedded?: boo
const toolbar = embedded ? (
<div className="flex items-center justify-end gap-2 mb-3">
<Button variant="outline" size="sm" className="dg-btn-secondary" onClick={loadGroups}>
<RefreshCw className="w-4 h-4 mr-1" />刷新
<RefreshCw className="w-4 h-4 mr-1" />{i18n.t("common.refresh")}
</Button>
<Button size="sm" className="dg-btn-primary" onClick={() => { setEditId(null); setFormName(''); setFormDesc(''); setFormOpen(true); }}>
<Plus className="w-4 h-4 mr-1" />新建用户组
<Plus className="w-4 h-4 mr-1" />{i18n.t("common.newUserGroup")}
</Button>
</div>
) : null;
@@ -103,7 +103,7 @@ export default function UserGroupsManager({ embedded = false }: { embedded?: boo
description={i18n.t('deploy.userGroup.createFirstHint')}
action={(
<Button size="sm" onClick={() => { setEditId(null); setFormName(''); setFormDesc(''); setFormOpen(true); }}>
<Plus className="w-4 h-4 mr-1" />新建用户组
<Plus className="w-4 h-4 mr-1" />{i18n.t("common.newUserGroup")}
</Button>
)}
/>
@@ -204,10 +204,10 @@ export default function UserGroupsManager({ embedded = false }: { embedded?: boo
actions={(
<>
<Button variant="outline" size="sm" className="dg-btn-secondary" onClick={loadGroups}>
<RefreshCw className="w-4 h-4 mr-1" />刷新
<RefreshCw className="w-4 h-4 mr-1" />{i18n.t("common.refresh")}
</Button>
<Button size="sm" className="dg-btn-primary" onClick={() => { setEditId(null); setFormName(''); setFormDesc(''); setFormOpen(true); }}>
<Plus className="w-4 h-4 mr-1" />新建用户组
<Plus className="w-4 h-4 mr-1" />{i18n.t("common.newUserGroup")}
</Button>
</>
)}
@@ -157,7 +157,7 @@ export function WorkspaceTermDialog({
style={fullscreen ? { maxWidth: '100vw', width: '100vw', height: '100vh' } : { maxWidth: '900px', width: '90vw' }}
>
<DialogTitle className="sr-only">Workspace 终端 #{buildNumber}</DialogTitle>
<DialogDescription className="sr-only">流水线构建目录终端</DialogDescription>
<DialogDescription className="sr-only">{t("common.buildTerminal")}</DialogDescription>
<div className="flex items-center justify-between px-4 py-2 border-b border-[var(--dg-border)]">
<div className="flex items-center gap-2 text-sm min-w-0">
<div className={cn('w-2 h-2 rounded-full shrink-0', connected ? 'bg-emerald-400' : 'bg-red-400')} />
@@ -297,7 +297,7 @@ export function CredFormDialog({ open, onClose, onSaved, editData }: CredFormDia
className="bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]" />
</div>
<div className="space-y-1">
<Label className="text-[var(--dg-text-secondary)] text-xs">安全模式</Label>
<Label className="text-[var(--dg-text-secondary)] text-xs">{t("common.securityMode")}</Label>
<Select value={rdpSecurity} onValueChange={setRdpSecurity}>
<SelectTrigger className="bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]">
<SelectValue />
@@ -305,7 +305,7 @@ export function CredFormDialog({ open, onClose, onSaved, editData }: CredFormDia
<SelectContent>
<SelectItem value="nla">NLA</SelectItem>
<SelectItem value="tls">TLS</SelectItem>
<SelectItem value="rdp">标准 RDP</SelectItem>
<SelectItem value="rdp">{t("common.standardRdp")}</SelectItem>
</SelectContent>
</Select>
</div>
@@ -313,7 +313,7 @@ export function CredFormDialog({ open, onClose, onSaved, editData }: CredFormDia
<div><FieldWithToggle label={t('deploy.rdpPassword')} value={rdpPassword} onChange={setRdpPassword}
placeholder={t('deploy.rdpPasswordPlaceholder')} fieldKey="rdp_pwd" required /></div>
<div className="space-y-1">
<Label className="text-[var(--dg-text-secondary)] text-xs">域</Label>
<Label className="text-[var(--dg-text-secondary)] text-xs">{t("common.domainLabel")}</Label>
<Input value={rdpDomain} onChange={e => setRdpDomain(e.target.value)} placeholder={t('common.optional')}
className="bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]" />
</div>
@@ -207,7 +207,7 @@ export function DeployTargetFields({ value, onChange, requireTarget = true }: De
<ScrollArea className="h-[140px] rounded-lg border border-[var(--dg-border)] bg-[var(--dg-bg-secondary)]">
{loadingServers ? (
<div className="flex items-center justify-center py-8 text-xs text-[var(--dg-text-muted)]">
<Loader2 className="h-4 w-4 animate-spin mr-1.5" />加载中
<Loader2 className="h-4 w-4 animate-spin mr-1.5" />{i18n.t("common.loadingEllipsis")}
</div>
) : filteredServers.length === 0 ? (
<p className="text-xs text-[var(--dg-text-muted)] text-center py-8"> {i18n.t('pipeline.deployTargetField.noHostAvailable')} </p>
@@ -315,7 +315,7 @@ export function DeployTargetFields({ value, onChange, requireTarget = true }: De
<ScrollArea className="h-[140px] rounded-lg border border-[var(--dg-border)] bg-[var(--dg-bg-secondary)]">
{loadingDeps ? (
<div className="flex items-center justify-center py-8 text-xs text-[var(--dg-text-muted)]">
<Loader2 className="h-4 w-4 animate-spin mr-1.5" />加载 Deployment
<Loader2 className="h-4 w-4 animate-spin mr-1.5" />{i18n.t("common.loadDeployment")}
</div>
) : filteredDeployments.length === 0 ? (
<p className="text-xs text-[var(--dg-text-muted)] text-center py-8"> {i18n.t('k8s.workloads.noDeployment')} </p>
@@ -399,7 +399,7 @@ export function PipelineCreateDialog({ open, onOpenChange, onCreated }: Pipeline
<SelectValue placeholder={t('deploy.dockerCredPlaceholder')} />
</SelectTrigger>
<SelectContent>
<SelectItem value="__none">不关联</SelectItem>
<SelectItem value="__none">{t("common.notLinked")}</SelectItem>
{dockerCredentials.map((c) => (
<SelectItem key={c.id as number} value={String(c.id)}>
<span className="flex items-center gap-1">