import { describe, expect, it } from "vitest"; import { readMergedLocaleNamespace } from "~/utils/testing/repoPaths"; type MessageDiscoveryTranslations = { chat: { messageDiscovery: { search: Record; mentions: Record; actions: Record; result: Record; }; }; }; function readTranslations(locale: "de" | "de-formal" | "en"): MessageDiscoveryTranslations { return readMergedLocaleNamespace(locale, "translations"); } describe("AK-P15b message discovery translations", () => { it("ships the same complete search and mentions contract in every locale", () => { const reference = readTranslations("en").chat.messageDiscovery; for (const locale of ["de", "de-formal", "en"] as const) { const translations = readTranslations(locale).chat.messageDiscovery; expect(Object.keys(translations.search)).toEqual(Object.keys(reference.search)); expect(Object.keys(translations.mentions)).toEqual(Object.keys(reference.mentions)); expect(Object.keys(translations.actions)).toEqual(Object.keys(reference.actions)); expect(Object.keys(translations.result)).toEqual(Object.keys(reference.result)); for (const group of Object.values(translations)) { for (const value of Object.values(group)) expect(value.trim()).not.toBe(""); } expect(translations.result.openAria).toContain("{{author}}"); expect(translations.result.openAria).toContain("{{channel}}"); } }); it("uses formal address in the German formal search copy", () => { const formal = readTranslations("de-formal").chat.messageDiscovery; expect(formal.search.subtitle).toContain("Sie"); expect(formal.search.emptyBody).toContain("Geben Sie"); }); });