fix(app): localize Claude session window

This commit is contained in:
Michael Wu
2026-10-18 05:19:33 +09:00
parent e889738fe4
commit dacccf1374
2 changed files with 7 additions and 1 deletions
+2
View File
@@ -79,7 +79,9 @@ describe("formatAmount", () => {
await i18n.changeLanguage("ko");
expect(formatProviderUsageLabel("session", "Session")).toBe("세션");
expect(formatProviderUsageLabel("five_hour", "Session")).toBe("세션");
expect(formatProviderUsageLabel("five_hour", "5-hour limit")).toBe("5-hour limit");
expect(formatProviderUsageLabel("monthly", "Monthly")).toBe("월간");
expect(formatProviderUsageLabel("credits", "Credits")).toBe("크레딧");
expect(formatProviderUsageLabel("custom_limit", "Custom limit")).toBe("Custom limit");
});
+5 -1
View File
@@ -12,7 +12,11 @@ const providerUsageLabelKeys = {
} as const;
export function formatProviderUsageLabel(id: string, fallback: string): string {
const key = providerUsageLabelKeys[id as keyof typeof providerUsageLabelKeys];
const key =
providerUsageLabelKeys[id as keyof typeof providerUsageLabelKeys] ??
// Claude exposes its session window with a five-hour ID. Other sources use that same ID for
// literal five-hour quotas, so retain their provider label unless this is Claude's Session.
(id === "five_hour" && fallback === "Session" ? providerUsageLabelKeys.session : undefined);
return key ? i18n.t(key) : fallback;
}