i18n: translate meal/drink pairing, nutrition, comments, DMs, people search, URL import

Full sweep of hardcoded English strings across:
- Meal pairing and drink pairing dialogs (titles, descriptions, role/
  type labels, regenerate/generate buttons, progress labels) — also
  fixed drink type labels that had French text hardcoded regardless
  of locale ("Sans alcool"/"Chaud").
- Nutrition panel — had no useTranslations at all.
- Comments: header, empty/loading state, post/reply/cancel/delete
  buttons, relative timestamps (just now/Xm ago/Xh ago/Xd ago), and
  comment-reactions' toasts + aria-labels.
- Rating stars toasts.
- Direct messages: thread, conversation list, message button, both
  /messages pages.
- People search page and component.
- URL import dialog (title, description, buttons, toasts).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Arnaud
2026-07-09 03:20:49 +02:00
parent e67145493e
commit 08ab9ac71f
16 changed files with 299 additions and 101 deletions
@@ -2,6 +2,7 @@
import { useState } from "react";
import { useRouter } from "next/navigation";
import { useTranslations } from "next-intl";
import { Link2, Loader2 } from "lucide-react";
import { toast } from "sonner";
import { Button } from "@/components/ui/button";
@@ -28,6 +29,8 @@ export function UrlImportDialog({
open: boolean;
onOpenChange: (open: boolean) => void;
}) {
const t = useTranslations("recipe");
const tCommon = useTranslations("common");
const router = useRouter();
const [url, setUrl] = useState("");
const [importing, setImporting] = useState(false);
@@ -44,7 +47,7 @@ export function UrlImportDialog({
if (!res.ok) {
const err = await res.json() as { error?: string };
toast.error(err.error ?? "Failed to import recipe");
toast.error(err.error ?? t("urlImportFetchFailed"));
return;
}
@@ -61,12 +64,12 @@ export function UrlImportDialog({
});
if (!saveRes.ok) {
toast.error("Failed to save imported recipe");
toast.error(t("urlImportSaveFailed"));
return;
}
const saved = await saveRes.json() as { id: string };
toast.success("Recipe imported! Review before publishing.");
toast.success(t("urlImportSuccess"));
onOpenChange(false);
router.push(`/recipes/${saved.id}/edit`);
} finally {
@@ -80,15 +83,15 @@ export function UrlImportDialog({
<DialogHeader>
<DialogTitle className="flex items-center gap-2">
<Link2 className="h-5 w-5 text-primary" />
Import recipe from URL
{t("urlImportTitle")}
</DialogTitle>
<DialogDescription>
Paste a recipe URL and AI will extract the ingredients and instructions.
{t("urlImportDescription")}
</DialogDescription>
</DialogHeader>
<div className="space-y-4">
<div className="space-y-2">
<Label htmlFor="import-url">Recipe URL</Label>
<Label htmlFor="import-url">{t("urlImportLabel")}</Label>
<Input
id="import-url"
type="url"
@@ -101,18 +104,18 @@ export function UrlImportDialog({
</div>
<div className="flex gap-2 justify-end">
<Button variant="outline" onClick={() => onOpenChange(false)} disabled={importing}>
Cancel
{tCommon("cancel")}
</Button>
<Button onClick={handleImport} disabled={!url.trim() || importing}>
{importing ? (
<>
<Loader2 className="h-4 w-4 animate-spin" />
Importing
{t("urlImportingButton")}
</>
) : (
<>
<Link2 className="h-4 w-4" />
Import
{t("urlImportButton")}
</>
)}
</Button>