fix: translate dietary tags, recipe tags form, edit title, nutrition bar (v0.27.2)
These were hardcoded English strings ignoring app locale: DietaryTagPicker, the recipe tag-input label/placeholder/help/aria-label, the Edit recipe page heading, and WeeklyNutritionBar's labels/messages. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { useTranslations } from "next-intl";
|
||||
|
||||
type NutritionTotals = {
|
||||
calories: number;
|
||||
@@ -45,6 +46,7 @@ type BarItem = {
|
||||
};
|
||||
|
||||
export function WeeklyNutritionBar({ weekStart }: WeeklyNutritionBarProps) {
|
||||
const t = useTranslations("mealPlan.nutritionBar");
|
||||
const [data, setData] = useState<NutritionResponse | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -60,7 +62,7 @@ export function WeeklyNutritionBar({ weekStart }: WeeklyNutritionBarProps) {
|
||||
|
||||
const bars: BarItem[] = [
|
||||
{
|
||||
label: "Calories",
|
||||
label: t("calories"),
|
||||
value: dailyAverage.calories,
|
||||
goal: goals.caloriesKcal,
|
||||
unit: "kcal",
|
||||
@@ -68,7 +70,7 @@ export function WeeklyNutritionBar({ weekStart }: WeeklyNutritionBarProps) {
|
||||
colorClass: "bg-orange-500",
|
||||
},
|
||||
{
|
||||
label: "Protein",
|
||||
label: t("protein"),
|
||||
value: dailyAverage.protein,
|
||||
goal: goals.proteinG,
|
||||
unit: "g",
|
||||
@@ -76,7 +78,7 @@ export function WeeklyNutritionBar({ weekStart }: WeeklyNutritionBarProps) {
|
||||
colorClass: "bg-blue-500",
|
||||
},
|
||||
{
|
||||
label: "Carbs",
|
||||
label: t("carbs"),
|
||||
value: dailyAverage.carbs,
|
||||
goal: goals.carbsG,
|
||||
unit: "g",
|
||||
@@ -84,7 +86,7 @@ export function WeeklyNutritionBar({ weekStart }: WeeklyNutritionBarProps) {
|
||||
colorClass: "bg-green-500",
|
||||
},
|
||||
{
|
||||
label: "Fat",
|
||||
label: t("fat"),
|
||||
value: dailyAverage.fat,
|
||||
goal: goals.fatG,
|
||||
unit: "g",
|
||||
@@ -95,7 +97,7 @@ export function WeeklyNutritionBar({ weekStart }: WeeklyNutritionBarProps) {
|
||||
|
||||
return (
|
||||
<div className="space-y-3">
|
||||
<p className="text-xs text-muted-foreground">Daily average vs. your goals</p>
|
||||
<p className="text-xs text-muted-foreground">{t("dailyAverageVsGoals")}</p>
|
||||
{bars.map((bar) => {
|
||||
if (bar.goal == null) return null;
|
||||
const width = Math.min(bar.percentage, 100);
|
||||
@@ -118,7 +120,7 @@ export function WeeklyNutritionBar({ weekStart }: WeeklyNutritionBarProps) {
|
||||
})}
|
||||
{unknownCount > 0 && (
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{unknownCount} planned {unknownCount === 1 ? "meal" : "meals"} missing nutrition data — estimate it from the recipe page for a more accurate picture.
|
||||
{t(unknownCount === 1 ? "missingDataSingular" : "missingDataPlural", { count: unknownCount })}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user