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:
@@ -36,13 +36,13 @@ const TYPE_ICON: Record<Drink["type"], React.ElementType> = {
|
||||
hot: Coffee,
|
||||
};
|
||||
|
||||
const TYPE_LABEL: Record<Drink["type"], string> = {
|
||||
wine: "Wine",
|
||||
beer: "Beer",
|
||||
cocktail: "Cocktail",
|
||||
spirit: "Spirit",
|
||||
"non-alcoholic": "Sans alcool",
|
||||
hot: "Chaud",
|
||||
const TYPE_LABEL_KEY: Record<Drink["type"], string> = {
|
||||
wine: "drinksTypeWine",
|
||||
beer: "drinksTypeBeer",
|
||||
cocktail: "drinksTypeCocktail",
|
||||
spirit: "drinksTypeSpirit",
|
||||
"non-alcoholic": "drinksTypeNonAlcoholic",
|
||||
hot: "drinksTypeHot",
|
||||
};
|
||||
|
||||
export function DrinkPairingButton({ recipeId }: { recipeId: string }) {
|
||||
@@ -61,7 +61,7 @@ export function DrinkPairingButton({ recipeId }: { recipeId: string }) {
|
||||
body: JSON.stringify({ count: 4 }),
|
||||
});
|
||||
if (!res.ok) {
|
||||
toast.error("Failed to suggest drinks");
|
||||
toast.error(t("pairingDrinkFailed"));
|
||||
return;
|
||||
}
|
||||
const data = await res.json() as { drinks: Drink[] };
|
||||
@@ -94,22 +94,22 @@ export function DrinkPairingButton({ recipeId }: { recipeId: string }) {
|
||||
<DialogHeader>
|
||||
<DialogTitle className="flex items-center gap-2">
|
||||
<Wine className="h-5 w-5 text-primary" />
|
||||
Drink pairings
|
||||
{t("drinksDialogTitle")}
|
||||
</DialogTitle>
|
||||
<DialogDescription>
|
||||
AI-suggested drinks that complement this recipe.
|
||||
{t("drinksDialogDescription")}
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
{loading ? (
|
||||
<div className="py-6 space-y-3">
|
||||
<FakeProgressBar active={loading} durationMs={8000} label="Finding perfect pairings…" />
|
||||
<FakeProgressBar active={loading} durationMs={8000} label={t("pairingFindingLabel")} />
|
||||
</div>
|
||||
) : drinks.length === 0 ? (
|
||||
<div className="flex flex-col items-center gap-4 py-8">
|
||||
<Button onClick={suggest} size="lg">
|
||||
<Sparkles className="h-4 w-4" />
|
||||
Suggest drinks
|
||||
{t("drinksSuggestButton")}
|
||||
</Button>
|
||||
</div>
|
||||
) : (
|
||||
@@ -125,18 +125,18 @@ export function DrinkPairingButton({ recipeId }: { recipeId: string }) {
|
||||
<div className="flex-1 min-w-0 space-y-1.5">
|
||||
<div className="flex items-center gap-2 flex-wrap">
|
||||
<span className="font-semibold">{drink.name}</span>
|
||||
<Badge variant="outline" className="text-xs">{TYPE_LABEL[drink.type]}</Badge>
|
||||
<Badge variant="outline" className="text-xs">{t(TYPE_LABEL_KEY[drink.type])}</Badge>
|
||||
{!drink.alcoholic && (
|
||||
<Badge variant="secondary" className="text-xs flex items-center gap-1">
|
||||
<Leaf className="h-2.5 w-2.5" />
|
||||
Sans alcool
|
||||
{t("drinksTypeNonAlcoholic")}
|
||||
</Badge>
|
||||
)}
|
||||
</div>
|
||||
<p className="text-sm text-muted-foreground">{drink.description}</p>
|
||||
{drink.examples.length > 0 && (
|
||||
<p className="text-xs text-muted-foreground">
|
||||
<span className="font-medium">e.g. </span>
|
||||
<span className="font-medium">{t("drinksExamplesLabel")} </span>
|
||||
{drink.examples.join(" · ")}
|
||||
</p>
|
||||
)}
|
||||
@@ -153,7 +153,7 @@ export function DrinkPairingButton({ recipeId }: { recipeId: string }) {
|
||||
|
||||
<Button variant="ghost" className="w-full" onClick={suggest} disabled={loading}>
|
||||
<Sparkles className="h-4 w-4" />
|
||||
Regenerate
|
||||
{t("pairingRegenerate")}
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user