i18n: complete internationalization for settings panel

- Add missing translation keys for all hint texts and descriptions
- Remove all hardcoded defaultValue parameters from components
- Add translations for window behavior, directory settings, and theme settings
- Add translations for provider-related UI elements
- Improve consistency across Chinese and English translations

Translation additions:
- common.toggleTheme
- settings.windowBehaviorHint, claudeConfigDirDescription, codexConfigDirDescription
- provider.* (12 new keys)
- providerForm.* (15 new keys)
- providerPreset.* (4 new keys)

Modified files: 10
Lines changed: +132 -74
This commit is contained in:
Jason
2025-10-19 11:01:53 +08:00
parent b036a94281
commit bae6a1cf55
10 changed files with 132 additions and 74 deletions

View File

@@ -75,9 +75,7 @@ export function AboutSection({ isPortable }: AboutSectionProps) {
} catch (error) {
console.error("[AboutSection] Failed to open release notes", error);
toast.error(
t("settings.openReleaseNotesFailed", {
defaultValue: "打开更新日志失败",
}),
t("settings.openReleaseNotesFailed"),
);
}
}, [t, updateInfo?.availableVersion, version]);
@@ -101,9 +99,7 @@ export function AboutSection({ isPortable }: AboutSectionProps) {
} catch (error) {
console.error("[AboutSection] Update failed", error);
toast.error(
t("settings.updateFailed", {
defaultValue: "更新安装失败,已尝试打开下载页面。",
}),
t("settings.updateFailed"),
);
try {
await settingsApi.checkUpdates();
@@ -122,29 +118,25 @@ export function AboutSection({ isPortable }: AboutSectionProps) {
try {
const available = await checkUpdate();
if (!available) {
toast.success(t("settings.upToDate", { defaultValue: "已是最新版本" }));
toast.success(t("settings.upToDate"));
}
} catch (error) {
console.error("[AboutSection] Check update failed", error);
toast.error(
t("settings.checkUpdateFailed", {
defaultValue: "检查更新失败,请稍后重试。",
}),
t("settings.checkUpdateFailed"),
);
}
}, [checkUpdate, hasUpdate, isPortable, resetDismiss, t, updateHandle]);
const displayVersion =
version ?? t("common.unknown", { defaultValue: "未知" });
version ?? t("common.unknown");
return (
<section className="space-y-4">
<header className="space-y-1">
<h3 className="text-sm font-medium">{t("common.about")}</h3>
<p className="text-xs text-muted-foreground">
{t("settings.aboutHint", {
defaultValue: "查看版本信息与更新状态。",
})}
{t("settings.aboutHint")}
</p>
</header>
@@ -163,9 +155,7 @@ export function AboutSection({ isPortable }: AboutSectionProps) {
{isPortable ? (
<p className="inline-flex items-center gap-1 text-xs text-muted-foreground">
<Info className="h-3 w-3" />
{t("settings.portableMode", {
defaultValue: "当前为便携版,更新需手动下载。",
})}
{t("settings.portableMode")}
</p>
) : null}
</div>
@@ -190,20 +180,19 @@ export function AboutSection({ isPortable }: AboutSectionProps) {
{isDownloading ? (
<span className="inline-flex items-center gap-2">
<Loader2 className="h-4 w-4 animate-spin" />
{t("settings.updating", { defaultValue: "安装更新..." })}
{t("settings.updating")}
</span>
) : hasUpdate ? (
<span className="inline-flex items-center gap-2">
<Download className="h-4 w-4" />
{t("settings.updateTo", {
defaultValue: "更新到 {{version}}",
version: updateInfo?.availableVersion ?? "",
})}
</span>
) : isChecking ? (
<span className="inline-flex items-center gap-2">
<RefreshCw className="h-4 w-4 animate-spin" />
{t("settings.checking", { defaultValue: "检查中..." })}
{t("settings.checking")}
</span>
) : (
t("settings.checkForUpdates")
@@ -216,7 +205,6 @@ export function AboutSection({ isPortable }: AboutSectionProps) {
<div className="rounded-md bg-muted/40 px-3 py-2 text-xs text-muted-foreground">
<p>
{t("settings.updateAvailable", {
defaultValue: "检测到新版本:{{version}}",
version: updateInfo.availableVersion,
})}
</p>