Skip to content

Commit b8f9fbd

Browse files
authored
fix: add zh to zh_CN mapping (#17)
Co-authored-by: Richard Herman <[email protected]>
1 parent a8e2241 commit b8f9fbd

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/core/__tests__/i18n.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,17 @@ describe("i18n", () => {
8989
// then.
9090
expect(i18n.language).toBe("zh_CN");
9191
});
92+
93+
it("should map to simplified Chinese without region", async () => {
94+
// given.
95+
jest.spyOn(window.navigator, "language", "get").mockReturnValue("zh");
96+
97+
// when
98+
const i18n = (await import("../i18n")).default;
99+
100+
// then.
101+
expect(i18n.language).toBe("zh_CN");
102+
});
92103
});
93104
});
94105

src/core/i18n.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export class Internationalization {
4848
}
4949

5050
// Chinese Simplified
51-
if (language === "zh-Hans" || language === "zh-CN") {
51+
if (language === "zh" || language === "zh-Hans" || language === "zh-CN") {
5252
return "zh_CN";
5353
}
5454

0 commit comments

Comments
 (0)