i18n: localize comments

This commit is contained in:
Xylight committed 2024-06-03 16:38:24 -07:00
1 parent 1d5b4d4390
commit a421093a23
3 files changed
+25 -10

No files matched your search

@@ -22,6 +22,7 @@
import ShieldIcon from '../moderation/ShieldIcon.svelte'
import { page } from '$app/stores'
import { onMount } from 'svelte'
import { t } from '$lib/translations'
export let node: CommentNodeI
export let postId: number
@@ -145,7 +146,7 @@
src={Trash}
solid
size="12"
title="Deleted"
title={$t('post.badges.deleted')}
class="text-red-600 dark:text-red-500"
/>
{/if}
@@ -154,7 +155,7 @@
src={Bookmark}
solid
size="12"
title="Saved"
title={$t('post.badges.saved')}
class="text-yellow-600 dark:text-yellow-500"
/>
{/if}
@@ -181,7 +182,7 @@
<div
class="max-w-full my-2 border-l border-slate-200 dark:border-zinc-800 pl-4"
>
<h1 class="font-bold text-sm mb-2">Reply</h1>
<h1 class="font-bold text-sm mb-2">{$t('comment.reply')}</h1>
<CommentForm
{postId}
parentId={node.comment_view.comment.id}
@@ -23,6 +23,7 @@
import { profile } from '$lib/auth.js'
import { deleteItem, save } from '$lib/lemmy/contentview.js'
import { Button, Menu, MenuButton, MenuDivider } from 'mono-svelte'
import { t } from '$lib/translations'
export let comment: CommentView
export let replying: boolean = false
@@ -56,7 +57,7 @@
<Button
slot="target"
class="!p-1 text-slate-600 dark:text-zinc-400"
aria-label="Comment actions"
title={$t('comment.actions.label')}
color="tertiary"
>
<Icon
@@ -67,7 +68,7 @@
slot="prefix"
/>
</Button>
<MenuDivider>Actions</MenuDivider>
<MenuDivider>{$t('comment.actions.label')}</MenuDivider>
<MenuButton
on:click={() => {
navigator.share?.({
@@ -76,13 +77,13 @@
}}
>
<Icon src={Square2Stack} mini size="16" />
<divv>Copy Link</divv>
<div>{$t('comment.actions.link')}</div>
</MenuButton>
{#if $profile?.jwt}
{#if comment.creator.id == $profile.user?.local_user_view.person.id}
<MenuButton on:click={() => dispatcher('edit', comment)}>
<Icon src={PencilSquare} mini size="16" />
<span>Edit</span>
<span>{$t('post.actions.more.edit')}</span>
</MenuButton>
{/if}
<MenuButton
@@ -92,7 +93,9 @@
}}
>
<Icon src={comment.saved ? BookmarkSlash : Bookmark} mini size="16" />
<span>{comment.saved ? 'Unsave' : 'Save'}</span>
<span>
{comment.saved ? $t('post.actions.unsave') : $t('post.actions.save')}
</span>
</MenuButton>
{#if $profile?.user && $profile.jwt && $profile.user.local_user_view.person.id == comment.creator.id}
<MenuButton
@@ -107,13 +110,17 @@
}}
>
<Icon src={Trash} mini size="16" />
<span>{comment.comment.deleted ? 'Restore' : 'Delete'}</span>
<span>
{comment.comment.deleted
? $t('post.actions.more.restore')
: $t('post.actions.more.delete')}
</span>
</MenuButton>
{/if}
{#if $profile.jwt && $profile.user?.local_user_view.person.id != comment.creator.id}
<MenuButton on:click={() => report(comment)} color="danger-subtle">
<Icon src={Flag} mini size="16" />
<span>Report</span>
<span>{$t('moderation.report')}</span>
</MenuButton>
{/if}
{/if}