mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-18 21:16:47 +00:00
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.
This commit is contained in:
@@ -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<string, NotificationLocale>;
|
||||
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<SupportedLanguageCode, NotificationLocale>;
|
||||
|
||||
export const EMAIL_I18N: Record<string, EmailStrings> = Object.fromEntries(
|
||||
Object.entries(LOCALES).map(([k, v]) => [k, v.email]),
|
||||
|
||||
@@ -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');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user