feat: retry-failed-translations + kok-läget på rätt språk (titel, ingredienser, valfritt)

- retry-failed-translations.ts: kör om de receptöversättningar som föll på
  verifieringen (skriver ut vilka + varför, köar TRANSLATE_RECIPE på nytt).
  Idempotent; kör tills listan är tom, publicera sedan.
- Kok-läget (cooking/[id].tsx) visade svensk titel + svenska ingrediensnamn fast
  detalj-API:t redan levererar översatta fält. Nu title/displayName med svensk
  fallback (stegen var redan översatta).
- "(valfritt)" var hårdkodat i kok-läget + recept-detaljen -> ny nyckel
  recipe.optional i alla 12 språk. Vakt + typecheck gröna.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Claude
2026-08-21 18:49:34 +00:00
parent fbb251ea72
commit 52bd6e74bd
15 changed files with 117 additions and 6 deletions
+7 -5
View File
@@ -29,6 +29,7 @@ import { formatQuantity } from "@/lib/units";
interface RecipeForCooking {
id: string;
titleSv: string;
title?: string;
portions: number;
steps: Array<{
id: string;
@@ -42,6 +43,7 @@ interface RecipeForCooking {
ingredients: Array<{
id: string;
displayNameSv: string;
displayName?: string;
quantity: number;
unit: string;
optional: boolean;
@@ -110,7 +112,7 @@ export default function CookingScreen() {
<Screen>
<Card>
<Heading> {t("cooked.title")}</Heading>
<Body>{recipe.titleSv}</Body>
<Body>{recipe.title ?? recipe.titleSv}</Body>
<Small>
{t("cooked.portionsCooked")}: {portionsCooked}
</Small>
@@ -140,7 +142,7 @@ export default function CookingScreen() {
<Screen>
<Heading>{t("cooked.title")}</Heading>
<Card>
<Body>{recipe.titleSv}</Body>
<Body>{recipe.title ?? recipe.titleSv}</Body>
<Small>
{t("cooked.portionsCooked")}: {portionsCooked}
</Small>
@@ -242,7 +244,7 @@ export default function CookingScreen() {
<Screen scroll={false} style={{ justifyContent: "space-between" }}>
<View style={{ gap: spacing.md }}>
<Button label={t("common.cancel")} variant="ghost" onPress={() => router.dismissAll()} />
<Small>{recipe.titleSv}</Small>
<Small>{recipe.title ?? recipe.titleSv}</Small>
<Heading>
{t("cooking.step", { current: stepIndex + 1, total: recipe.steps.length })}
</Heading>
@@ -275,8 +277,8 @@ export default function CookingScreen() {
return (
<Row key={ing.id} style={{ justifyContent: "space-between" }}>
<Body>
{ing.displayNameSv}
{ing.optional ? " (valfritt)" : ""}
{ing.displayName ?? ing.displayNameSv}
{ing.optional ? ` ${t("recipe.optional")}` : ""}
</Body>
<Small>{formatQuantity(scaledQty, ing.unit)}</Small>
</Row>
+1 -1
View File
@@ -316,7 +316,7 @@ export default function RecipeScreen() {
>
<Body>
{ing.displayName ?? ing.displayNameSv}
{ing.optional ? " (valfritt)" : ""}
{ing.optional ? ` ${t("recipe.optional")}` : ""}
</Body>
<Small>{formatQuantity(ing.quantity, ing.unit)}</Small>
</Row>