mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-06-16 13:34:04 +08:00
5fd3ec0d6a
* Add Traditional Chinese localization * fix: address zh-TW formatting and token units - Format `zh-TW.json` with Prettier. - Use Traditional Chinese `萬` and `億` units for zh-TW token summaries. - Add usage formatting coverage for Traditional Chinese locale aliases. --------- Co-authored-by: Jason <farion1231@gmail.com>
18 lines
596 B
TypeScript
18 lines
596 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import {
|
|
formatTokensShort,
|
|
getLocaleFromLanguage,
|
|
} from "@/components/usage/format";
|
|
|
|
describe("usage format helpers", () => {
|
|
it("formats Traditional Chinese token units with Traditional characters", () => {
|
|
expect(formatTokensShort(12_345, "zh-TW")).toBe("1.2 萬");
|
|
expect(formatTokensShort(123_456_789, "zh-Hant", 2)).toBe("1.23 億");
|
|
});
|
|
|
|
it("resolves Traditional Chinese locale aliases", () => {
|
|
expect(getLocaleFromLanguage("zh_TW")).toBe("zh-TW");
|
|
expect(getLocaleFromLanguage("zh-HK")).toBe("zh-TW");
|
|
});
|
|
});
|