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, useEffect } from "react";
import { toast } from "sonner";
import { useTranslations } from "next-intl";
const REACTIONS: Record<string, string> = {
like: "👍",
@@ -20,6 +21,7 @@ type Props = {
};
export function CommentReactions({ recipeId, commentId, initialCounts = {}, initialUserReactions = [] }: Props) {
const t = useTranslations("social");
const [counts, setCounts] = useState<Record<string, number>>(initialCounts);
const [userReactions, setUserReactions] = useState<string[]>(initialUserReactions);
const [pending, setPending] = useState<string | null>(null);
@@ -69,9 +71,9 @@ export function CommentReactions({ recipeId, commentId, initialCounts = {}, init
[type]: Math.max(0, (prev[type] ?? 0) + (hasReacted ? 1 : -1)),
}));
if (res.status === 401) {
toast.error("Sign in to react to comments");
toast.error(t("signInToReact"));
} else {
toast.error("Failed to update reaction");
toast.error(t("reactionFailed"));
}
return;
}
@@ -92,7 +94,7 @@ export function CommentReactions({ recipeId, commentId, initialCounts = {}, init
...prev,
[type]: Math.max(0, (prev[type] ?? 0) + (hasReacted ? 1 : -1)),
}));
toast.error("Failed to update reaction");
toast.error(t("reactionFailed"));
} finally {
setPending(null);
}
@@ -115,7 +117,7 @@ export function CommentReactions({ recipeId, commentId, initialCounts = {}, init
: "border-border bg-transparent text-muted-foreground hover:border-primary/50 hover:text-foreground",
pending === type ? "opacity-60 cursor-not-allowed" : "cursor-pointer",
].join(" ")}
aria-label={`${reacted ? "Remove" : "Add"} ${type} reaction`}
aria-label={reacted ? t("removeReaction", { type }) : t("addReaction", { type })}
aria-pressed={reacted}
>
<span>{emoji}</span>