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:
@@ -2,6 +2,7 @@
|
||||
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { toast } from "sonner";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { Send } from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
@@ -21,6 +22,7 @@ export function MessageThread({
|
||||
conversationId: string;
|
||||
currentUserId: string;
|
||||
}) {
|
||||
const t = useTranslations("messages");
|
||||
const [messages, setMessages] = useState<Message[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [content, setContent] = useState("");
|
||||
@@ -57,7 +59,7 @@ export function MessageThread({
|
||||
});
|
||||
if (!res.ok) {
|
||||
const err = await res.json().catch(() => ({})) as { error?: string };
|
||||
toast.error(err.error ?? "Failed to send");
|
||||
toast.error(err.error ?? t("sendFailed"));
|
||||
return;
|
||||
}
|
||||
setContent("");
|
||||
@@ -71,9 +73,9 @@ export function MessageThread({
|
||||
<div className="flex flex-col h-full">
|
||||
<div className="flex-1 overflow-y-auto space-y-3 p-4">
|
||||
{loading ? (
|
||||
<p className="text-sm text-muted-foreground">Loading…</p>
|
||||
<p className="text-sm text-muted-foreground">{t("loading")}</p>
|
||||
) : messages.length === 0 ? (
|
||||
<p className="text-sm text-muted-foreground text-center py-8">No messages yet. Say hi!</p>
|
||||
<p className="text-sm text-muted-foreground text-center py-8">{t("noMessagesYet")}</p>
|
||||
) : (
|
||||
messages.map((m) => {
|
||||
const isOwn = m.senderId === currentUserId;
|
||||
@@ -103,7 +105,7 @@ export function MessageThread({
|
||||
void send();
|
||||
}
|
||||
}}
|
||||
placeholder="Type a message…"
|
||||
placeholder={t("placeholder")}
|
||||
rows={1}
|
||||
className="resize-none"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user