From fc31bc2d78d1d20c8d9b340201a06d860907eaa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B9=E9=9B=AA?= <2b@yorha.xyz> Date: Thu, 11 Jun 2026 06:12:30 +0900 Subject: [PATCH] feat(ui): i18n for key info view --- .../components/templates/key_info_view.tsx | 254 +++++++++++------- ui/litellm-dashboard/src/locales/en.json | 67 +++++ ui/litellm-dashboard/src/locales/zh-CN.json | 67 +++++ 3 files changed, 288 insertions(+), 100 deletions(-) diff --git a/ui/litellm-dashboard/src/components/templates/key_info_view.tsx b/ui/litellm-dashboard/src/components/templates/key_info_view.tsx index 018880b70aa..3216081e251 100644 --- a/ui/litellm-dashboard/src/components/templates/key_info_view.tsx +++ b/ui/litellm-dashboard/src/components/templates/key_info_view.tsx @@ -23,6 +23,7 @@ import ObjectPermissionsView from "../object_permissions_view"; import { RegenerateKeyModal } from "../organisms/RegenerateKeyModal"; import { parseErrorMessage } from "../shared/errorUtils"; import { KeyEditView } from "./key_edit_view"; +import { Trans, useTranslation } from "react-i18next"; interface KeyInfoViewProps { keyId: string; @@ -61,8 +62,9 @@ export default function KeyInfoView({ teams, onKeyDataUpdate, onDelete, - backButtonText = "Back to Keys", + backButtonText, }: KeyInfoViewProps) { + const { t } = useTranslation(); const { accessToken, userId: userID, userRole, premiumUser } = useAuthorized(); const canEditGuardrails = premiumUser || (userRole != null && rolesWithWriteAccess.includes(userRole)); const { teams: teamsData } = useTeams(); @@ -140,9 +142,9 @@ export default function KeyInfoView({ return (
- Reset spend for {currentKeyData?.key_alias || currentKeyData?.token_id || "this key"} to{" "}
- $0?
+
- Current spend: ${formatNumberWithCommas(currentKeyData.spend, 4)}. Spend history is preserved
- in logs. This resets the current period spend counter, the same as an automatic budget reset.
+
{formatMetadataForDisplay(stripTagsFromMetadata(currentKeyData.metadata))}
diff --git a/ui/litellm-dashboard/src/locales/en.json b/ui/litellm-dashboard/src/locales/en.json
index 93855433caf..165d3783e00 100644
--- a/ui/litellm-dashboard/src/locales/en.json
+++ b/ui/litellm-dashboard/src/locales/en.json
@@ -7870,6 +7870,73 @@
"metadata": "Metadata",
"saveChanges": "Save Changes",
"errorFetchingTags": "Error fetching tags: {{error}}"
+ },
+ "keyInfoView": {
+ "backToKeys": "Back to Keys",
+ "keyNotFound": "Key not found",
+ "invalidMetadataJson": "Invalid metadata JSON",
+ "keyUpdatedSuccess": "Key updated successfully",
+ "keyDeletedSuccess": "Key deleted successfully",
+ "keySpendResetSuccess": "Key spend reset to $0",
+ "virtualKey": "Virtual Key",
+ "enterpriseFeatureTooltip": "This is a LiteLLM Enterprise feature, and requires a valid key to use.",
+ "deleteKeyTitle": "Delete Key",
+ "deleteKeyAlertMessage": "This action is irreversible and will immediately revoke access for any applications using this key.",
+ "deleteKeyMessage": "Are you sure you want to delete this Virtual Key?",
+ "keyInformation": "Key Information",
+ "keyAlias": "Key Alias",
+ "keyId": "Key ID",
+ "teamId": "Team ID",
+ "spend": "Spend",
+ "resetKeySpendTitle": "Reset Key Spend",
+ "thisKey": "this key",
+ "resetSpendConfirm": "Reset spend for {{keyName}} to $0?",
+ "resetSpendCurrentSpend": "Current spend: ${{amount}}. Spend history is preserved in logs. This resets the current period spend counter, the same as an automatic budget reset.",
+ "tabOverview": "Overview",
+ "of": "of",
+ "unlimited": "Unlimited",
+ "rateLimits": "Rate Limits",
+ "tpmValue": "TPM: {{value}}",
+ "rpmValue": "RPM: {{value}}",
+ "models": "Models",
+ "noModelsSpecified": "No models specified",
+ "guardrails": "Guardrails",
+ "noGuardrailsConfigured": "No guardrails configured",
+ "globalGuardrailsDisabled": "Global Guardrails Disabled",
+ "policies": "Policies",
+ "loadingGuardrails": "Loading guardrails...",
+ "resolvedGuardrails": "Resolved Guardrails:",
+ "noPoliciesConfigured": "No policies configured",
+ "keySettingsTitle": "Key Settings",
+ "editSettings": "Edit Settings",
+ "fieldKeyId": "Key ID",
+ "fieldKeyAlias": "Key Alias",
+ "notSet": "Not Set",
+ "fieldSecretKey": "Secret Key",
+ "fieldTeamId": "Team ID",
+ "fieldProject": "Project",
+ "fieldOrganization": "Organization",
+ "fieldCreated": "Created",
+ "fieldLastRegenerated": "Last Regenerated",
+ "recentBadge": "Recent",
+ "fieldExpires": "Expires",
+ "spendValue": "${{amount}} USD",
+ "budget": "Budget",
+ "fieldTags": "Tags",
+ "noTagsSpecified": "No tags specified",
+ "fieldPrompts": "Prompts",
+ "noPromptsSpecified": "No prompts specified",
+ "fieldAllowedRoutes": "Allowed Routes",
+ "allRoutesAllowed": "All routes allowed",
+ "fieldAllowedPassThroughRoutes": "Allowed Pass Through Routes",
+ "noPassThroughRoutesSpecified": "No pass through routes specified",
+ "fieldDisableGlobalGuardrails": "Disable Global Guardrails",
+ "globalGuardrailsBypassed": "Enabled - Global guardrails bypassed",
+ "globalGuardrailsActive": "Disabled - Global guardrails active",
+ "maxParallelRequests": "Max Parallel Requests: {{value}}",
+ "modelTpmLimits": "Model TPM Limits: {{value}}",
+ "modelRpmLimits": "Model RPM Limits: {{value}}",
+ "fieldMetadata": "Metadata"
}
}
}
diff --git a/ui/litellm-dashboard/src/locales/zh-CN.json b/ui/litellm-dashboard/src/locales/zh-CN.json
index 3dfd51c9d19..29da5ab6acf 100644
--- a/ui/litellm-dashboard/src/locales/zh-CN.json
+++ b/ui/litellm-dashboard/src/locales/zh-CN.json
@@ -7870,6 +7870,73 @@
"metadata": "元数据",
"saveChanges": "保存更改",
"errorFetchingTags": "获取标签时出错:{{error}}"
+ },
+ "keyInfoView": {
+ "backToKeys": "返回密钥列表",
+ "keyNotFound": "密钥未找到",
+ "invalidMetadataJson": "无效的元数据 JSON",
+ "keyUpdatedSuccess": "密钥更新成功",
+ "keyDeletedSuccess": "密钥删除成功",
+ "keySpendResetSuccess": "密钥花费已重置为 $0",
+ "virtualKey": "虚拟密钥",
+ "enterpriseFeatureTooltip": "这是 LiteLLM 企业版功能,需要有效密钥才能使用。",
+ "deleteKeyTitle": "删除密钥",
+ "deleteKeyAlertMessage": "此操作不可撤销,将立即撤销所有使用此密钥的应用程序的访问权限。",
+ "deleteKeyMessage": "确定要删除此虚拟密钥吗?",
+ "keyInformation": "密钥信息",
+ "keyAlias": "密钥别名",
+ "keyId": "密钥 ID",
+ "teamId": "团队 ID",
+ "spend": "花费",
+ "resetKeySpendTitle": "重置密钥花费",
+ "thisKey": "此密钥",
+ "resetSpendConfirm": "将 {{keyName}} 的花费重置为 $0?",
+ "resetSpendCurrentSpend": "当前花费:${{amount}}。花费历史记录保留在日志中。这将重置当前周期的花费计数器,与自动预算重置相同。",
+ "tabOverview": "概览",
+ "of": ",共",
+ "unlimited": "无限制",
+ "rateLimits": "速率限制",
+ "tpmValue": "TPM:{{value}}",
+ "rpmValue": "RPM:{{value}}",
+ "models": "模型",
+ "noModelsSpecified": "未指定模型",
+ "guardrails": "护栏",
+ "noGuardrailsConfigured": "未配置护栏",
+ "globalGuardrailsDisabled": "全局护栏已禁用",
+ "policies": "策略",
+ "loadingGuardrails": "正在加载护栏...",
+ "resolvedGuardrails": "已解析护栏:",
+ "noPoliciesConfigured": "未配置策略",
+ "keySettingsTitle": "密钥设置",
+ "editSettings": "编辑设置",
+ "fieldKeyId": "密钥 ID",
+ "fieldKeyAlias": "密钥别名",
+ "notSet": "未设置",
+ "fieldSecretKey": "密钥值",
+ "fieldTeamId": "团队 ID",
+ "fieldProject": "项目",
+ "fieldOrganization": "组织",
+ "fieldCreated": "创建时间",
+ "fieldLastRegenerated": "最近重新生成",
+ "recentBadge": "最近",
+ "fieldExpires": "过期时间",
+ "spendValue": "${{amount}} USD",
+ "budget": "预算",
+ "fieldTags": "标签",
+ "noTagsSpecified": "未指定标签",
+ "fieldPrompts": "提示词",
+ "noPromptsSpecified": "未指定提示词",
+ "fieldAllowedRoutes": "允许的路由",
+ "allRoutesAllowed": "所有路由均允许",
+ "fieldAllowedPassThroughRoutes": "允许的透传路由",
+ "noPassThroughRoutesSpecified": "未指定透传路由",
+ "fieldDisableGlobalGuardrails": "禁用全局护栏",
+ "globalGuardrailsBypassed": "已启用 - 全局护栏已绕过",
+ "globalGuardrailsActive": "已禁用 - 全局护栏已生效",
+ "maxParallelRequests": "最大并发请求数:{{value}}",
+ "modelTpmLimits": "模型 TPM 限制:{{value}}",
+ "modelRpmLimits": "模型 RPM 限制:{{value}}",
+ "fieldMetadata": "元数据"
}
}
}