From 079f37ec93846b3d5707dc4f3de35bec9c5ca9c0 Mon Sep 17 00:00:00 2001 From: LTbinglingfeng Date: Fri, 2 Jan 2026 00:41:35 +0800 Subject: [PATCH] fix(quota): translate Codex window labels at render time --- src/pages/QuotaPage.tsx | 15 +++++++++------ src/types/quota.ts | 1 + 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/pages/QuotaPage.tsx b/src/pages/QuotaPage.tsx index 116d07f..523f3b6 100644 --- a/src/pages/QuotaPage.tsx +++ b/src/pages/QuotaPage.tsx @@ -1031,7 +1031,7 @@ export function QuotaPage() { const windows: CodexQuotaWindow[] = []; const addWindow = ( id: string, - label: string, + labelKey: string, window?: CodexUsageWindow | null, limitReached?: boolean, allowed?: boolean @@ -1044,7 +1044,8 @@ export function QuotaPage() { usedPercentRaw ?? (isLimitReached && resetLabel !== '-' ? 100 : null); windows.push({ id, - label, + label: t(labelKey), + labelKey, usedPercent, resetLabel }); @@ -1052,21 +1053,21 @@ export function QuotaPage() { addWindow( 'primary', - t('codex_quota.primary_window'), + 'codex_quota.primary_window', rateLimit?.primary_window ?? rateLimit?.primaryWindow, rateLimit?.limit_reached ?? rateLimit?.limitReached, rateLimit?.allowed ); addWindow( 'secondary', - t('codex_quota.secondary_window'), + 'codex_quota.secondary_window', rateLimit?.secondary_window ?? rateLimit?.secondaryWindow, rateLimit?.limit_reached ?? rateLimit?.limitReached, rateLimit?.allowed ); addWindow( 'code-review', - t('codex_quota.code_review_window'), + 'codex_quota.code_review_window', codeReviewLimit?.primary_window ?? codeReviewLimit?.primaryWindow, codeReviewLimit?.limit_reached ?? codeReviewLimit?.limitReached, codeReviewLimit?.allowed @@ -1552,10 +1553,12 @@ export function QuotaPage() { ? styles.quotaBarFillMedium : styles.quotaBarFillLow; + const windowLabel = window.labelKey ? t(window.labelKey) : window.label; + return (
- {window.label} + {windowLabel}
{percentLabel} {window.resetLabel} diff --git a/src/types/quota.ts b/src/types/quota.ts index 14a8deb..ac32a50 100644 --- a/src/types/quota.ts +++ b/src/types/quota.ts @@ -37,6 +37,7 @@ export interface GeminiCliQuotaState { export interface CodexQuotaWindow { id: string; label: string; + labelKey?: string; usedPercent: number | null; resetLabel: string; }