Files
DeepTutor/web/tests/partial-locale-fallback.spec.ts
Antonio-Faure 28d86973a4 fix(i18n): complete the French catalog and follow it for partner replies
- add the 760 English keys missing from the French catalog and translate 229 values still copied from English\n- make a partner's empty reply language (Auto) follow the account model output language instead of hardcoding English\n- label Auto with the configured language and offer every supported response language in the picker\n- localize the Feishu thinking notice for every supported response language\n- add French catalog, picker and partner runtime regression tests
2026-10-30 18:02:55 +01:00

37 lines
958 B
TypeScript

import { expect, it } from "vitest";
import { ensureLanguage, initI18n } from "@/i18n/init";
it("uses French copy now that the catalog is complete", async () => {
const i18n = initI18n("fr");
await ensureLanguage("fr");
await i18n.changeLanguage("fr");
expect(i18n.t("common.save")).toBe("Enregistrer");
});
it("uses English copy for a key missing from a partial locale", async () => {
const i18n = initI18n("en");
i18n.addResourceBundle(
"partial",
"app",
{ "common.cancel": "Annuler" },
true,
true,
);
await i18n.changeLanguage("partial");
expect(i18n.t("common.cancel")).toBe("Annuler");
expect(i18n.t("common.save")).toBe("Save");
i18n.removeResourceBundle("partial", "app");
});
it("uses Ukrainian copy when a translation exists", async () => {
const i18n = initI18n("uk");
await ensureLanguage("uk");
await i18n.changeLanguage("uk");
expect(i18n.t("common.save")).toBe("зберегти");
});