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 { History, RotateCcw, ChevronDown } from "lucide-react";
import { toast } from "sonner";
@@ -39,6 +40,8 @@ function formatDate(dateStr: string): string {
}
export function VersionHistoryButton({ recipeId }: { recipeId: string }) {
const t = useTranslations("recipe");
const tForm = useTranslations("recipeForm");
const router = useRouter();
const [open, setOpen] = useState(false);
const [versions, setVersions] = useState<VersionSummary[]>([]);
@@ -91,7 +94,7 @@ export function VersionHistoryButton({ recipeId }: { recipeId: string }) {
setOpen(false);
router.refresh();
} else {
toast.error("Failed to restore version");
toast.error(t("historyRestoreFailed"));
}
} finally {
setRestoringId(null);
@@ -143,7 +146,7 @@ export function VersionHistoryButton({ recipeId }: { recipeId: string }) {
variant="ghost"
size="icon"
className="h-7 w-7 shrink-0"
title="Expand"
title={tForm("expand")}
onClick={() => void handleExpand(v)}
>
<ChevronDown className={`h-4 w-4 transition-transform ${isExpanded ? "rotate-180" : ""}`} />