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:
@@ -3,11 +3,13 @@
|
||||
import { useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { toast } from "sonner";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { MessageCircle } from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
export function MessageButton({ targetUsername }: { targetUsername: string }) {
|
||||
const router = useRouter();
|
||||
const t = useTranslations("messages");
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
async function startConversation() {
|
||||
@@ -20,7 +22,7 @@ export function MessageButton({ targetUsername }: { targetUsername: string }) {
|
||||
});
|
||||
if (!res.ok) {
|
||||
const err = await res.json() as { error?: string };
|
||||
toast.error(err.error ?? "Failed to start conversation");
|
||||
toast.error(err.error ?? t("startConversationFailed"));
|
||||
return;
|
||||
}
|
||||
const { conversationId } = await res.json() as { conversationId: string };
|
||||
@@ -33,7 +35,7 @@ export function MessageButton({ targetUsername }: { targetUsername: string }) {
|
||||
return (
|
||||
<Button variant="outline" size="sm" onClick={() => { void startConversation(); }} disabled={loading}>
|
||||
<MessageCircle className="h-3.5 w-3.5" />
|
||||
Message
|
||||
{t("messageButton")}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user