diff --git a/shared/src/i18n/externalNotifications/index.ts b/shared/src/i18n/externalNotifications/index.ts index 6e1bcfd43..1b04b3a3a 100644 --- a/shared/src/i18n/externalNotifications/index.ts +++ b/shared/src/i18n/externalNotifications/index.ts @@ -1,6 +1,7 @@ import ar from '../ar/externalNotifications'; import az from '../az/externalNotifications'; import br from '../br/externalNotifications'; +import ca from '../ca/externalNotifications'; import cs from '../cs/externalNotifications'; import de from '../de/externalNotifications'; import en from '../en/externalNotifications'; @@ -13,6 +14,7 @@ import id from '../id/externalNotifications'; import it from '../it/externalNotifications'; import ja from '../ja/externalNotifications'; import ko from '../ko/externalNotifications'; +import type { SupportedLanguageCode } from '../languages'; import nl from '../nl/externalNotifications'; import pl from '../pl/externalNotifications'; import ru from '../ru/externalNotifications'; @@ -21,6 +23,7 @@ import sv from '../sv/externalNotifications'; import th from '../th/externalNotifications'; import tr from '../tr/externalNotifications'; import uk from '../uk/externalNotifications'; +import vi from '../vi/externalNotifications'; import zhTW from '../zh-TW/externalNotifications'; import zh from '../zh/externalNotifications'; import type { @@ -59,7 +62,11 @@ const LOCALES = { uk, gr, sv, -} satisfies Record; + vi, + ca, + // Every language the app ships, or the compiler says which one is missing: + // a locale left out here sent its users English mails without anyone noticing. +} satisfies Record; export const EMAIL_I18N: Record = Object.fromEntries( Object.entries(LOCALES).map(([k, v]) => [k, v.email]), diff --git a/shared/src/i18n/externalNotifications/locales.spec.ts b/shared/src/i18n/externalNotifications/locales.spec.ts new file mode 100644 index 000000000..149f30c18 --- /dev/null +++ b/shared/src/i18n/externalNotifications/locales.spec.ts @@ -0,0 +1,12 @@ +import { SUPPORTED_LANGUAGE_CODES } from '../languages'; +import { EMAIL_I18N, EVENT_TEXTS } from './index'; + +import { describe, expect, it } from 'vitest'; + +describe('notification locales', () => { + it('cover every language the app ships, so no user gets English mail by omission', () => { + expect(Object.keys(EMAIL_I18N).sort()).toEqual([...SUPPORTED_LANGUAGE_CODES].sort()); + expect(Object.keys(EVENT_TEXTS).sort()).toEqual([...SUPPORTED_LANGUAGE_CODES].sort()); + expect(EMAIL_I18N.ca?.manage).toBe('Gestiona les preferències'); + }); +});