feat(frontend): add PL/EN i18n using @inlang/paraglide-js v2

- Install @inlang/paraglide-js v2 with Vite plugin and paraglideMiddleware hook
- Add messages/pl.json and messages/en.json with ~400 translation keys
- Create project.inlang/settings.json (PL as base locale)
- Add LanguageSwitcher component (cookie-based, no URL prefix needed)
- Replace all hardcoded strings across 14 pages/components with m.*() calls
- ProductForm uses derived label maps for all enum types (category, texture, etc.)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Piotr Oleszczyk 2026-03-01 13:20:34 +01:00
parent 9524e4df54
commit 99584521a1
22 changed files with 1742 additions and 612 deletions

View file

@ -1,6 +1,7 @@
<script lang="ts">
import { enhance } from '$app/forms';
import type { ActionData, PageData } from './$types';
import { m } from '$lib/paraglide/messages.js';
import { Button } from '$lib/components/ui/button';
import { Input } from '$lib/components/ui/input';
import { Label } from '$lib/components/ui/label';
@ -11,12 +12,12 @@
let partOfDay = $state('am');
</script>
<svelte:head><title>New Routine — innercontext</title></svelte:head>
<svelte:head><title>{m["routines_newTitle"]()} — innercontext</title></svelte:head>
<div class="max-w-md space-y-6">
<div class="flex items-center gap-4">
<a href="/routines" class="text-sm text-muted-foreground hover:underline">← Routines</a>
<h2 class="text-2xl font-bold tracking-tight">New Routine</h2>
<a href="/routines" class="text-sm text-muted-foreground hover:underline">{m["routines_backToList"]()}</a>
<h2 class="text-2xl font-bold tracking-tight">{m["routines_newTitle"]()}</h2>
</div>
{#if form?.error}
@ -24,16 +25,16 @@
{/if}
<Card>
<CardHeader><CardTitle>Routine details</CardTitle></CardHeader>
<CardHeader><CardTitle>{m["routines_detailsTitle"]()}</CardTitle></CardHeader>
<CardContent>
<form method="POST" use:enhance class="space-y-5">
<div class="space-y-2">
<Label for="routine_date">Date *</Label>
<Label for="routine_date">{m.routines_date()}</Label>
<Input id="routine_date" name="routine_date" type="date" value={data.today} required />
</div>
<div class="space-y-2">
<Label>AM or PM *</Label>
<Label>{m["routines_amOrPm"]()}</Label>
<input type="hidden" name="part_of_day" value={partOfDay} />
<Select type="single" value={partOfDay} onValueChange={(v) => (partOfDay = v)}>
<SelectTrigger>{partOfDay.toUpperCase()}</SelectTrigger>
@ -45,13 +46,13 @@
</div>
<div class="space-y-2">
<Label for="notes">Notes</Label>
<Input id="notes" name="notes" placeholder="Optional notes" />
<Label for="notes">{m.routines_notes()}</Label>
<Input id="notes" name="notes" placeholder={m["routines_notesPlaceholder"]()} />
</div>
<div class="flex gap-3 pt-2">
<Button type="submit">Create routine</Button>
<Button variant="outline" href="/routines">Cancel</Button>
<Button type="submit">{m["routines_createRoutine"]()}</Button>
<Button variant="outline" href="/routines">{m.common_cancel()}</Button>
</div>
</form>
</CardContent>