feat(#145): internationalise dashboard widget strings (de/en/es)

Replace all hardcoded German strings in dashboard components with
Paraglide translation keys. Date locale uses getLocale() instead
of the hardcoded 'de-DE'.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-03-29 09:57:14 +02:00
parent 08f3f92167
commit c8da2224f8
7 changed files with 48 additions and 12 deletions

View File

@@ -312,5 +312,13 @@
"page_title_persons": "Personen",
"page_title_admin": "Administration",
"page_title_login": "Anmelden",
"page_title_error": "Fehler Familienarchiv"
"page_title_error": "Fehler Familienarchiv",
"dashboard_notifications_heading": "Benachrichtigungen",
"dashboard_notification_mentioned": "erwähnt Sie",
"dashboard_notification_replied": "hat geantwortet",
"dashboard_needs_metadata_heading": "Metadaten fehlen",
"dashboard_needs_metadata_show_all": "Alle anzeigen",
"dashboard_recent_heading": "Zuletzt hinzugefügt",
"dashboard_resume_label": "Zuletzt geöffnet:",
"dashboard_resume_fallback": "Unbekanntes Dokument"
}

View File

@@ -312,5 +312,13 @@
"page_title_persons": "Persons",
"page_title_admin": "Administration",
"page_title_login": "Sign in",
"page_title_error": "Error Family Archive"
"page_title_error": "Error Family Archive",
"dashboard_notifications_heading": "Notifications",
"dashboard_notification_mentioned": "mentioned you",
"dashboard_notification_replied": "replied",
"dashboard_needs_metadata_heading": "Missing Metadata",
"dashboard_needs_metadata_show_all": "Show all",
"dashboard_recent_heading": "Recently Added",
"dashboard_resume_label": "Last opened:",
"dashboard_resume_fallback": "Unknown document"
}

View File

@@ -312,5 +312,13 @@
"page_title_persons": "Personas",
"page_title_admin": "Administración",
"page_title_login": "Iniciar sesión",
"page_title_error": "Error Archivo familiar"
"page_title_error": "Error Archivo familiar",
"dashboard_notifications_heading": "Notificaciones",
"dashboard_notification_mentioned": "te mencionó",
"dashboard_notification_replied": "respondió",
"dashboard_needs_metadata_heading": "Metadatos incompletos",
"dashboard_needs_metadata_show_all": "Ver todos",
"dashboard_recent_heading": "Añadidos recientemente",
"dashboard_resume_label": "Último abierto:",
"dashboard_resume_fallback": "Documento desconocido"
}

View File

@@ -1,4 +1,6 @@
<script lang="ts">
import * as m from '$lib/paraglide/messages.js';
type NotificationDTO = {
id: string;
type: 'REPLY' | 'MENTION';
@@ -18,7 +20,7 @@ let { mentions }: Props = $props();
{#if mentions.length > 0}
<div data-testid="dashboard-mentions" class="rounded-sm border border-line bg-surface p-6">
<h2 class="mb-4 font-sans text-xs font-bold tracking-widest text-gray-400 uppercase">
Benachrichtigungen
{m.dashboard_notifications_heading()}
</h2>
{#each mentions as mention (mention.id)}
<div class="flex items-center gap-3 border-b border-line py-2 last:border-0">
@@ -29,8 +31,10 @@ let { mentions }: Props = $props();
>
{mention.actorName ?? ''}
{#if mention.type === 'MENTION'}<span class="ml-1 font-sans text-xs text-gray-400"
>erwähnt Sie</span
>{:else}<span class="ml-1 font-sans text-xs text-gray-400">hat geantwortet</span>{/if}
>{m.dashboard_notification_mentioned()}</span
>{:else}<span class="ml-1 font-sans text-xs text-gray-400"
>{m.dashboard_notification_replied()}</span
>{/if}
</a>
{:else}
<span class="font-serif text-sm text-ink">{mention.actorName ?? ''}</span>

View File

@@ -1,4 +1,6 @@
<script lang="ts">
import * as m from '$lib/paraglide/messages.js';
type IncompleteDocumentDTO = {
id: string;
title: string;
@@ -14,7 +16,7 @@ let { incompleteDocs }: Props = $props();
{#if incompleteDocs.length > 0}
<div data-testid="dashboard-needs-metadata" class="rounded-sm border border-line bg-surface p-6">
<h2 class="mb-4 font-sans text-xs font-bold tracking-widest text-gray-400 uppercase">
Metadaten fehlen
{m.dashboard_needs_metadata_heading()}
</h2>
{#each incompleteDocs as doc (doc.id)}
<div class="flex items-center border-b border-line py-2 last:border-0">
@@ -27,7 +29,9 @@ let { incompleteDocs }: Props = $props();
</div>
{/each}
<div class="mt-4">
<a href="/enrich" class="font-sans text-xs text-ink-2 hover:text-ink"> Alle anzeigen </a>
<a href="/enrich" class="font-sans text-xs text-ink-2 hover:text-ink"
>{m.dashboard_needs_metadata_show_all()}</a
>
</div>
</div>
{/if}

View File

@@ -1,4 +1,7 @@
<script lang="ts">
import * as m from '$lib/paraglide/messages.js';
import { getLocale } from '$lib/paraglide/runtime.js';
type Document = {
id: string;
title: string;
@@ -13,7 +16,7 @@ interface Props {
let { recentDocs }: Props = $props();
function formatDate(dateStr: string): string {
return new Intl.DateTimeFormat('de-DE', {
return new Intl.DateTimeFormat(getLocale(), {
day: 'numeric',
month: 'long',
year: 'numeric'
@@ -24,7 +27,7 @@ function formatDate(dateStr: string): string {
{#if recentDocs.length > 0}
<div data-testid="dashboard-recent-docs" class="rounded-sm border border-line bg-surface p-6">
<h2 class="mb-4 font-sans text-xs font-bold tracking-widest text-gray-400 uppercase">
Zuletzt hinzugefügt
{m.dashboard_recent_heading()}
</h2>
{#each recentDocs as doc (doc.id)}
<div class="flex items-center justify-between border-b border-line py-2 last:border-0">

View File

@@ -1,5 +1,6 @@
<script lang="ts">
import { onMount } from 'svelte';
import * as m from '$lib/paraglide/messages.js';
interface LastVisited {
id: string;
@@ -28,9 +29,9 @@ onMount(() => {
data-testid="resume-strip"
class="flex items-center gap-2 rounded-sm border border-line bg-surface px-4 py-3 font-sans text-sm"
>
<span class="text-ink-2">Zuletzt geöffnet:</span>
<span class="text-ink-2">{m.dashboard_resume_label()}</span>
<a href="/documents/{lastVisited.id}" class="font-medium text-ink hover:underline">
{lastVisited.title || 'Zuletzt geöffnet'}
{lastVisited.title || m.dashboard_resume_fallback()}
</a>
</div>
{/if}