From 69ffe4279e867661b1ebbffc6a11cd52a9d0916d Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Thu, 5 Nov 2026 12:42:48 -0800 Subject: [PATCH] refactor(ui): move remaining keys, teams and agents text onto i18n (#50238) Constants and option lists on the keys, teams, agents, budgets, cost tracking, router settings and vector store pages now hold message keys, and the code that renders them translates. Values, ids, sort keys and payloads are unchanged, and lookups keyed by server values check Object.hasOwn first Five tests now resolve the expected English through i18n.t instead of reading the constant directly --- .../agents/_components/agent_config.ts | 58 ++--- .../agents/_components/agent_form_fields.tsx | 19 +- .../agents/_components/cost_config_fields.tsx | 50 +++-- .../budgets/_components/BudgetFormFields.tsx | 16 +- .../budgets/_components/BudgetTable.tsx | 21 +- .../_components/ShadowEvalStartForm.tsx | 29 +-- .../_components/add_margin_form.tsx | 13 +- .../_components/cost_tracking_settings.tsx | 15 +- .../hooks/budgets/budgetFilters.ts | 13 +- .../_components/CreateVectorStore.tsx | 2 +- .../_components/DocumentsTableColumns.tsx | 17 +- .../_components/VectorStoreForm.tsx | 7 +- .../RouterSettings/Fallbacks/Fallbacks.tsx | 7 +- .../src/components/Teams.test.tsx | 3 +- .../VirtualKeysPage/VirtualKeysTable.tsx | 41 ++-- .../VirtualKeysPage/keyTableColumns.tsx | 17 +- .../src/components/callback_info_helpers.tsx | 37 ++-- .../budget_duration_dropdown.tsx | 17 +- .../key_team_helpers/BudgetWindowsEditor.tsx | 36 +++- .../ModelMaxBudgetEditor.integration.test.tsx | 7 +- .../key_team_helpers/ModelMaxBudgetEditor.tsx | 32 +-- .../router_settings/ConfigOwned.tsx | 9 +- .../LatencyBasedConfiguration.tsx | 2 +- .../ReliabilityRetriesSection.tsx | 2 +- .../RoutingStrategySelector.tsx | 2 +- .../router_settings/TagFilteringToggle.tsx | 2 +- .../src/components/router_settings/index.tsx | 2 +- .../src/components/team/LoggingSettings.tsx | 8 +- .../src/components/team/TeamInfo.tsx | 21 +- .../team/permission_definitions.test.tsx | 17 +- .../team/permission_definitions.tsx | 50 +++-- .../team/tabVisibilityUtils.test.ts | 13 +- .../src/components/team/tabVisibilityUtils.ts | 16 +- .../templates/estimatedOutputTokens.ts | 11 +- .../components/templates/keyEditFormValues.ts | 5 +- .../key_edit_view.integration.test.tsx | 5 +- .../src/components/vector_store_providers.tsx | 3 +- ui/litellm-dashboard/src/i18n/locales/en.json | 201 ++++++++++++++++++ 38 files changed, 553 insertions(+), 273 deletions(-) diff --git a/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_config.ts b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_config.ts index 652b2c0b480..e44fca35d88 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_config.ts +++ b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_config.ts @@ -15,11 +15,12 @@ import { export interface FieldConfig { name: string; - label: string; + labelKey: ParseKeys; type: "text" | "textarea" | "url" | "switch" | "list" | "select"; required?: boolean; - tooltip?: string; + tooltipKey?: ParseKeys; placeholder?: string; + placeholderKey?: ParseKeys; defaultValue?: any; rows?: number; validation?: any[]; @@ -50,42 +51,41 @@ export const AGENT_FORM_CONFIG: { fields: [ { name: "name", - label: "Display Name", + labelKey: "agents.formConfig.fields.name.label", type: "text", required: true, - placeholder: "e.g., Customer Support Agent", + placeholderKey: "agents.formConfig.fields.name.placeholder", }, { name: "description", - label: "Description", + labelKey: "agents.formConfig.fields.description.label", type: "textarea", required: false, - placeholder: "Describe what this agent does...", + placeholderKey: "agents.formConfig.fields.description.placeholder", rows: 3, }, { name: "url", - label: "URL", + labelKey: "agents.formConfig.fields.url.label", type: "url", required: false, placeholder: "http://localhost:9999/", - tooltip: "Base URL where the agent is hosted (optional)", + tooltipKey: "agents.formConfig.fields.url.tooltip", }, { name: "version", - label: "Version", + labelKey: "agents.formConfig.fields.version.label", type: "text", placeholder: "1.0.0", defaultValue: "1.0.0", }, { name: "protocolVersion", - label: "Protocol Version", + labelKey: "agents.formConfig.fields.protocolVersion.label", type: "select", options: ["1.0", "0.3"], defaultValue: "1.0", - tooltip: - "The A2A protocol version LiteLLM serves to clients for this agent. LiteLLM converts the upstream agent's responses to this version, so clients always see the version you pick here regardless of the original agent's version.", + tooltipKey: "agents.formConfig.fields.protocolVersion.tooltip", helpTextKey: "agents.formConfig.basic.protocolVersionHelp", }, ], @@ -96,7 +96,7 @@ export const AGENT_FORM_CONFIG: { fields: [ { name: "skills", - label: "Skills", + labelKey: "agents.formConfig.fields.skills.label", type: "list", defaultValue: [], }, @@ -108,18 +108,18 @@ export const AGENT_FORM_CONFIG: { fields: [ { name: "streaming", - label: "Streaming", + labelKey: "agents.formConfig.fields.streaming.label", type: "switch", defaultValue: false, }, { name: "pushNotifications", - label: "Push Notifications", + labelKey: "agents.formConfig.fields.pushNotifications.label", type: "switch", }, { name: "stateTransitionHistory", - label: "State Transition History", + labelKey: "agents.formConfig.fields.stateTransitionHistory.label", type: "switch", }, ], @@ -130,19 +130,19 @@ export const AGENT_FORM_CONFIG: { fields: [ { name: "iconUrl", - label: "Icon URL", + labelKey: "agents.formConfig.fields.iconUrl.label", type: "url", placeholder: "https://example.com/icon.png", }, { name: "documentationUrl", - label: "Documentation URL", + labelKey: "agents.formConfig.fields.documentationUrl.label", type: "url", placeholder: "https://docs.example.com", }, { name: "supportsAuthenticatedExtendedCard", - label: "Supports Authenticated Extended Card", + labelKey: "agents.formConfig.fields.supportsAuthenticatedExtendedCard.label", type: "switch", }, ], @@ -153,12 +153,12 @@ export const AGENT_FORM_CONFIG: { fields: [ { name: "model", - label: "Model (Optional)", + labelKey: "agents.formConfig.fields.model.label", type: "text", }, { name: "make_public", - label: "Make Public", + labelKey: "agents.formConfig.fields.makePublic.label", type: "switch", }, ], @@ -169,24 +169,24 @@ export const AGENT_FORM_CONFIG: { fields: [ { name: "cost_per_query", - label: "Cost Per Query ($)", + labelKey: "agents.formConfig.fields.costPerQuery.label", type: "text", placeholder: "0.0", - tooltip: "Fixed cost per query", + tooltipKey: "agents.formConfig.fields.costPerQuery.tooltip", }, { name: "input_cost_per_token", - label: "Input Cost Per Token ($)", + labelKey: "agents.formConfig.fields.inputCostPerToken.label", type: "text", placeholder: "0.000001", - tooltip: "Cost per input token", + tooltipKey: "agents.formConfig.fields.inputCostPerToken.tooltip", }, { name: "output_cost_per_token", - label: "Output Cost Per Token ($)", + labelKey: "agents.formConfig.fields.outputCostPerToken.label", type: "text", placeholder: "0.000002", - tooltip: "Cost per output token", + tooltipKey: "agents.formConfig.fields.outputCostPerToken.tooltip", }, ], }, @@ -196,10 +196,10 @@ export const AGENT_FORM_CONFIG: { fields: [ { name: "enable_tracing", - label: "Enable Tracing", + labelKey: "agents.formConfig.fields.enableTracing.label", type: "switch", defaultValue: false, - tooltip: "Enable request tracing for this agent", + tooltipKey: "agents.formConfig.fields.enableTracing.tooltip", }, ], }, diff --git a/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_form_fields.tsx b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_form_fields.tsx index 41e25d14054..2f69336e6c6 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_form_fields.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_form_fields.tsx @@ -256,23 +256,24 @@ const AgentFormFields: React.FC = ({ panels, showAgentName {({ value, onChange, ref, ...control }) => { const text = typeof value === "string" ? value : ""; + const placeholder = field.placeholderKey ? t(field.placeholderKey) : field.placeholder; if (field.type === "textarea") { return (