From c22dc253168e36d9921ba05b697a00edd3f7677d Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Sat, 7 Nov 2026 16:42:38 -0800 Subject: [PATCH] refactor(ui): clear hardcoded English from dashboard JSX (#50575) * refactor(ui): clear hardcoded English from dashboard JSX Move the 283 strings the planned no-literal-string guard flags so main starts at zero: - missed UI text (Switchyard router form, Create User custom ID field, advanced settings placeholders) and our own fallbacks ("unknown", seconds suffixes) onto t() with new en.json keys - product names into src/i18n/untranslated/productNames.ts and code samples, sample values and JSON placeholders into src/i18n/untranslated/codeSamples.ts - values that never display (filter ids, enum fallbacks, query keys, CSS, ids) onto literal-union types or module constants The rendered English is byte-identical. * refactor(ui): put Bedrock policy chips and test panel error on t() The six Bedrock policy chips and the compliance test panel's error word are our own display labels, not server values, so they go through t() instead of module constants. Rendered English is unchanged. --- .../_components/AgentIdentityFields.tsx | 3 +- .../_components/KillSwitchFormFields.tsx | 5 +- .../_components/APIReferenceView.tsx | 7 +- .../caching/_components/cache_health.tsx | 4 +- .../_components/EvaluationSettingsModal.tsx | 3 +- .../_components/GuardrailReadOnlyDetails.tsx | 4 +- .../_components/GuardrailTestPanel.tsx | 3 +- .../_components/TeamGuardrailsTab.tsx | 5 +- .../_components/add_guardrail_form.tsx | 3 +- .../ContentCategoryConfiguration.tsx | 13 +- .../content_filter/KeywordTable.tsx | 2 +- .../custom_code/CustomCodeModal.tsx | 5 +- .../_components/guardrail_garden_card.tsx | 3 +- .../_components/guardrail_garden_detail.tsx | 6 +- .../ToolPermissionRulesEditor.tsx | 7 +- .../app/(dashboard)/hooks/models/useModels.ts | 2 +- .../_components/IdJagFormFields.tsx | 9 +- .../_components/MCPSubmissionsTab.tsx | 4 +- .../_components/OAuthFormFields.tsx | 3 +- .../_components/TokenExchangeFormFields.tsx | 5 +- .../_components/UpstreamTokenHeaderField.tsx | 3 +- .../mcp-servers/_components/mcp_connect.tsx | 14 +- .../mcp-servers/_components/mcp_discovery.tsx | 12 +- .../_components/mcp_server_edit.tsx | 3 +- .../mcp-servers/_components/mcp_servers.tsx | 6 +- .../memory/_components/MemoryEditModal.tsx | 9 +- .../_components/ModelInsightsView.tsx | 3 +- .../components/chat_ui/A2AMetrics.tsx | 3 +- .../components/chat_ui/SessionManagement.tsx | 11 +- .../components/systemOneUI/SystemOneUI.tsx | 3 +- .../components/systemOneUI/lib/formPayload.ts | 2 +- .../_components/pipeline_flow_builder.tsx | 10 +- .../_components/PromptTableColumns.tsx | 8 +- .../_components/prompt_editor_view/index.tsx | 4 +- .../_components/RequestTagMappings.tsx | 10 +- .../skills/_components/add_plugin_form.tsx | 5 +- .../EntityUsage/SpendByProvider.tsx | 4 +- .../_components/components/UsagePageView.tsx | 4 +- .../DefaultUserSettingsForm.tsx | 8 +- .../_components/view_users/UsersTable.tsx | 3 +- .../_components/VectorStoreForm.tsx | 3 +- .../_components/vector_store_info.tsx | 7 +- .../(dashboard)/workflows/WorkflowRuns.tsx | 3 +- .../src/app/login/LoginPage.tsx | 5 +- .../src/app/mcp/oauth/callback/page.tsx | 3 +- .../src/app/onboarding/OnboardingFormBody.tsx | 3 +- .../src/components/AIHub/ModelHubTable.tsx | 2 - .../src/components/CreateUserButton.tsx | 11 +- .../src/components/ModelInfoEditForm.tsx | 5 +- .../src/components/Navbar/ViewSwitcher.tsx | 3 +- .../AdminSettings/CyberArk/CyberArk.tsx | 3 +- .../HashicorpVault/HashicorpVault.tsx | 3 +- .../MCPToolSearchSettings.tsx | 3 +- .../PluginSettings/PluginSettings.tsx | 3 +- .../UISettings/PageVisibilitySettings.tsx | 4 +- .../AdminSettings/UISettings/UISettings.tsx | 3 +- .../SidebarAccountMenu/SidebarAccountMenu.tsx | 3 +- ui/litellm-dashboard/src/components/Teams.tsx | 3 +- .../src/components/TeamsPage/TeamsTable.tsx | 3 +- .../components/ThemeToggle/ThemeToggle.tsx | 4 +- .../src/components/UIAccessControlForm.tsx | 5 +- .../UsagePage/components/KeyActivityPanel.tsx | 2 +- .../VirtualKeysPage/VirtualKeysTable.tsx | 3 +- .../src/components/activity_metrics.tsx | 4 +- .../add_model/AutoRouterClassifierTabs.tsx | 25 ++-- .../add_model/AutoRouterSimpleSetup.tsx | 4 +- .../add_model/CustomDimensionRows.tsx | 4 +- .../add_model/ForecastClassifierConfig.tsx | 4 +- .../add_model/OpeningPromptEditor.tsx | 3 +- .../components/add_model/ReminderMarkers.tsx | 5 +- .../add_model/SwitchyardConfigFields.tsx | 132 +++++++++++------- .../add_model/SwitchyardRouterForm.tsx | 13 +- .../add_model/advanced_settings.tsx | 15 +- .../add_model/auto_router_connection_test.tsx | 2 +- .../src/components/add_pass_through.tsx | 3 +- .../components/bulk_create_users_button.tsx | 5 +- .../src/components/chat/ChatMessages.tsx | 52 +++---- .../src/components/chat/ChatModelPicker.tsx | 2 +- .../src/components/chat/ChatShell.tsx | 4 +- .../components/chat_ui/MCPEventsDisplay.tsx | 4 +- .../src/components/cloudzero_export_modal.tsx | 3 +- .../common_components/LoadingScreen.tsx | 3 +- .../common_components/MemberTable.tsx | 3 +- .../common_components/ModelAliasManager.tsx | 3 +- .../PassThroughGuardrailsSection.tsx | 23 +-- .../PremiumLoggingSettings.tsx | 5 +- .../edit_auto_router_modal.tsx | 3 +- .../src/components/email_settings.tsx | 4 +- .../components/logs/audit/AuditLogsTable.tsx | 6 +- .../logs/detail/LogDetailContent.tsx | 6 +- .../logs/detail/LogDetailsDrawer.tsx | 10 +- .../logs/detail/RealtimePrettyView.tsx | 2 +- .../BedrockGuardrailDetails.tsx | 19 +-- .../GuardrailViewer/ContentFilterDetails.tsx | 12 +- .../HealthChecksTableColumns.tsx | 3 +- .../components/model_group_alias_settings.tsx | 3 +- .../src/components/model_info_view.tsx | 3 +- .../src/components/moyai/MoyaiLanding.tsx | 5 +- .../organisms/create_key_button.tsx | 38 ++--- .../src/components/pass_through_info.tsx | 3 +- .../publicModelHub/ModelInspector.tsx | 5 +- .../routing_groups/RoutingGroupModal.tsx | 9 +- .../src/components/settings.tsx | 9 +- .../components/shared/CreatedKeyDisplay.tsx | 15 +- .../DataTable/DataTableFilterDrawer.tsx | 6 +- .../src/components/shared/SidebarBrand.tsx | 3 +- .../shared/charts/StackedUsageChart.tsx | 5 +- .../components/shared/search/SearchBox.tsx | 4 +- .../src/components/team/EditMembership.tsx | 3 +- .../src/components/team/LoggingSettings.tsx | 5 +- .../src/components/team/MyUserTab.tsx | 6 +- .../src/components/team/TeamInfo.tsx | 7 +- .../components/templates/key_edit_view.tsx | 7 +- .../src/components/ui/chart.tsx | 6 +- ui/litellm-dashboard/src/i18n/locales/en.json | 91 ++++++++++++ .../src/i18n/untranslated/codeSamples.ts | 95 +++++++++++++ .../src/i18n/untranslated/productNames.ts | 28 ++++ 117 files changed, 746 insertions(+), 304 deletions(-) create mode 100644 ui/litellm-dashboard/src/i18n/untranslated/codeSamples.ts create mode 100644 ui/litellm-dashboard/src/i18n/untranslated/productNames.ts diff --git a/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/AgentIdentityFields.tsx b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/AgentIdentityFields.tsx index d4af3ff3833..00c8fce98d1 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/AgentIdentityFields.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/AgentIdentityFields.tsx @@ -8,6 +8,7 @@ import { Input } from "@/components/ui/input"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; import { AgentFormField, type AgentFormValues } from "./AgentFormKit"; import { entraTenantFromIssuer, IDENTITY_UUID_PATTERN } from "./agent_identity"; +import { codeSamples } from "@/i18n/untranslated/codeSamples"; const PROVIDER_OPTIONS: { value: string; labelKey: ParseKeys }[] = [ { value: "none", labelKey: "agents.identityFields.providers.none" }, @@ -206,7 +207,7 @@ export const AgentIdentityFields = ({ accessToken }: { accessToken: string | nul ref={ref} value={typeof value === "string" ? value : ""} onChange={onChange} - placeholder="Agent.Invoke" + placeholder={codeSamples.agents.identityScope} /> )} diff --git a/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/KillSwitchFormFields.tsx b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/KillSwitchFormFields.tsx index 2b9a0edb70d..6abeb5d18ea 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/KillSwitchFormFields.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/KillSwitchFormFields.tsx @@ -11,6 +11,7 @@ import { PasswordInput } from "@/components/shared/PasswordInput"; import i18n from "@/i18n/i18n"; import { AgentFormField, AgentFormValues, labelWithHint } from "./AgentFormKit"; import { KILL_SWITCH_AUTH_TYPES, KILL_SWITCH_METHODS, validateKillSwitchBody } from "./kill_switch_config"; +import { codeSamples } from "@/i18n/untranslated/codeSamples"; const KeyValueFieldArray = ({ name, @@ -135,7 +136,7 @@ const KillSwitchAuthFields = () => { ( {...control} ref={ref} rows={4} - placeholder='{"reason": "manual kill switch"}' + placeholder={codeSamples.agents.killSwitchPayloadJson} value={typeof value === "string" ? value : ""} onChange={onChange} /> diff --git a/ui/litellm-dashboard/src/app/(dashboard)/api-reference/_components/APIReferenceView.tsx b/ui/litellm-dashboard/src/app/(dashboard)/api-reference/_components/APIReferenceView.tsx index 7f6f7ea1d17..f55dc2e4c82 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/api-reference/_components/APIReferenceView.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/api-reference/_components/APIReferenceView.tsx @@ -4,6 +4,7 @@ import { useTranslation } from "react-i18next"; import CodeBlock from "@/components/CodeBlock"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import DocLink from "./DocLink"; +import { productNames } from "@/i18n/untranslated/productNames"; interface ApiRefProps { proxySettings: { @@ -36,13 +37,13 @@ const APIReferenceView: React.FC = ({ proxySettings }) => { - OpenAI Python SDK + {productNames.openAIPythonSdk} - LlamaIndex + {productNames.llamaIndex} - Langchain Py + {productNames.langchainPython} diff --git a/ui/litellm-dashboard/src/app/(dashboard)/caching/_components/cache_health.tsx b/ui/litellm-dashboard/src/app/(dashboard)/caching/_components/cache_health.tsx index 382438d9efe..db532fafefe 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/caching/_components/cache_health.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/caching/_components/cache_health.tsx @@ -5,6 +5,8 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { CheckCircle2, XCircle, ClipboardCopy } from "lucide-react"; import { ResponseTimeIndicator } from "./response_time_indicator"; +const UNHEALTHY_STATUS = "unhealthy"; + // Helper function to deep-parse a JSON string if possible const deepParse = (input: any) => { let parsed = input; @@ -179,7 +181,7 @@ const HealthCheckDetails: React.FC<{ response: any }> = ({ response }) => { className={`text-sm font-medium ${response?.status === "healthy" ? "text-success" : "text-destructive"}`} > {t("caching.health.cacheStatus")} - {response?.status || "unhealthy"} + {response?.status || UNHEALTHY_STATUS}

diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails-monitor/_components/EvaluationSettingsModal.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails-monitor/_components/EvaluationSettingsModal.tsx index 12ff10bc0c5..0c3cb62a57f 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails-monitor/_components/EvaluationSettingsModal.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails-monitor/_components/EvaluationSettingsModal.tsx @@ -14,6 +14,7 @@ import { DialogTitle, } from "@/components/ui/dialog"; import { Textarea } from "@/components/ui/textarea"; +import { codeSamples } from "@/i18n/untranslated/codeSamples"; const DEFAULT_PROMPT = `Evaluate whether this guardrail's decision was correct. Analyze the user input, the guardrail action taken, and determine if it was appropriate. @@ -130,7 +131,7 @@ export function EvaluationSettingsModal({ -

response_format: json_schema

+

{codeSamples.guardrails.evaluationResponseFormat}