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:
@@ -1,6 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { useRef, useState } from "react";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { Camera, Loader2 } from "lucide-react";
|
||||
import { toast } from "sonner";
|
||||
@@ -8,6 +9,7 @@ import { Button } from "@/components/ui/button";
|
||||
import { FakeProgressBar } from "@/components/ui/fake-progress-bar";
|
||||
|
||||
export function PhotoImportButton() {
|
||||
const t = useTranslations("recipe");
|
||||
const router = useRouter();
|
||||
const fileRef = useRef<HTMLInputElement>(null);
|
||||
const [loading, setLoading] = useState(false);
|
||||
@@ -52,7 +54,7 @@ export function PhotoImportButton() {
|
||||
const { id } = await res.json() as { id: string };
|
||||
router.push(`/recipes/${id}/edit`);
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : "Failed to import recipe from photo.");
|
||||
toast.error(err instanceof Error ? err.message : t("photoImportFailed"));
|
||||
} finally {
|
||||
setLoading(false);
|
||||
// Reset input so the same file can be re-selected
|
||||
|
||||
Reference in New Issue
Block a user