From 3abcbd4f4d3d3f044584976bc2cacfa11ef83326 Mon Sep 17 00:00:00 2001 From: Till JS Date: Mon, 27 Apr 2026 18:23:29 +0200 Subject: [PATCH] i18n(wetter+profile+contacts): translate 3 detail/freeform/comparison views via $_() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - wetter/components/SourceComparison: route through wetter.comparison.* (also fixes pre-existing typos verfuegbar/Gefuehlt → verfügbar/gefühlt via proper translations across all 5 locales). Renamed unused #each param `_` → `_ignored` to avoid shadowing svelte-i18n's $_. - profile/ContextFreeform: route through profile.freeform.*; injected markdown source label uses i18n key too - contacts/[id]/+page: route through contacts.detail.*; replaces typoed "endgueltig loeschen"/"geloescht"/"Loeschen"/"Zurueck"/"E-Mail-Mobil" fallbacks with proper umlauted translations. Drop unused Observable import. Baseline 940 → 920 (-20). --- .../modules/profile/ContextFreeform.svelte | 60 +++++++++------ .../wetter/components/SourceComparison.svelte | 36 ++++----- .../routes/(app)/contacts/[id]/+page.svelte | 73 ++++++++++++------- scripts/i18n-hardcoded-baseline.json | 4 +- 4 files changed, 104 insertions(+), 69 deletions(-) diff --git a/apps/mana/apps/web/src/lib/modules/profile/ContextFreeform.svelte b/apps/mana/apps/web/src/lib/modules/profile/ContextFreeform.svelte index ae9322816..b5d5c77aa 100644 --- a/apps/mana/apps/web/src/lib/modules/profile/ContextFreeform.svelte +++ b/apps/mana/apps/web/src/lib/modules/profile/ContextFreeform.svelte @@ -9,8 +9,8 @@ import { PencilSimple, Eye, LinkSimple, X } from '@mana/shared-icons'; import { crawlUrlViaApi, type CrawlMode } from '$lib/modules/kontext/api'; import { requireAuth } from '$lib/auth/require-auth.svelte'; + import { _ } from 'svelte-i18n'; - const PLACEHOLDER = 'Was soll Mana sonst noch über dich wissen?'; const SAVE_DEBOUNCE_MS = 500; let urlPanelOpen = $state(false); @@ -95,7 +95,7 @@ if (!trimmed) return; const ok = await requireAuth({ feature: 'context-url-import', - reason: 'Das Crawlen einer Web-Seite läuft serverseitig und erfordert ein Mana-Konto.', + reason: $_('profile.freeform.auth_reason_crawl'), }); if (!ok) return; importing = true; @@ -123,12 +123,13 @@ }); if (phaseTimer) clearTimeout(phaseTimer); importPhase = 'appending'; - const header = `## ${result.title}\n\n_Quelle: ${result.sourceUrl}_\n\n`; + const sourceLabel = $_('profile.freeform.crawl_source_label'); + const header = `## ${result.title}\n\n_${sourceLabel}: ${result.sourceUrl}_\n\n`; await userContextStore.appendFreeform(header + result.content); if (mode === 'edit' && ctx) draft = ctx.freeform; closeUrlPanel(); } catch (err) { - importError = err instanceof Error ? err.message : 'Import fehlgeschlagen'; + importError = err instanceof Error ? err.message : $_('profile.freeform.error_import_failed'); } finally { if (phaseTimer) clearTimeout(phaseTimer); clearInterval(tick); @@ -152,21 +153,29 @@
- {#if saveState === 'pending'}Speichert… - {:else if saveState === 'saved'}Gespeichert{/if} + {#if saveState === 'pending'}{$_('profile.freeform.saving')} + {:else if saveState === 'saved'}{$_('profile.freeform.saved')}{/if}
-
@@ -178,37 +187,40 @@ type="url" bind:value={importUrl} required - placeholder="https://example.com/article" + placeholder={$_('profile.freeform.url_placeholder')} disabled={importing} class="url-input" />
+ {$_('profile.freeform.option_single')} + {$_('profile.freeform.option_deep')} · + {$_('profile.freeform.option_summarize')}
{#if importError}

{importError}

{/if} @@ -221,14 +233,16 @@ bind:value={draft} oninput={scheduleSave} onblur={flush} - placeholder={PLACEHOLDER} + placeholder={$_('profile.freeform.placeholder')} > {:else if renderedHtml}
{@html renderedHtml}
{:else} {$_('profile.freeform.placeholder')}{$_('profile.freeform.empty_hint')} {/if} diff --git a/apps/mana/apps/web/src/lib/modules/wetter/components/SourceComparison.svelte b/apps/mana/apps/web/src/lib/modules/wetter/components/SourceComparison.svelte index 9c44d8103..550764260 100644 --- a/apps/mana/apps/web/src/lib/modules/wetter/components/SourceComparison.svelte +++ b/apps/mana/apps/web/src/lib/modules/wetter/components/SourceComparison.svelte @@ -5,8 +5,9 @@ --> - {contact ? getDisplayName(contact) : 'Kontakt'} - Mana + {$_('contacts.detail.page_title_html', { + values: { + name: contact ? getDisplayName(contact) : $_('contacts.detail.page_title_fallback'), + }, + })} - +
- Kontakte + {$_('contacts.detail.breadcrumb')} {#if !contact}
-

Kontakt nicht gefunden

+

+ {$_('contacts.detail.empty_title')} +

- Dieser Kontakt existiert nicht oder wurde geloescht. + {$_('contacts.detail.empty_hint')}

- Zurueck zu Kontakten + {$_('contacts.detail.empty_back')}
{:else} @@ -179,7 +189,7 @@ @@ -193,7 +203,9 @@ @@ -448,7 +460,8 @@ href="tel:{contact.phone}" class="flex items-center gap-1.5 rounded-lg border border-border px-3 py-2 text-sm font-medium text-foreground transition-colors hover:bg-muted" > - Anrufen + + {$_('contacts.detail.quick_call')} {/if} {#if contact.email} @@ -456,7 +469,8 @@ href="mailto:{contact.email}" class="flex items-center gap-1.5 rounded-lg border border-border px-3 py-2 text-sm font-medium text-foreground transition-colors hover:bg-muted" > - E-Mail + + {$_('contacts.detail.quick_email')} {/if} {#if contact.mobile} @@ -464,7 +478,8 @@ href="sms:{contact.mobile}" class="flex items-center gap-1.5 rounded-lg border border-border px-3 py-2 text-sm font-medium text-foreground transition-colors hover:bg-muted" > - SMS + + {$_('contacts.detail.quick_sms')} {/if}
@@ -475,7 +490,7 @@

- Kontakt + {$_('contacts.detail.section_contact')}

{#if contact.email} @@ -492,7 +507,9 @@ {contact.mobile} - Mobil + {$_('contacts.detail.label_mobile')}
{/if} {#if contact.phone} @@ -501,12 +518,16 @@ {contact.phone} - Telefon + {$_('contacts.detail.label_phone')}
{/if} {#if !contact.email && !contact.phone && !contact.mobile} -

Keine Kontaktdaten hinterlegt.

+

+ {$_('contacts.detail.empty_contact_info')} +

{/if} @@ -514,7 +535,7 @@ {#if contact.company || contact.jobTitle || contact.website}

- Arbeit + {$_('contacts.detail.section_work')}

{#if contact.company} @@ -550,7 +571,7 @@ {#if contact.street || contact.city || contact.postalCode || contact.country}

- Adresse + {$_('contacts.detail.section_address')}

@@ -585,7 +606,7 @@ {#if contact.notes}

- Notizen + {$_('contacts.detail.section_notes')}

{contact.notes}

@@ -595,7 +616,7 @@ {#if contact.linkedin || contact.twitter || contact.instagram || contact.github}

- Social Media + {$_('contacts.detail.section_social')}

{#if contact.linkedin} @@ -658,7 +679,7 @@ {#if contact.tags.length > 0}

- Tags + {$_('contacts.detail.section_tags')}

{#each contact.tags as tag (tag.id)} @@ -674,7 +695,7 @@
- Erstellt + {$_('contacts.detail.meta_created')} {formatDate(new Date(contact.createdAt), { day: 'numeric', @@ -682,7 +703,7 @@ year: 'numeric', })} - Aktualisiert + {$_('contacts.detail.meta_updated')} {formatDate(new Date(contact.updatedAt), { day: 'numeric', diff --git a/scripts/i18n-hardcoded-baseline.json b/scripts/i18n-hardcoded-baseline.json index d58796609..e430c6a7f 100644 --- a/scripts/i18n-hardcoded-baseline.json +++ b/scripts/i18n-hardcoded-baseline.json @@ -149,7 +149,6 @@ "apps/mana/apps/web/src/lib/modules/presi/views/DetailView.svelte": 4, "apps/mana/apps/web/src/lib/modules/profile/components/MeImageSlotCard.svelte": 3, "apps/mana/apps/web/src/lib/modules/profile/components/MeImageTile.svelte": 3, - "apps/mana/apps/web/src/lib/modules/profile/ContextFreeform.svelte": 7, "apps/mana/apps/web/src/lib/modules/profile/ContextInterview.svelte": 6, "apps/mana/apps/web/src/lib/modules/profile/ListView.svelte": 6, "apps/mana/apps/web/src/lib/modules/profile/MeImagesView.svelte": 2, @@ -189,7 +188,6 @@ "apps/mana/apps/web/src/lib/modules/wetter/components/HourlyForecast.svelte": 1, "apps/mana/apps/web/src/lib/modules/wetter/components/LocationPicker.svelte": 5, "apps/mana/apps/web/src/lib/modules/wetter/components/NowcastBar.svelte": 1, - "apps/mana/apps/web/src/lib/modules/wetter/components/SourceComparison.svelte": 7, "apps/mana/apps/web/src/lib/modules/wetter/components/WeatherAlerts.svelte": 1, "apps/mana/apps/web/src/lib/modules/wetter/ListView.svelte": 2, "apps/mana/apps/web/src/lib/modules/who/ListView.svelte": 5, @@ -215,7 +213,7 @@ "apps/mana/apps/web/src/routes/(app)/citycorners/cities/[slug]/+layout.svelte": 1, "apps/mana/apps/web/src/routes/(app)/comic/new/+page.svelte": 1, "apps/mana/apps/web/src/routes/(app)/companion/+page.svelte": 2, - "apps/mana/apps/web/src/routes/(app)/contacts/[id]/+page.svelte": 7, + "apps/mana/apps/web/src/routes/(app)/contacts/[id]/+page.svelte": 1, "apps/mana/apps/web/src/routes/(app)/context/documents/[id]/+page.svelte": 3, "apps/mana/apps/web/src/routes/(app)/context/documents/+page.svelte": 5, "apps/mana/apps/web/src/routes/(app)/context/spaces/[id]/+page.svelte": 3,