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
@@ -1,6 +1,7 @@
"use client";
import { useState } from "react";
import { useTranslations } from "next-intl";
import { useRouter } from "next/navigation";
import { Sparkles, Loader2 } from "lucide-react";
import { toast } from "sonner";
@@ -21,6 +22,7 @@ export function GenerateContentButton({
title: string;
description?: string | null;
}) {
const t = useTranslations("ai.generate");
const router = useRouter();
const [busy, setBusy] = useState(false);
@@ -38,8 +40,7 @@ export function GenerateContentButton({
});
if (!genRes.ok) {
const err = await genRes.json() as { error?: string };
toast.error(err.error ?? "Generation failed");
toast.error(t("contentGenerateFailed"));
return;
}
@@ -65,11 +66,11 @@ export function GenerateContentButton({
});
if (!saveRes.ok) {
toast.error("Failed to save generated content");
toast.error(t("contentSaveFailed"));
return;
}
toast.success("Ingredients and steps generated!");
toast.success(t("contentGenerated"));
router.refresh();
} finally {
setBusy(false);