diff --git a/src/lib/components/CommentCountBadge.svelte b/src/lib/components/CommentCountBadge.svelte index 60cec46..903c296 100644 --- a/src/lib/components/CommentCountBadge.svelte +++ b/src/lib/components/CommentCountBadge.svelte @@ -2,6 +2,9 @@ import Icon from "@iconify/svelte"; import "$lib/iconify-offline"; import { env } from "$env/dynamic/public"; + import { useTranslate, T } from "$lib/translations"; + + const t = useTranslate(); let { pageId, @@ -54,7 +57,7 @@ diff --git a/src/lib/components/Comments.svelte b/src/lib/components/Comments.svelte index fb07816..0446682 100644 --- a/src/lib/components/Comments.svelte +++ b/src/lib/components/Comments.svelte @@ -2,6 +2,7 @@ import Icon from "@iconify/svelte"; import "$lib/iconify-offline"; import { env } from "$env/dynamic/public"; + import { useTranslate, T } from "$lib/translations"; let { pageId, @@ -15,6 +16,8 @@ bodyMax?: number; } = $props(); + const t = useTranslate(); + type Status = "approved" | "pending" | "spam"; type PublicComment = { @@ -187,7 +190,7 @@ } async function deleteComment(id: string) { - if (!confirm("Kommentar löschen?")) return; + if (!confirm(t(T.comments_confirm_delete))) return; try { const r = await fetch(`${apiUrl()}`.replace(`/${pageId}`, `/${pageId}/${id}`), { method: "DELETE", @@ -310,12 +313,12 @@ + >{t(T.comments_save)} + >{t(T.comments_cancel)} {editBody.length} / {bodyMax} {#if editError}

{editError}

{/if} @@ -330,7 +333,7 @@ class="text-xs text-zinc-600 hover:text-zinc-900 inline-flex items-center gap-1" > - Bearbeiten + {t(T.comments_edit)} {/if} @@ -349,7 +352,7 @@
{c.author} {#if c.can_edit} - du + {t(T.comments_self_marker)} {/if} {#if c.updated_at} - (bearbeitet) + {t(T.comments_edited)} {/if} {#if c.status === "pending"} - wartet + {t(T.comments_pending_short)} {/if}
@@ -370,7 +373,7 @@
{#if loading && comments.length === 0} -
    +
      {#each Array(2) as _, i (i)}
    • @@ -386,20 +389,20 @@
      -

      Kommentare konnten nicht geladen werden.

      +

      {t(T.comments_load_error_title)}

      {loadError}

      + >{t(T.comments_retry)}
      {:else} {#if topLevel.length === 0}
      -

      Noch keine Kommentare. Sei der erste.

      +

      {t(T.comments_empty)}

      {:else}
        @@ -423,10 +426,12 @@ > {replyTo === c.id - ? "Abbrechen" - : replies.length > 0 - ? `${replies.length} ${replies.length === 1 ? 'Antwort' : 'Antworten'}` - : "Antworten"} + ? t(T.comments_cancel) + : replies.length === 0 + ? t(T.comments_reply) + : replies.length === 1 + ? t(T.comments_reply_count_one) + : t(T.comments_reply_count_other, { count: replies.length })}
@@ -435,7 +440,7 @@ Antwort senden + >{t(T.comments_reply_send)} {replyBody.length} / {bodyMax} @@ -486,11 +491,11 @@ {/if}
-

Kommentar schreiben

+

{t(T.comments_form_title)}

- {submitting ? "Sende …" : "Senden"} + {submitting ? t(T.comments_sending) : t(T.comments_send)} {#if requireApproval} - Wird vor Veröffentlichung geprüft. + {t(T.comments_approval_hint)} {/if} {body.length} / {bodyMax} {#if totalPending > 0}

- {totalPending} {totalPending === 1 ? 'Kommentar wartet' : 'Kommentare warten'} noch auf Freigabe (nur für dich sichtbar). + {totalPending === 1 + ? t(T.comments_pending_summary_one) + : t(T.comments_pending_summary_other, { count: totalPending })}

{/if}
diff --git a/src/lib/components/PostCard.svelte b/src/lib/components/PostCard.svelte index 32a08eb..9a43477 100644 --- a/src/lib/components/PostCard.svelte +++ b/src/lib/components/PostCard.svelte @@ -6,6 +6,9 @@ import EventBadges from "./EventBadges.svelte"; import RustyImage from "./RustyImage.svelte"; import Card from "./Card.svelte"; + import { useTranslate, T } from "$lib/translations"; + + const t = useTranslate(); type PostWithImage = PostEntry & { _resolvedImageUrl?: string; @@ -98,8 +101,8 @@
{commentCount} diff --git a/src/lib/translations.ts b/src/lib/translations.ts index 303dc2d..66dcaa9 100644 --- a/src/lib/translations.ts +++ b/src/lib/translations.ts @@ -133,6 +133,35 @@ const TRANSLATION_KEYS = [ "post_map_activate", "post_map_open_osm", "post_comments", + // Comment plugin (Comments.svelte / PostCard count pill / CommentCountBadge). + "comments_loading", + "comments_load_error_title", + "comments_retry", + "comments_empty", + "comments_edit", + "comments_delete", + "comments_save", + "comments_cancel", + "comments_confirm_delete", + "comments_reply", + "comments_reply_count_one", + "comments_reply_count_other", + "comments_reply_send", + "comments_send", + "comments_sending", + "comments_form_title", + "comments_name_placeholder", + "comments_body_placeholder", + "comments_reply_placeholder", + "comments_approval_hint", + "comments_edited", + "comments_pending_short", + "comments_pending_full", + "comments_self_marker", + "comments_pending_summary_one", + "comments_pending_summary_other", + "comments_count_aria", + "comments_jump_to", ] as const; export type TranslationKey = (typeof TRANSLATION_KEYS)[number];