chore: move i18n to shared package (#1066)

* chore: move i18n to shared package

* chore: move server translations to shared package and apply linter and prettier on entire shared package
This commit is contained in:
Julien G.
2026-05-26 20:27:29 +02:00
committed by GitHub
parent 324d930ca3
commit 126f2df21b
860 changed files with 56891 additions and 46377 deletions
@@ -0,0 +1,64 @@
import ar from '../ar/externalNotifications';
import br from '../br/externalNotifications';
import cs from '../cs/externalNotifications';
import de from '../de/externalNotifications';
import en from '../en/externalNotifications';
import es from '../es/externalNotifications';
import fr from '../fr/externalNotifications';
import hu from '../hu/externalNotifications';
import id from '../id/externalNotifications';
import it from '../it/externalNotifications';
import ja from '../ja/externalNotifications';
import ko from '../ko/externalNotifications';
import nl from '../nl/externalNotifications';
import pl from '../pl/externalNotifications';
import ru from '../ru/externalNotifications';
import tr from '../tr/externalNotifications';
import uk from '../uk/externalNotifications';
import zhTW from '../zh-TW/externalNotifications';
import zh from '../zh/externalNotifications';
import type {
NotificationLocale,
EmailStrings,
EventTextFn,
PasswordResetStrings,
NotificationEventKey,
} from './types';
export * from './types';
const LOCALES = {
en,
de,
fr,
es,
hu,
nl,
br,
cs,
pl,
ru,
zh,
'zh-TW': zhTW,
it,
tr,
ar,
id,
ja,
ko,
uk,
} satisfies Record<string, NotificationLocale>;
export const EMAIL_I18N: Record<string, EmailStrings> = Object.fromEntries(
Object.entries(LOCALES).map(([k, v]) => [k, v.email]),
);
export const EVENT_TEXTS: Record<
string,
Record<NotificationEventKey, EventTextFn>
> = Object.fromEntries(Object.entries(LOCALES).map(([k, v]) => [k, v.events]));
export const PASSWORD_RESET_I18N: Record<string, PasswordResetStrings> =
Object.fromEntries(
Object.entries(LOCALES).map(([k, v]) => [k, v.passwordReset]),
);
@@ -0,0 +1,40 @@
export interface EmailStrings {
footer: string;
manage: string;
madeWith: string;
openTrek: string;
}
export interface EventText {
title: string;
body: string;
}
export type EventTextFn = (params: Record<string, string>) => EventText;
export interface PasswordResetStrings {
subject: string;
greeting: string;
body: string;
ctaIntro: string;
expiry: string;
ignore: string;
}
export type NotificationEventKey =
| 'trip_invite'
| 'booking_change'
| 'trip_reminder'
| 'todo_due'
| 'vacay_invite'
| 'photos_shared'
| 'collab_message'
| 'packing_tagged'
| 'version_available'
| 'synology_session_cleared';
export interface NotificationLocale {
email: EmailStrings;
events: Record<NotificationEventKey, EventTextFn>;
passwordReset: PasswordResetStrings;
}