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
+13 -12
View File
@@ -1,6 +1,7 @@
"use client";
import { useState } from "react";
import { useTranslations } from "next-intl";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Button } from "@/components/ui/button";
@@ -21,6 +22,7 @@ interface NutritionPanelProps {
}
export function NutritionPanel({ recipeId, initialData }: NutritionPanelProps) {
const t = useTranslations("nutritionPanel");
const [nutrition, setNutrition] = useState<NutritionData | null>(initialData ?? null);
const [loading, setLoading] = useState(false);
const [error, setError] = useState<string | null>(null);
@@ -33,13 +35,12 @@ export function NutritionPanel({ recipeId, initialData }: NutritionPanelProps) {
method: "POST",
});
if (!res.ok) {
const body = await res.json() as { error?: string };
throw new Error(body.error ?? "Failed to estimate nutrition");
throw new Error(t("estimateFailed"));
}
const data = await res.json() as { nutrition: NutritionData };
setNutrition(data.nutrition);
} catch (err) {
setError(err instanceof Error ? err.message : "Something went wrong");
setError(err instanceof Error ? err.message : t("error"));
} finally {
setLoading(false);
}
@@ -50,7 +51,7 @@ export function NutritionPanel({ recipeId, initialData }: NutritionPanelProps) {
<div className="flex flex-col gap-2">
{error && <p className="text-sm text-destructive">{error}</p>}
<Button variant="outline" onClick={handleEstimate} disabled={loading}>
Estimate nutrition
{t("estimateButton")}
</Button>
</div>
);
@@ -60,7 +61,7 @@ export function NutritionPanel({ recipeId, initialData }: NutritionPanelProps) {
<Card>
<CardHeader className="pb-3">
<div className="flex items-center justify-between">
<CardTitle className="text-base">Nutrition per serving</CardTitle>
<CardTitle className="text-base">{t("title")}</CardTitle>
<Button
variant="ghost"
size="sm"
@@ -68,7 +69,7 @@ export function NutritionPanel({ recipeId, initialData }: NutritionPanelProps) {
disabled={loading}
className="text-xs text-muted-foreground"
>
{loading ? "Estimating" : "Re-estimate"}
{loading ? t("estimating") : t("reEstimateButton")}
</Button>
</div>
{error && <p className="text-sm text-destructive">{error}</p>}
@@ -84,27 +85,27 @@ export function NutritionPanel({ recipeId, initialData }: NutritionPanelProps) {
</div>
<MacroCell
label="Protein"
label={t("protein")}
value={nutrition.perServing.proteinG}
unit="g"
/>
<MacroCell
label="Carbs"
label={t("carbs")}
value={nutrition.perServing.carbsG}
unit="g"
/>
<MacroCell
label="Fat"
label={t("fat")}
value={nutrition.perServing.fatG}
unit="g"
/>
<MacroCell
label="Fiber"
label={t("fiber")}
value={nutrition.perServing.fiberG}
unit="g"
/>
<MacroCell
label="Sodium"
label={t("sodium")}
value={nutrition.perServing.sodiumMg}
unit="mg"
/>
@@ -114,7 +115,7 @@ export function NutritionPanel({ recipeId, initialData }: NutritionPanelProps) {
{loading && !nutrition && (
<CardContent>
<p className="text-sm text-muted-foreground animate-pulse">
Estimating nutrition
{t("estimatingNutrition")}
</p>
</CardContent>
)}