From 44d3560f5b3b726d376ffe1178bf3f92dbee255d Mon Sep 17 00:00:00 2001 From: Finesssee <90105158+Finesssee@users.noreply.github.com> Date: Mon, 24 Aug 2026 22:58:01 +0700 Subject: [PATCH 1/2] Port upstream 0.55.0: clarify Chinese quota labels --- apps/desktop-tauri/src/components/MenuCard.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/desktop-tauri/src/components/MenuCard.tsx b/apps/desktop-tauri/src/components/MenuCard.tsx index d9e099f34a..5094ae9331 100644 --- a/apps/desktop-tauri/src/components/MenuCard.tsx +++ b/apps/desktop-tauri/src/components/MenuCard.tsx @@ -72,8 +72,16 @@ export function maskEmail(email: string): string { function localizeWindowLabel( raw: string | undefined, t: (key: LocaleKey) => string, + language?: string, + windowMinutes?: number | null, ): string { const normalized = raw?.trim().toLowerCase(); + // Upstream 0.55.0 #3070: quota windows in Simplified Chinese use their + // actual duration instead of the conversational Session wording. + if (language === "chinese" && normalized === "session") { + if (windowMinutes === 5 * 60) return "5 小时"; + if (windowMinutes === 7 * 24 * 60) return t("ProviderWeeklyLabel"); + } if (normalized === "weekly") { return t("ProviderWeeklyLabel"); } @@ -127,7 +135,7 @@ export default function MenuCard({ compactMetrics = false, costSummaryDisplayStyle, } = display; - const { t } = useLocale(); + const { t, language } = useLocale(); const [chartData, setChartData] = useState(null); const [pricingStatus, setPricingStatus] = useState(null); @@ -179,7 +187,7 @@ export default function MenuCard({ : [ { id: "primary", - label: provider.primaryLabel ?? t("DetailWindowPrimary"), + label: localizeWindowLabel(provider.primaryLabel, t, language, provider.primary.windowMinutes) || t("DetailWindowPrimary"), snap: provider.primary, }, ]), From c01aa60fb1dde9b4702dec1c77b42d0596daa5d6 Mon Sep 17 00:00:00 2001 From: Finesssee <90105158+Finesssee@users.noreply.github.com> Date: Tue, 25 Aug 2026 04:25:17 +0700 Subject: [PATCH 2/2] Address thermo review findings --- .../src/components/MenuCard.test.tsx | 25 +++++++++++++++++++ .../desktop-tauri/src/components/MenuCard.tsx | 6 +++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/apps/desktop-tauri/src/components/MenuCard.test.tsx b/apps/desktop-tauri/src/components/MenuCard.test.tsx index 35dd82826e..15e3eadc5a 100644 --- a/apps/desktop-tauri/src/components/MenuCard.test.tsx +++ b/apps/desktop-tauri/src/components/MenuCard.test.tsx @@ -375,6 +375,31 @@ describe("MenuCard", () => { expect(screen.queryByText("Session")).not.toBeInTheDocument(); }); + it("uses explicit hourly quota labels in Simplified Chinese", async () => { + tauriMocks.getLocaleStrings.mockResolvedValue(buildBundle({}, "chinese")); + const snapshot = provider(null, 31); + snapshot.primary = rateWindow(31, { windowMinutes: 3 * 60 }); + snapshot.selectedMetric = snapshot.primary; + + renderCard(snapshot); + + expect(await screen.findByText("3 小时")).toBeInTheDocument(); + expect(screen.queryByText("Session")).not.toBeInTheDocument(); + }); + + it("maps a Simplified Chinese session-labelled weekly window to Weekly", async () => { + tauriMocks.getLocaleStrings.mockResolvedValue( + buildBundle({ ProviderWeeklyLabel: "本周" }, "chinese"), + ); + const snapshot = provider(null, 31); + snapshot.primary = rateWindow(31, { windowMinutes: 7 * 24 * 60 }); + snapshot.selectedMetric = snapshot.primary; + + renderCard(snapshot); + + expect(await screen.findByText("本周")).toBeInTheDocument(); + }); + it("notifies the tray panel after async local usage data loads", async () => { const onLayoutChange = vi.fn(); diff --git a/apps/desktop-tauri/src/components/MenuCard.tsx b/apps/desktop-tauri/src/components/MenuCard.tsx index 5094ae9331..e879e8fff5 100644 --- a/apps/desktop-tauri/src/components/MenuCard.tsx +++ b/apps/desktop-tauri/src/components/MenuCard.tsx @@ -78,9 +78,11 @@ function localizeWindowLabel( const normalized = raw?.trim().toLowerCase(); // Upstream 0.55.0 #3070: quota windows in Simplified Chinese use their // actual duration instead of the conversational Session wording. - if (language === "chinese" && normalized === "session") { - if (windowMinutes === 5 * 60) return "5 小时"; + if (language === "chinese" && normalized === "session" && windowMinutes != null) { if (windowMinutes === 7 * 24 * 60) return t("ProviderWeeklyLabel"); + if (windowMinutes >= 60 && windowMinutes <= 12 * 60 && windowMinutes % 60 === 0) { + return `${windowMinutes / 60} 小时`; + } } if (normalized === "weekly") { return t("ProviderWeeklyLabel");