From 8923918eb4cdf9578fce6a9641a7af97ebbded01 Mon Sep 17 00:00:00 2001 From: Maurice Date: Wed, 7 Oct 2026 16:35:50 +0200 Subject: [PATCH] fix(i18n): send Catalan and Vietnamese notification mails in their language Both locales had their notification texts, but the index never imported them, so their users got English mails and the parity gate passed because the files existed. The locale map is now typed against the supported languages, so the next one left out fails to compile. --- shared/src/i18n/externalNotifications/index.ts | 9 ++++++++- .../src/i18n/externalNotifications/locales.spec.ts | 12 ++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 shared/src/i18n/externalNotifications/locales.spec.ts 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'); + }); +});