From 193bd73af161ec4550e203eb0678d8b3c78641b1 Mon Sep 17 00:00:00 2001 From: Marcel Date: Sun, 5 Apr 2026 22:09:26 +0200 Subject: [PATCH] fix(i18n): translate comment timestamps and edited label MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace hardcoded German strings in CommentThread.timeAgo() with Paraglide i18n keys: comment_time_just_now, comment_time_minutes, comment_time_hours, comment_time_days. Update comment_edited_label from "· bearbeitet" to "(Bearbeitet)" for the new single-timestamp design. All three languages: de/en/es. Co-Authored-By: Claude Sonnet 4.6 --- frontend/messages/de.json | 6 +++++- frontend/messages/en.json | 6 +++++- frontend/messages/es.json | 6 +++++- frontend/src/lib/components/CommentThread.svelte | 10 +++++----- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/frontend/messages/de.json b/frontend/messages/de.json index 72b07b37..e78993f7 100644 --- a/frontend/messages/de.json +++ b/frontend/messages/de.json @@ -318,7 +318,11 @@ "comment_placeholder": "Kommentar schreiben…", "comment_btn_post": "Senden", "comment_btn_reply": "Antworten", - "comment_edited_label": "· bearbeitet", + "comment_edited_label": "(Bearbeitet)", + "comment_time_just_now": "gerade eben", + "comment_time_minutes": "vor {count} Minute(n)", + "comment_time_hours": "vor {count} Stunde(n)", + "comment_time_days": "vor {count} Tag(en)", "comment_panel_title": "Kommentare", "comment_panel_close": "Schließen", "doc_panel_tab_metadata": "Metadaten", diff --git a/frontend/messages/en.json b/frontend/messages/en.json index e9780c21..63158327 100644 --- a/frontend/messages/en.json +++ b/frontend/messages/en.json @@ -318,7 +318,11 @@ "comment_placeholder": "Write a comment…", "comment_btn_post": "Send", "comment_btn_reply": "Reply", - "comment_edited_label": "· edited", + "comment_edited_label": "(Edited)", + "comment_time_just_now": "just now", + "comment_time_minutes": "{count} minute(s) ago", + "comment_time_hours": "{count} hour(s) ago", + "comment_time_days": "{count} day(s) ago", "comment_panel_title": "Comments", "comment_panel_close": "Close", "doc_panel_tab_metadata": "Metadata", diff --git a/frontend/messages/es.json b/frontend/messages/es.json index b199fb3e..f5e7c4cf 100644 --- a/frontend/messages/es.json +++ b/frontend/messages/es.json @@ -318,7 +318,11 @@ "comment_placeholder": "Escribe un comentario…", "comment_btn_post": "Enviar", "comment_btn_reply": "Responder", - "comment_edited_label": "· editado", + "comment_edited_label": "(Editado)", + "comment_time_just_now": "justo ahora", + "comment_time_minutes": "hace {count} minuto(s)", + "comment_time_hours": "hace {count} hora(s)", + "comment_time_days": "hace {count} día(s)", "comment_panel_title": "Comentarios", "comment_panel_close": "Cerrar", "doc_panel_tab_metadata": "Metadatos", diff --git a/frontend/src/lib/components/CommentThread.svelte b/frontend/src/lib/components/CommentThread.svelte index 7591f7f3..4a1a4b13 100644 --- a/frontend/src/lib/components/CommentThread.svelte +++ b/frontend/src/lib/components/CommentThread.svelte @@ -66,12 +66,12 @@ $effect(() => { function timeAgo(iso: string): string { const diff = Date.now() - new Date(iso).getTime(); const minutes = Math.floor(diff / 60000); - if (minutes < 1) return 'gerade eben'; - if (minutes < 60) return `vor ${minutes} Minute${minutes === 1 ? '' : 'n'}`; + if (minutes < 1) return m.comment_time_just_now(); + if (minutes < 60) return m.comment_time_minutes({ count: minutes }); const hours = Math.floor(minutes / 60); - if (hours < 24) return `vor ${hours} Stunde${hours === 1 ? '' : 'n'}`; + if (hours < 24) return m.comment_time_hours({ count: hours }); const days = Math.floor(hours / 24); - return `vor ${days} Tag${days === 1 ? '' : 'en'}`; + return m.comment_time_days({ count: days }); } function wasEdited(c: { createdAt: string; updatedAt: string }): boolean { @@ -261,7 +261,7 @@ onMount(async () => { {comment.authorName} {#if wasEdited(comment)} {timeAgo(comment.updatedAt)} (Bearbeitet){timeAgo(comment.updatedAt)} {m.comment_edited_label()} {:else} {timeAgo(comment.createdAt)}