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