mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-23 09:42:53 +00:00
fix(app): localize Claude session window
This commit is contained in:
@@ -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");
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user