feat(i18n): translate hardcoded strings across print, public recipe, and recipe management UI

Wires dozens of components and server pages to next-intl instead of hardcoded
English text, and adds a lightweight getMessages/formatMessage helper for
server components (print pages, public recipe page, cook metadata) since
next-intl/server isn't wired into this app's routing. Backfills missing
en/fr message keys that existing code already referenced but fr.json lacked.
This commit is contained in:
Arnaud
2026-07-02 07:58:18 +02:00
parent afff6cf9eb
commit 01fdbb880b
32 changed files with 515 additions and 187 deletions
+14
View File
@@ -0,0 +1,14 @@
import en from "@/messages/en.json";
import fr from "@/messages/fr.json";
const catalogs = { en, fr } as const;
export type Locale = keyof typeof catalogs;
export function getMessages(locale: string | undefined | null) {
return catalogs[locale as Locale] ?? catalogs.en;
}
export function formatMessage(template: string, vars: Record<string, string | number>) {
return template.replace(/\{(\w+)\}/g, (_, key) => String(vars[key] ?? ""));
}