i18n(recept): steg + täcknings-etiketter spanska, översatta saknade-namn, cache-nyckel

- cooking-skärmen renderade instructionSv (alltid svenska) -> nu instruction ?? instructionSv
- recept-skärmens täckningskort hårdkodade svenska (Du har X% hemma, Saknar N,
  Du saknar, Lägg till i inköpslistan, Tillagt) -> t()-nycklar recipe.coverage.*
- coverage.missing fick översatt displayName i API:t (annars svenska ingrediensnamn)
- 7 nya recipe.coverage.*-nycklar i alla 12 språk
- persister-cache-nyckel -> -v2 (slänger gammal helsvensk cache en gang)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Claude
2026-08-21 00:06:33 +00:00
parent 02d5bc4f73
commit 4e86b1b724
16 changed files with 106 additions and 10 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ const queryClient = new QueryClient({
const persister = createAsyncStoragePersister({
storage: AsyncStorage,
key: `${BRAND.slug}-query-cache`,
key: `${BRAND.slug}-query-cache-v2`,
});
export default function RootLayout() {
+2 -1
View File
@@ -34,6 +34,7 @@ interface RecipeForCooking {
id: string;
stepNumber: number;
instructionSv: string;
instruction?: string;
timerSeconds: number | null;
temperatureC: number | null;
tip: string | null;
@@ -246,7 +247,7 @@ export default function CookingScreen() {
{t("cooking.step", { current: stepIndex + 1, total: recipe.steps.length })}
</Heading>
<Text style={{ fontSize: 24, lineHeight: 34, color: colors.text }}>
{step?.instructionSv}
{step?.instruction ?? step?.instructionSv}
{step?.temperatureC ? ` (${step.temperatureC} °C)` : ""}
</Text>
{step?.tip && <Small>💡 {step.tip}</Small>}
+12 -7
View File
@@ -61,6 +61,7 @@ interface RecipeDetail {
missing: Array<{
canonicalIngredientId: string;
displayNameSv: string;
displayName?: string;
quantity: number;
unit: string;
}>;
@@ -181,8 +182,8 @@ export default function RecipeScreen() {
onSuccess: (count) => {
void queryClient.invalidateQueries({ queryKey: ["shopping-lists"] });
Alert.alert(
"Tillagt i inköpslistan",
`${count} ${count === 1 ? "vara" : "varor"} lades till.`,
t("recipe.coverage.added"),
t("recipe.coverage.addedBody", { count }),
);
},
onError: (err) => {
@@ -263,21 +264,25 @@ export default function RecipeScreen() {
{recipe.coverage && (
<Card>
<Row style={{ justifyContent: "space-between", alignItems: "center" }}>
<Heading>Du har {recipe.coverage.percent}% hemma</Heading>
<Heading>{t("recipe.coverage.have", { percent: recipe.coverage.percent })}</Heading>
{recipe.coverage.missing.length > 0 && (
<Tag label={`Saknar ${recipe.coverage.missing.length}`} tone="warning" />
<Tag label={t("recipe.coverage.missingCount", { count: recipe.coverage.missing.length })} tone="warning" />
)}
</Row>
{recipe.coverage.missing.length === 0 ? (
<Small>Du har allt som behövs.</Small>
<Small>{t("recipe.coverage.haveAll")}</Small>
) : (
<>
<Small>
Du saknar: {recipe.coverage.missing.map((m) => m.displayNameSv).join(", ")}
{t("recipe.coverage.youAreMissing", {
names: recipe.coverage.missing
.map((m) => m.displayName ?? m.displayNameSv)
.join(", "),
})}
</Small>
<Spacer size={spacing.xs} />
<Button
label={`Lägg till ${recipe.coverage.missing.length} i inköpslistan`}
label={t("recipe.coverage.addToList", { count: recipe.coverage.missing.length })}
variant="primary"
loading={addMissing.isPending}
onPress={() => addMissing.mutate(recipe.coverage!.missing)}