i18n: localize remove modal

This commit is contained in:
Xylight committed 2024-06-04 12:17:35 -07:00
1 parent 7d0a060feb
commit 13437c825f
2 files changed
+32 -17

No files matched your search

@@ -14,6 +14,7 @@
import { fullCommunityName } from '$lib/util.js' import { fullCommunityName } from '$lib/util.js'
import { amMod, isAdmin } from './moderation' import { amMod, isAdmin } from './moderation'
import { Button, Checkbox, Modal } from 'mono-svelte' import { Button, Checkbox, Modal } from 'mono-svelte'
import { t } from '$lib/translations'
export let open: boolean export let open: boolean
export let item: PostView | CommentView | undefined = undefined export let item: PostView | CommentView | undefined = undefined
@@ -68,7 +69,7 @@
} }
toast({ toast({
content: 'Successfully purged that submission.', content: $t('moderation.removeSubmission.successPurge'),
type: 'success', type: 'success',
}) })
@@ -81,7 +82,7 @@
if (commentReason) { if (commentReason) {
if (replyReason == '') { if (replyReason == '') {
toast({ toast({
content: 'Your reply cannot be empty if "Reply reason" is enabled.', content: $t('moderation.removeSubmission.failEmptyReply'),
}) })
return return
} }
@@ -96,7 +97,7 @@
}) })
.catch(() => { .catch(() => {
toast({ toast({
content: 'Failed to message user. Removing anyway...', content: $t('moderation.removeSubmission.failMessage'),
type: 'warning', type: 'warning',
}) })
}) })
@@ -109,7 +110,7 @@
}) })
.catch(() => { .catch(() => {
toast({ toast({
content: 'Failed to post reply. Removing anyway...', content: $t('moderation.removeSubmission.failReply'),
type: 'warning', type: 'warning',
}) })
}) })
@@ -134,13 +135,6 @@
} }
open = false open = false
toast({
content: `Successfully ${
removed ? 'restored' : 'removed'
} that submission.`,
type: 'success',
})
} catch (err) { } catch (err) {
toast({ toast({
content: err as any, content: err as any,
@@ -166,7 +160,11 @@
<Modal bind:open> <Modal bind:open>
<span slot="title"> <span slot="title">
{purge ? 'Purging' : removed ? 'Restoring' : 'Removing'} submission {purge
? $t('moderation.removeSubmission.titlePurge')
: removed
? $t('moderation.removeSubmission.titleRestore')
: $t('moderation.removeSubmission.title')}
</span> </span>
{#if item} {#if item}
<form <form
@@ -195,12 +193,17 @@
/> />
{#if !removed && $profile?.user && (amMod($profile.user, item.community) || (isAdmin($profile.user) && item.community.local))} {#if !removed && $profile?.user && (amMod($profile.user, item.community) || (isAdmin($profile.user) && item.community.local))}
<Checkbox bind:checked={commentReason}>Reply with reason</Checkbox> <Checkbox bind:checked={commentReason}>
{$t('moderation.removeSubmission.withReason')}
</Checkbox>
{#if commentReason} {#if commentReason}
<MultiSelect <MultiSelect
options={[false, true]} options={[false, true]}
optionNames={['Comment', 'Message']} optionNames={[
$t('moderation.removeSubmission.comment'),
$t('moderation.removeSubmission.message'),
]}
bind:selected={privateMessage} bind:selected={privateMessage}
/> />
<MarkdownEditor <MarkdownEditor
@@ -209,7 +212,7 @@
rows={3} rows={3}
> >
<div class="flex justify-between items-end mb-1" slot="label"> <div class="flex justify-between items-end mb-1" slot="label">
Reply {$t('comment.reply')}
<Select bind:value={preset} placeholder="No preset"> <Select bind:value={preset} placeholder="No preset">
{#each $userSettings.moderation.presets as preset} {#each $userSettings.moderation.presets as preset}
<option value={preset.content}> <option value={preset.content}>
@@ -231,9 +234,9 @@
> >
<Icon src={purge ? Fire : Trash} mini size="16" slot="prefix" /> <Icon src={purge ? Fire : Trash} mini size="16" slot="prefix" />
{#if purge} {#if purge}
Purge {$t('admin.purge')}
{:else} {:else}
{removed ? 'Restore' : 'Remove'} {removed ? $t('moderation.restore') : $t('moderation.remove')}
{/if} {/if}
</Button> </Button>
</form> </form>
+12
View File
@@ -403,6 +403,18 @@
"banFromCommunity": "Ban from community", "banFromCommunity": "Ban from community",
"unbanFromCommunity": "Unban from community" "unbanFromCommunity": "Unban from community"
}, },
"removeSubmission": {
"title": "Removing Submission",
"titleRestore": "Restoring Submission",
"titlePurge": "Purging Submission",
"withReason": "Reply with reason",
"comment": "Comment",
"message": "Message",
"failReply": "Failed to post reply. Removing anyway...",
"failMessage": "Failed to message user. Removing anyway...",
"failEmptyReply": "Your reply cannot be empty if 'Reply with reason' is enabled.",
"successPurge": "Successfully purged that submission."
},
"reason": "Reason", "reason": "Reason",
"lock": "Lock", "lock": "Lock",
"unlock": "Unlock", "unlock": "Unlock",