Files
edgeever/tests/ui-locale-fallback.test.ts
T
tianma-if ea9900b7e2 feat(i18n): add Japanese as a first-class in-app locale
Ship a full shared Japanese catalog for Web, desktop, and Android, resolve ja-JP to ja instead of English, and give iOS a three-language path with Japanese login, settings, and list chrome. Unmatched languages still fall back to English.
2026-09-14 12:49:11 +08:00

21 lines
1.1 KiB
TypeScript

import { readFileSync } from "node:fs";
import { describe, expect, test } from "bun:test";
const read = (relativePath: string) => readFileSync(new URL(`../${relativePath}`, import.meta.url), "utf8");
describe("unmatched locale fallback", () => {
test("site, Android, and iOS resolve Japanese to ja and other unmatched languages to English", () => {
const siteLayout = read("apps/site/src/layouts/Layout.astro");
const mobileLocale = read("apps/mobile/src/lib/mobile-locale.tsx");
const mobileUtils = read("apps/mobile/src/screens/workspace-utils.ts");
const iosPreferences = read("apps/ios/EdgeEver/Data/Preferences/PreferencesStore.swift");
const sharedLocales = read("packages/shared/src/i18n/locales.ts");
expect(sharedLocales).toContain('"ja"');
expect(siteLayout).toContain('return sawCandidate ? "en-US" : null');
expect(mobileLocale).toContain("resolveSupportedLocale(Intl.DateTimeFormat().resolvedOptions().locale)");
expect(mobileUtils).toContain("resolveSupportedLocale(Intl.DateTimeFormat().resolvedOptions().locale)");
expect(iosPreferences).toContain("if code.hasPrefix(\"ja\") { return .japanese }");
});
});