From a4185544414c4b3ab85391e559f44bd464c97ad2 Mon Sep 17 00:00:00 2001 From: wenjie Date: Mon, 9 Mar 2026 19:12:41 +0800 Subject: [PATCH] refactor(frontend): remove i18n fallback strings and drop providers route - Replace `t(key, defaultValue)` calls with key-only translations across UI pages - Clean up locale files by pruning unused keys and adding missing shared keys - Remove the obsolete `/providers` page and update generated route tree --- web/frontend/src/components/app-header.tsx | 24 ++-- .../channels/channel-config-page.tsx | 2 +- .../src/components/chat/chat-page.tsx | 2 +- .../src/components/chat/model-selector.tsx | 6 +- .../components/chat/session-history-menu.tsx | 4 +- .../src/components/config/config-page.tsx | 69 +++------- .../src/components/config/config-sections.tsx | 127 +++++------------- .../src/components/config/raw-json-panel.tsx | 58 +++----- .../credentials/anthropic-credential-card.tsx | 16 +-- .../antigravity-credential-card.tsx | 13 +- .../credentials/credentials-page.tsx | 13 +- .../credentials/device-code-sheet.tsx | 19 +-- .../credentials/logout-confirm-dialog.tsx | 6 +- .../credentials/openai-credential-card.tsx | 20 +-- .../credentials/provider-status-line.tsx | 8 +- .../src/components/models/models-page.tsx | 2 +- .../src/hooks/use-credentials-page.ts | 48 ++----- web/frontend/src/i18n/locales/en.json | 72 +--------- web/frontend/src/i18n/locales/zh.json | 72 +--------- web/frontend/src/routeTree.gen.ts | 21 --- web/frontend/src/routes/config.raw.tsx | 6 +- web/frontend/src/routes/logs.tsx | 6 +- web/frontend/src/routes/providers.tsx | 30 ----- 23 files changed, 149 insertions(+), 495 deletions(-) delete mode 100644 web/frontend/src/routes/providers.tsx diff --git a/web/frontend/src/components/app-header.tsx b/web/frontend/src/components/app-header.tsx index 1c2ca672e..7a50fe0fb 100644 --- a/web/frontend/src/components/app-header.tsx +++ b/web/frontend/src/components/app-header.tsx @@ -87,10 +87,7 @@ export function AppHeader() { - {t( - "chat.notConnected", - "Gateway is not running. Start it to chat.", - )} + {t("chat.notConnected")} )} @@ -99,24 +96,19 @@ export function AppHeader() { - {t("header.gateway.stopDialog.title", "Stop Gateway Service?")} + {t("header.gateway.stopDialog.title")} - {t( - "header.gateway.stopDialog.description", - "Are you sure you want to stop the gateway? This will disconnect your active chat sessions and halt inference.", - )} + {t("header.gateway.stopDialog.description")} - - {t("common.cancel", "Cancel")} - + {t("common.cancel")} - {t("header.gateway.stopDialog.confirm", "Stop Gateway")} + {t("header.gateway.stopDialog.confirm")} @@ -146,10 +138,10 @@ export function AppHeader() { )} {isRunning - ? t("header.gateway.action.stop", "Stop Gateway") + ? t("header.gateway.action.stop") : isStarting - ? t("header.gateway.status.starting", "Starting Gateway...") - : t("header.gateway.action.start", "Start Gateway")} + ? t("header.gateway.status.starting") + : t("header.gateway.action.start")} diff --git a/web/frontend/src/components/channels/channel-config-page.tsx b/web/frontend/src/components/channels/channel-config-page.tsx index faa0f4043..b19d11e6a 100644 --- a/web/frontend/src/components/channels/channel-config-page.tsx +++ b/web/frontend/src/components/channels/channel-config-page.tsx @@ -494,7 +494,7 @@ export function ChannelConfigPage({ channelName }: ChannelConfigPageProps) {

- {t("channels.edit.title", { + {t("channels.edit", { name: channelDisplayName, })}

diff --git a/web/frontend/src/components/chat/chat-page.tsx b/web/frontend/src/components/chat/chat-page.tsx index 418beadb9..0fd23a6a5 100644 --- a/web/frontend/src/components/chat/chat-page.tsx +++ b/web/frontend/src/components/chat/chat-page.tsx @@ -69,7 +69,7 @@ export function ChatPage() { return (
{apiKeyModels.length > 0 && ( - {t("chat.modelGroup.apikey", "API Key")} + {t("chat.modelGroup.apikey")} {apiKeyModels.map((model) => ( {model.model_name} @@ -55,7 +55,7 @@ export function ModelSelector({ {oauthModels.length > 0 && ( - {t("chat.modelGroup.oauth", "OAuth")} + {t("chat.modelGroup.oauth")} {oauthModels.map((model) => ( {model.model_name} @@ -70,7 +70,7 @@ export function ModelSelector({ {localModels.length > 0 && ( - {t("chat.modelGroup.local", "Local")} + {t("chat.modelGroup.local")} {localModels.map((model) => ( {model.model_name} diff --git a/web/frontend/src/components/chat/session-history-menu.tsx b/web/frontend/src/components/chat/session-history-menu.tsx index 36bb0eedd..f2e93295c 100644 --- a/web/frontend/src/components/chat/session-history-menu.tsx +++ b/web/frontend/src/components/chat/session-history-menu.tsx @@ -71,7 +71,7 @@ export function SessionHistoryMenu({ } @@ -295,23 +266,17 @@ export function ConfigPage() {
{isLoading ? (
- {t("labels.loading", "Loading...")} + {t("labels.loading")}
) : error ? (
- {t( - "pages.config.load_error", - "Failed to load configuration. Please refresh and try again.", - )} + {t("pages.config.load_error")}
) : (
{isDirty && (
- {t( - "pages.config.unsaved_changes", - "You have unsaved changes.", - )} + {t("pages.config.unsaved_changes")}
)} @@ -356,13 +321,11 @@ export function ConfigPage() { onClick={handleReset} disabled={!isDirty || saving} > - {t("common.reset", "Reset")} + {t("common.reset")}
diff --git a/web/frontend/src/components/config/config-sections.tsx b/web/frontend/src/components/config/config-sections.tsx index b2c22e50c..340ece333 100644 --- a/web/frontend/src/components/config/config-sections.tsx +++ b/web/frontend/src/components/config/config-sections.tsx @@ -44,11 +44,8 @@ export function AgentDefaultsSection({
onFieldChange("restrictToWorkspace", checked) @@ -70,11 +64,8 @@ export function AgentDefaultsSection({ />
onFieldChange("publicAccess", checked)} />