i18n: localize toasts
This commit is contained in:
1 parent
b57baa3769
commit
e89d2aaddb
35 files changed
+169
-177
No files matched your search
@@ -51,11 +51,6 @@
|
||||
node.comment_view.comment.content = newComment
|
||||
|
||||
editing = false
|
||||
|
||||
toast({
|
||||
content: 'Successfully edited comment.',
|
||||
type: 'success',
|
||||
})
|
||||
} catch (err) {
|
||||
toast({
|
||||
// @ts-ignore i hate this
|
||||
|
||||
@@ -41,10 +41,6 @@
|
||||
dispatch('comment', response)
|
||||
|
||||
value = ''
|
||||
toast({
|
||||
content: 'Your comment was submitted.',
|
||||
type: 'success',
|
||||
})
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
toast({
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
import { shouldShowVoteColor } from '../post/PostVote.svelte'
|
||||
import { fly } from 'svelte/transition'
|
||||
import { backOut } from 'svelte/easing'
|
||||
import { t } from '$lib/translations'
|
||||
|
||||
export let vote: number = 0
|
||||
export let upvotes: number
|
||||
@@ -25,7 +26,7 @@
|
||||
|
||||
const castVote = async (newVote: number) => {
|
||||
if (!$profile?.jwt) {
|
||||
toast({ content: 'You must be logged in to vote.', type: 'warning' })
|
||||
toast({ content: $t('toast.loginVoteGate'), type: 'warning' })
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
import { Button } from 'mono-svelte'
|
||||
import { afterNavigate } from '$app/navigation'
|
||||
import { backOut } from 'svelte/easing'
|
||||
import { t } from '$lib/translations'
|
||||
|
||||
export let nodes: CommentNodeI[]
|
||||
export let isParent: boolean
|
||||
@@ -62,7 +63,7 @@
|
||||
if (newComments.comments.length == 0) {
|
||||
loadingChildren = false
|
||||
toast({
|
||||
content: 'The API returned no comments.',
|
||||
content: $t('toast.noComments'),
|
||||
type: 'error',
|
||||
})
|
||||
return
|
||||
@@ -81,7 +82,7 @@
|
||||
parent.children = treeParent.children
|
||||
if (treeParent.children.length == 0) {
|
||||
toast({
|
||||
content: 'The API returned no comments.',
|
||||
content: $t('toast.noComments'),
|
||||
type: 'warning',
|
||||
})
|
||||
}
|
||||
@@ -90,7 +91,7 @@
|
||||
parent.children = tree
|
||||
if (tree.length == 0) {
|
||||
toast({
|
||||
content: 'The API returned no comments.',
|
||||
content: $t('toast.noComments'),
|
||||
type: 'warning',
|
||||
})
|
||||
}
|
||||
@@ -99,7 +100,7 @@
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
toast({
|
||||
content: `Failed to fetch comments. ${error as any}`,
|
||||
content: error as any,
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
|
||||
try {
|
||||
const loading = toast({
|
||||
content: `${blocked ? 'Unblocking' : 'blocking'} community...`,
|
||||
content: ``,
|
||||
loading: true,
|
||||
})
|
||||
|
||||
@@ -96,9 +96,9 @@
|
||||
removeToast(loading)
|
||||
|
||||
toast({
|
||||
content: `Successfully ${
|
||||
blocked ? 'unblocked' : 'blocked'
|
||||
} that community.`,
|
||||
content: blocked
|
||||
? $t('toast.unblockedCommunity')
|
||||
: $t('toast.blockedCommunity'),
|
||||
type: 'success',
|
||||
})
|
||||
} catch (error) {
|
||||
@@ -120,14 +120,14 @@
|
||||
|
||||
async function purgeCommunity() {
|
||||
purgingCommunity = false
|
||||
const purgeToast = toast({ content: 'Purging community...', loading: true })
|
||||
const purgeToast = toast({ content: '', loading: true })
|
||||
|
||||
try {
|
||||
await client().purgeCommunity({
|
||||
community_id: community_view.community.id,
|
||||
})
|
||||
removeToast(purgeToast)
|
||||
toast({ content: 'Purged that community.', type: 'success' })
|
||||
toast({ content: $t('toast.purgedCommunity'), type: 'success' })
|
||||
} catch (e) {
|
||||
toast({ content: e as any, type: 'error' })
|
||||
}
|
||||
@@ -137,7 +137,7 @@
|
||||
if (!$profile?.jwt) return
|
||||
try {
|
||||
const loading = toast({
|
||||
content: `Blocking instance...`,
|
||||
content: ``,
|
||||
loading: true,
|
||||
})
|
||||
|
||||
@@ -160,14 +160,12 @@
|
||||
|
||||
{#if purgingCommunity}
|
||||
<Modal bind:open={purgingCommunity}>
|
||||
<svelte:fragment slot="title">Purging Community</svelte:fragment>
|
||||
<svelte:fragment slot="title">
|
||||
{$t('admin.purgeCommunity.title')}
|
||||
</svelte:fragment>
|
||||
<CommunityLink avatar community={community_view.community} />
|
||||
<p>
|
||||
Purging community <span class="font-bold">
|
||||
{community_view.community.title}
|
||||
</span>
|
||||
</p>
|
||||
<p>
|
||||
Are you sure you want to do this? (The button will enable in 3 seconds.)
|
||||
{$t('admin.purgeCommunity.warning')}
|
||||
</p>
|
||||
<div class="flex flex-row gap-2">
|
||||
<Button
|
||||
@@ -175,7 +173,7 @@
|
||||
on:click={() => (purgingCommunity = false)}
|
||||
class="flex-1"
|
||||
>
|
||||
Cancel
|
||||
{$t('common.cancel')}
|
||||
</Button>
|
||||
<Button
|
||||
size="lg"
|
||||
@@ -184,7 +182,7 @@
|
||||
disabled={!purgeEnabled}
|
||||
class="flex-1"
|
||||
>
|
||||
Purge
|
||||
{$t('admin.purge')}
|
||||
</Button>
|
||||
</div>
|
||||
</Modal>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
import { addSubscription } from '$lib/lemmy/user.js'
|
||||
import { Button, Checkbox, TextInput } from 'mono-svelte'
|
||||
import { uploadImage } from '$lib/util.js'
|
||||
import { t } from '$lib/translations'
|
||||
|
||||
/**
|
||||
* The community ID to edit.
|
||||
@@ -68,7 +69,7 @@
|
||||
})
|
||||
|
||||
toast({
|
||||
content: `Your community was ${edit ? 'saved' : 'created'}.`,
|
||||
content: $t('toast.updatedCommunity'),
|
||||
type: 'success',
|
||||
})
|
||||
|
||||
|
||||
@@ -3,8 +3,10 @@
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import { t } from '$lib/translations'
|
||||
import type { Person } from 'lemmy-js-client'
|
||||
import { Button, Modal, toast } from 'mono-svelte'
|
||||
import { Icon, PaperAirplane } from 'svelte-hero-icons'
|
||||
|
||||
export let open: boolean = false
|
||||
export let user: Person
|
||||
@@ -25,7 +27,7 @@
|
||||
})
|
||||
|
||||
toast({
|
||||
content: 'Successfully sent that person a message.',
|
||||
content: $t('toast.sentMessage'),
|
||||
type: 'success',
|
||||
})
|
||||
|
||||
@@ -45,16 +47,16 @@
|
||||
<h1 class="text-2xl font-bold" slot="title">Message</h1>
|
||||
<form on:submit|preventDefault={sendMessage} class="flex flex-col gap-4">
|
||||
<p class="inline-flex flex-row gap-2 items-center">
|
||||
Sending <UserLink avatar {user} /> a message
|
||||
<Icon src={PaperAirplane} size="16" mini />
|
||||
<UserLink avatar {user} />
|
||||
</p>
|
||||
<MarkdownEditor
|
||||
bind:value={message}
|
||||
label="Message"
|
||||
placeholder="your hair looks nice today"
|
||||
label={$t('content.message')}
|
||||
rows={4}
|
||||
/>
|
||||
<Button color="primary" size="lg" submit {loading} disabled={loading}>
|
||||
Send
|
||||
{$t('common.send')}
|
||||
</Button>
|
||||
</form>
|
||||
</Modal>
|
||||
@@ -42,7 +42,7 @@
|
||||
date = Date.parse(expires)
|
||||
if (Number.isNaN(date)) {
|
||||
toast({
|
||||
content: 'Invalid date. It must be an absolute date.',
|
||||
content: $t('toast.invalidDateAbsolute'),
|
||||
type: 'error',
|
||||
})
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
|
||||
if (date < Date.now()) {
|
||||
toast({
|
||||
content: 'Invalid date. It is before the current time.',
|
||||
content: $t('toast.invalidDateBeforeCurrent'),
|
||||
type: 'error',
|
||||
})
|
||||
|
||||
@@ -84,9 +84,7 @@
|
||||
open = false
|
||||
|
||||
toast({
|
||||
content: `Successfully ${
|
||||
banned ? 'unbanned' : 'banned'
|
||||
} that user. You may need to refresh to see changes.`,
|
||||
content: banned ? $t('toast.unbannedUser') : $t('toast.bannedUser'),
|
||||
type: 'success',
|
||||
})
|
||||
|
||||
|
||||
@@ -107,16 +107,7 @@
|
||||
<PostBody body={post.post.body} {view} style="grid-area: body" />
|
||||
{/if}
|
||||
{#if actions}
|
||||
<PostActions
|
||||
bind:post
|
||||
on:edit={(e) => {
|
||||
toast({
|
||||
content: 'The post was edited successfully.',
|
||||
type: 'success',
|
||||
})
|
||||
}}
|
||||
style="grid-area: actions;"
|
||||
/>
|
||||
<PostActions bind:post style="grid-area: actions;" />
|
||||
{:else if view == 'compact'}
|
||||
<div class="flex flex-row items-center gap-2 text-sm">
|
||||
<Badge>
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
if (!data.community && !edit) {
|
||||
toast({
|
||||
type: 'warning',
|
||||
content: 'You need to set a community.',
|
||||
content: $t('toast.needCommunity'),
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -96,7 +96,7 @@
|
||||
new URL(data.url)
|
||||
} catch (err) {
|
||||
toast({
|
||||
content: 'Invalid URL',
|
||||
content: $t('toast.invalidURL'),
|
||||
type: 'warning',
|
||||
})
|
||||
return
|
||||
@@ -171,14 +171,14 @@
|
||||
.join('\n')
|
||||
|
||||
toast({
|
||||
content: `Generated title and body from that website. Would you like to undo this action?`,
|
||||
content: $t('toast.generatedTitle'),
|
||||
type: 'info',
|
||||
action: () => (data = oldData),
|
||||
duration: 15 * 1000,
|
||||
})
|
||||
} catch (e) {
|
||||
toast({
|
||||
content: 'There was no usable title or description of that website.',
|
||||
content: $t('toast.failGenerateTitle'),
|
||||
})
|
||||
}
|
||||
generation.loading = false
|
||||
@@ -328,7 +328,7 @@
|
||||
{#if !edit}
|
||||
<Button
|
||||
on:click={() => {
|
||||
toast({ content: 'Restored from draft' })
|
||||
toast({ content: $t('toast.restoredFromDraft') })
|
||||
const draft = getSessionStorage('postDraft')
|
||||
if (draft && !edit) {
|
||||
// @ts-ignore
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
import { site } from '$lib/lemmy.js'
|
||||
import { fly } from 'svelte/transition'
|
||||
import { backOut } from 'svelte/easing'
|
||||
import { t } from '$lib/translations'
|
||||
|
||||
export let post: Post
|
||||
export let vote: number = 0
|
||||
@@ -42,7 +43,7 @@
|
||||
|
||||
const castVote = async (newVote: number) => {
|
||||
if (!$profile?.jwt) {
|
||||
toast({ content: 'You must be logged in to vote.', type: 'warning' })
|
||||
toast({ content: $t('toast.loginVoteGate'), type: 'warning' })
|
||||
return
|
||||
}
|
||||
loading = true
|
||||
|
||||
@@ -168,7 +168,7 @@
|
||||
class="hover:brightness-110 transition-all"
|
||||
on:click={() => {
|
||||
navigator?.clipboard?.writeText(__VERSION__)
|
||||
toast({ content: 'Copied version to clipboard.' })
|
||||
toast({ content: $t('toast.copied') })
|
||||
}}
|
||||
>
|
||||
<Badge color="blue-subtle">{__VERSION__}</Badge>
|
||||
|
||||
+65
-3
@@ -347,7 +347,11 @@
|
||||
"admin": {
|
||||
"purge": "Purge",
|
||||
"instance": "Instance",
|
||||
"label": "Administration"
|
||||
"label": "Administration",
|
||||
"purgeCommunity": {
|
||||
"title": "Purging Community",
|
||||
"warning": "This will delete all posts. Are you sure? (The button will enable in 3 seconds.)"
|
||||
}
|
||||
},
|
||||
"content": {
|
||||
"all": "All",
|
||||
@@ -355,7 +359,8 @@
|
||||
"posts": "Posts",
|
||||
"comments": "Comments",
|
||||
"communities": "Communities",
|
||||
"instances": "Instances"
|
||||
"instances": "Instances",
|
||||
"message": "Message"
|
||||
},
|
||||
"post": {
|
||||
"actions": {
|
||||
@@ -440,10 +445,67 @@
|
||||
"disabled": "Disabled",
|
||||
"enable": "Enable",
|
||||
"disable": "Disable",
|
||||
"add": "Add"
|
||||
"add": "Add",
|
||||
"cancel": "Cancel",
|
||||
"send": "Send"
|
||||
},
|
||||
"message": {
|
||||
"success": "Success",
|
||||
"error": "Error"
|
||||
},
|
||||
"toast": {
|
||||
"noComments": "The API returned no comments.",
|
||||
"loginVoteGate": "You must be logged in to vote.",
|
||||
"blockedCommunity": "Blocked that community.",
|
||||
"unblockedCommunity": "Unblocked that community.",
|
||||
"purgedCommunity": "Purged that community.",
|
||||
"blockedInstance": "Blocked that instance.",
|
||||
"updatedCommunity": "Your community was updated.",
|
||||
"sentMessage": "Sent that message.",
|
||||
"invalidDateAbsolute": "Invalid date. It must be an absolute date.",
|
||||
"invalidDateBeforeCurrent": "Invalid date. It is before the current time.",
|
||||
"bannedUser": "Banned that user.",
|
||||
"unbannedUser": "Unbanned that user.",
|
||||
"needCommunity": "You must set a community.",
|
||||
"invalidURL": "Invalid URL",
|
||||
"generatedTitle": "Generated title and body from the URL. Do you want to undo this?",
|
||||
"failGenerateTitle": "There was no usable title or description of that website.",
|
||||
"restoredFromDraft": "Restored your post from the draft.",
|
||||
"copied": "Copied to clipboard.",
|
||||
"approvedApplication": "Approved that application.",
|
||||
"deniedApplication": "Denied that application.",
|
||||
"updatedSite": "Updated your site.",
|
||||
"failCSV": "Failed to read CSV",
|
||||
"removeAdminWarning": "Are you sure you want to remove that admin?",
|
||||
"removeAdmin": "Removed that admin.",
|
||||
"failFindUser": "Could not find that user.",
|
||||
"addMod": "Added that moderator.",
|
||||
"updateMods": "Updated community moderators.",
|
||||
"logIn": "Successfully logged in.",
|
||||
"failInstanceURL": "Failed to contact that instance URL. Is it down?",
|
||||
"addAccount": "Added that account.",
|
||||
"resetLink": "A password reset link was sent to your email.",
|
||||
"resolveReport": "Resolved that report.",
|
||||
"unresolveReport": "Unresolved that report.",
|
||||
"passwordReset": "Your password was reset.",
|
||||
"fetchPostOnHome": "Attempting to fetch this post on your home instance...",
|
||||
"loginRefresh": "Your login was refreshed.",
|
||||
"invalidLogin": "Invalid credentials",
|
||||
"saveSettings": "Saved your user settings. If you changed your email, a verification link was sent.",
|
||||
"confirmDelete1": "Are you sure you want to delete your account?",
|
||||
"confirmDelete2": "Are you really sure?",
|
||||
"confirmDelete3": "Final warning. Are you really sure?",
|
||||
"needPassword": "You must provide your password.",
|
||||
"deleting": "Deleting your account...",
|
||||
"deleted": "Your account was deleted.",
|
||||
"resetSettings": "Do you want to reset your settings to the default?",
|
||||
"failFetchInstances": "Failed to fetch available instances.",
|
||||
"verifyEmail": "A verification link was sent to your email. Verify your email, then log in.",
|
||||
"failSignup": "Failed to sign up.",
|
||||
"successSignup": "Signed up.",
|
||||
"waitApplication": "Wait for your registration application to be accepted before logging in.",
|
||||
"blockUser": "Blocked that user.",
|
||||
"unblockUser": "Unblocked that user.",
|
||||
"purgeUser": "Purged that user."
|
||||
}
|
||||
}
|
||||
@@ -44,37 +44,6 @@
|
||||
let newInstance: string = $profileData.defaultInstance ?? DEFAULT_INSTANCE_URL
|
||||
let loading = false
|
||||
|
||||
async function changeGuestInstance() {
|
||||
loading = true
|
||||
try {
|
||||
const valid = await validateInstance(newInstance.trim())
|
||||
|
||||
if (!valid) {
|
||||
throw new Error('invalid instance')
|
||||
}
|
||||
|
||||
toast({
|
||||
content: 'Changed guest instance.',
|
||||
type: 'success',
|
||||
})
|
||||
} catch (err) {
|
||||
toast({
|
||||
content: 'Failed to contact that instance URL. Is it down?',
|
||||
type: 'error',
|
||||
})
|
||||
|
||||
loading = false
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
$profileData.defaultInstance = newInstance
|
||||
if ($currentProfile && $currentProfile.id == -1) {
|
||||
$instance = newInstance
|
||||
}
|
||||
loading = false
|
||||
}
|
||||
|
||||
let debugging = false
|
||||
let debugProfile: Profile | undefined = undefined
|
||||
|
||||
@@ -161,25 +130,6 @@
|
||||
Sign up
|
||||
</Button>
|
||||
</div>
|
||||
{#if LINKED_INSTANCE_URL === undefined}
|
||||
<div class="flex flex-row font-normal gap-2">
|
||||
<TextInput
|
||||
label="Guest instance"
|
||||
on:change={changeGuestInstance}
|
||||
placeholder="Instance URL"
|
||||
bind:value={newInstance}
|
||||
/>
|
||||
<Button
|
||||
color="primary"
|
||||
class="h-max self-end"
|
||||
size="lg"
|
||||
{loading}
|
||||
disabled={loading}
|
||||
>
|
||||
Change
|
||||
</Button>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
|
||||
@@ -51,9 +51,9 @@
|
||||
registrationApplicationAnswer
|
||||
)
|
||||
toast({
|
||||
content: `Successfully ${
|
||||
approve ? 'approved' : 'denied'
|
||||
} that application.`,
|
||||
content: approve
|
||||
? $t('toast.approvedApplication')
|
||||
: $t('toast.deniedApplication'),
|
||||
type: 'success',
|
||||
})
|
||||
application.creator_local_user.accepted_application = approve
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
...formData,
|
||||
})
|
||||
toast({
|
||||
content: 'Updated your site.',
|
||||
content: $t('toast.updatedSite'),
|
||||
type: 'success',
|
||||
})
|
||||
} catch (err) {
|
||||
|
||||
@@ -109,7 +109,7 @@
|
||||
|
||||
if (res) {
|
||||
toast({
|
||||
content: 'Edited your site.',
|
||||
content: $t('toast.updatedSite'),
|
||||
type: 'success',
|
||||
})
|
||||
}
|
||||
@@ -127,8 +127,7 @@
|
||||
if (!data.federated_instances?.federated_instances?.blocked)
|
||||
throw new Error('Missing instance')
|
||||
const content = e.target?.result
|
||||
if (!content)
|
||||
toast({ content: 'No content in that file', type: 'warning' })
|
||||
if (!content) toast({ content: $t('toast.failCSV'), type: 'warning' })
|
||||
|
||||
try {
|
||||
const instances: Instance[] = []
|
||||
@@ -152,12 +151,12 @@
|
||||
|
||||
data.federated_instances.federated_instances.blocked = instances
|
||||
} catch (err) {
|
||||
toast({ content: err as 'Failed to parse CSV', type: 'error' })
|
||||
toast({ content: $t('toast.failCSV'), type: 'error' })
|
||||
}
|
||||
}
|
||||
|
||||
reader.onerror = (e) =>
|
||||
toast({ content: 'Failed to read file.', type: 'error' })
|
||||
toast({ content: $t('toast.failCSV'), type: 'error' })
|
||||
|
||||
reader.readAsText(files[0])
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
taglines: taglines,
|
||||
})
|
||||
toast({
|
||||
content: 'Successfully saved taglines.',
|
||||
content: $t('toast.updatedSite'),
|
||||
type: 'success',
|
||||
})
|
||||
} catch (err) {
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
async function removeAdmin(id: number, confirm: boolean): Promise<any> {
|
||||
if (!confirm)
|
||||
return toast({
|
||||
content: 'Are you sure you want to remove that admin?',
|
||||
content: $t('toast.removeAdminWarning'),
|
||||
action: () => removeAdmin(id, true),
|
||||
})
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
if (result) {
|
||||
data.site!.admins = result.admins
|
||||
toast({
|
||||
content: 'Removed that admin.',
|
||||
content: $t('toast.removeAdmin'),
|
||||
type: 'success',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { profile } from '$lib/auth'
|
||||
import { addResumable } from '$lib/lemmy/item.js'
|
||||
import { t } from '$lib/translations.js'
|
||||
|
||||
export let data
|
||||
|
||||
@@ -94,7 +95,7 @@
|
||||
}`
|
||||
)
|
||||
|
||||
toast({ content: 'Copied to clipboard.' })
|
||||
toast({ content: $t('toast.copied') })
|
||||
}}
|
||||
class="dark:text-zinc-400 text-slate-600 text-sm text-left"
|
||||
>
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import { flip } from 'svelte/animate'
|
||||
import { Button, TextInput } from 'mono-svelte'
|
||||
import { t } from '$lib/translations.js'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
export let data: PageData
|
||||
|
||||
@@ -37,14 +39,14 @@
|
||||
data.community.moderators = addModRes.moderators
|
||||
|
||||
toast({
|
||||
content: 'Added that user as a moderator.',
|
||||
content: $t('toast.addMod'),
|
||||
type: 'success',
|
||||
})
|
||||
|
||||
formData.newModerator = ''
|
||||
} else {
|
||||
toast({
|
||||
content: 'Could not find that user.',
|
||||
content: $t('toast.failFindUser'),
|
||||
type: 'warning',
|
||||
})
|
||||
}
|
||||
@@ -71,7 +73,7 @@
|
||||
data.community.moderators = res.moderators
|
||||
|
||||
toast({
|
||||
content: 'Successfully updated community moderators.',
|
||||
content: $t('toast.updateMods'),
|
||||
type: 'success',
|
||||
})
|
||||
} catch (err) {
|
||||
@@ -83,11 +85,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>Moderator Team</title>
|
||||
</svelte:head>
|
||||
|
||||
<h1 class="text-2xl font-bold">Moderators</h1>
|
||||
<Header>Moderators</Header>
|
||||
<EditableList
|
||||
let:action
|
||||
on:action={(e) => {
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
subscribing = false
|
||||
return res
|
||||
} catch (error) {
|
||||
toast({ content: 'Failed to subscribe to community', type: 'error' })
|
||||
toast({ content: error as any, type: 'error' })
|
||||
}
|
||||
|
||||
subscribing = false
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
const result = await setUser(response.jwt, data.instance, data.username)
|
||||
|
||||
if (result) {
|
||||
toast({ content: 'Successfully logged in.', type: 'success' })
|
||||
toast({ content: $t('toast.logIn'), type: 'success' })
|
||||
goto('/')
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
async function addGuest() {
|
||||
form.loading = true
|
||||
if (!(await validateInstance(form.instance))) {
|
||||
toast({ content: 'Failed to contact that instance URL.', type: 'error' })
|
||||
toast({ content: $t('toast.failInstanceURL'), type: 'error' })
|
||||
form.loading = false
|
||||
return
|
||||
}
|
||||
@@ -44,7 +44,7 @@
|
||||
}
|
||||
})
|
||||
|
||||
toast({ content: 'Added that account.', type: 'success' })
|
||||
toast({ content: $t('toast.addAccount'), type: 'success' })
|
||||
|
||||
goto('/')
|
||||
|
||||
|
||||
@@ -16,14 +16,14 @@
|
||||
loading = true
|
||||
try {
|
||||
if (!(await validateInstance(instance)))
|
||||
throw new Error('Failed to contact instance url')
|
||||
throw new Error($t('toast.failInstanceURL'))
|
||||
|
||||
await getClient(instance).passwordReset({
|
||||
email: email,
|
||||
})
|
||||
|
||||
toast({
|
||||
content: 'A password reset link was sent to your email.',
|
||||
content: $t('toast.resetLink'),
|
||||
type: 'success',
|
||||
})
|
||||
} catch (err) {
|
||||
|
||||
@@ -34,9 +34,9 @@
|
||||
item.resolved = res.comment_report_view.comment_report.resolved
|
||||
|
||||
toast({
|
||||
content: `${
|
||||
item.resolved ? 'Resolved' : 'Unresolved'
|
||||
} that report.`,
|
||||
content: item.resolved
|
||||
? $t('toast.resolveReport')
|
||||
: $t('toast.unresolveReport'),
|
||||
type: 'success',
|
||||
})
|
||||
|
||||
@@ -50,9 +50,9 @@
|
||||
|
||||
item.resolved = res.post_report_view.post_report.resolved
|
||||
toast({
|
||||
content: `${
|
||||
item.resolved ? 'Resolved' : 'Unresolved'
|
||||
} that report.`,
|
||||
content: item.resolved
|
||||
? $t('toast.resolveReport')
|
||||
: $t('toast.unresolveReport'),
|
||||
type: 'success',
|
||||
})
|
||||
|
||||
@@ -67,9 +67,9 @@
|
||||
item.resolved =
|
||||
res.private_message_report_view.private_message_report.resolved
|
||||
toast({
|
||||
content: `${
|
||||
item.resolved ? 'Resolved' : 'Unresolved'
|
||||
} that report.`,
|
||||
content: item.resolved
|
||||
? $t('toast.resolveReport')
|
||||
: $t('toast.unresolveReport'),
|
||||
type: 'success',
|
||||
})
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
loading = true
|
||||
try {
|
||||
if (!(await validateInstance(instance)))
|
||||
throw new Error('Failed to contact instance url')
|
||||
throw new Error($t('toast.failInstanceURL'))
|
||||
|
||||
await getClient(instance).passwordChangeAfterReset({
|
||||
password: password,
|
||||
@@ -31,7 +31,7 @@
|
||||
})
|
||||
|
||||
toast({
|
||||
content: 'Your password was reset.',
|
||||
content: $t('toast.passwordReset'),
|
||||
type: 'success',
|
||||
})
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
|
||||
const fetchOnHome = async (jwt: string) => {
|
||||
const id = toast({
|
||||
content: 'Attempting to fetch this post on your home instance...',
|
||||
content: $t('toast.fetchPostOnHome'),
|
||||
loading: true,
|
||||
})
|
||||
|
||||
|
||||
@@ -41,12 +41,12 @@
|
||||
await setUser(res.jwt, instance, username!)
|
||||
$currentInstance = instance
|
||||
|
||||
toast({ content: 'Your login was refreshed.', type: 'success' })
|
||||
toast({ content: $t('toast.loginRefresh'), type: 'success' })
|
||||
} else {
|
||||
throw new Error('Invalid credentials')
|
||||
throw new Error($t('toast.invalidLogin'))
|
||||
}
|
||||
|
||||
toast({ content: 'Successfully changed your password. ' })
|
||||
toast({ content: $t('toast.passwordReset') })
|
||||
} catch (e) {
|
||||
toast({
|
||||
content: e as any,
|
||||
@@ -139,7 +139,7 @@
|
||||
on:click={() => {
|
||||
if (!totpLink) return
|
||||
navigator.clipboard?.writeText(totpLink)
|
||||
toast({ content: 'Copied to clipboard.' })
|
||||
toast({ content: $t('toast.copied') })
|
||||
}}
|
||||
>
|
||||
<Icon src={ClipboardDocument} size="20" mini />
|
||||
|
||||
@@ -41,8 +41,7 @@
|
||||
})
|
||||
|
||||
toast({
|
||||
content:
|
||||
'Saved your user settings. If you changed your email, a verification email will have been sent.',
|
||||
content: $t('toast.saveSettings'),
|
||||
type: 'success',
|
||||
})
|
||||
} catch (err) {
|
||||
@@ -65,21 +64,21 @@
|
||||
switch (level) {
|
||||
case 0: {
|
||||
toast({
|
||||
content: 'Are you sure you want to delete your account?',
|
||||
content: $t('toast.confirmDelete1'),
|
||||
action: () => deleteAccount(1),
|
||||
})
|
||||
return
|
||||
}
|
||||
case 1: {
|
||||
toast({
|
||||
content: 'Are you really sure?',
|
||||
content: $t('toast.confirmDelete2'),
|
||||
action: () => deleteAccount(2),
|
||||
})
|
||||
return
|
||||
}
|
||||
case 2: {
|
||||
toast({
|
||||
content: 'Final warning. Are you reeeeeeally sure?',
|
||||
content: $t('toast.confirmDelete3'),
|
||||
action: () => deleteAccount(3),
|
||||
})
|
||||
return
|
||||
@@ -93,13 +92,13 @@
|
||||
|
||||
if (!(deletion.password || null)) {
|
||||
toast({
|
||||
content: 'You must provide your password.',
|
||||
content: $t('toast.needPassword'),
|
||||
type: 'warning',
|
||||
})
|
||||
}
|
||||
|
||||
const id = toast({
|
||||
content: 'You did this. Deleting account...',
|
||||
content: $t('toast.deleting'),
|
||||
loading: true,
|
||||
})
|
||||
|
||||
@@ -121,7 +120,7 @@
|
||||
|
||||
setUserID(-1)
|
||||
toast({
|
||||
content: 'Your account was deleted.',
|
||||
content: $t('toast.deleted'),
|
||||
})
|
||||
goto('/')
|
||||
} catch (err) {
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
import { removeItem } from '$lib/util.js'
|
||||
import Section from './Section.svelte'
|
||||
import ToggleSetting from './ToggleSetting.svelte'
|
||||
import { locales } from '$lib/translations'
|
||||
import { locales, t } from '$lib/translations'
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
@@ -43,7 +43,7 @@
|
||||
Settings <Button
|
||||
on:click={() => {
|
||||
toast({
|
||||
content: 'Are you sure you want to reset your settings to the default?',
|
||||
content: $t('toast.resetSettings'),
|
||||
action: () => ($userSettings = defaultSettings),
|
||||
})
|
||||
}}
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
// ]
|
||||
} catch (e) {
|
||||
toast({
|
||||
content: 'Failed to fetch available instances.',
|
||||
content: $t('toast.failFetchInstances'),
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
@@ -129,7 +129,7 @@
|
||||
goto(`/signup/${selectedInstance}`)
|
||||
} else {
|
||||
toast({
|
||||
content: 'Could not contact that instance URL',
|
||||
content: $t('toast.failInstanceURL'),
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
if (res?.jwt) {
|
||||
await setUser(res.jwt, $page.params.instance, username)
|
||||
|
||||
toast({ content: 'Successfully logged in.', type: 'success' })
|
||||
toast({ content: $t('toast.logIn'), type: 'success' })
|
||||
goto('/')
|
||||
} else if (
|
||||
res.verify_email_sent ||
|
||||
@@ -78,8 +78,7 @@
|
||||
currentInstance.set(instance)
|
||||
if (res.verify_email_sent) {
|
||||
toast({
|
||||
content:
|
||||
'A verification link was sent to your email. Verify your email, and then you can log in.',
|
||||
content: $t('toast.verifyEmail'),
|
||||
type: 'info',
|
||||
})
|
||||
}
|
||||
@@ -87,18 +86,17 @@
|
||||
data.site_view.local_site.registration_mode == 'RequireApplication'
|
||||
) {
|
||||
toast({
|
||||
content:
|
||||
'Please wait for your registration application to be approved before you can log in.',
|
||||
content: $t('toast.waitApplication'),
|
||||
type: 'info',
|
||||
})
|
||||
}
|
||||
goto('/')
|
||||
} else {
|
||||
throw new Error('Failed to sign up.')
|
||||
throw new Error($t('toast.failSignup'))
|
||||
}
|
||||
|
||||
toast({
|
||||
content: 'Signed up.',
|
||||
content: $t('toast.successSignup'),
|
||||
type: 'success',
|
||||
})
|
||||
} catch (err) {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
Icon,
|
||||
} from 'svelte-hero-icons'
|
||||
import ColorSwatch from './ColorSwatch.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
|
||||
const c = defaultColors
|
||||
|
||||
@@ -36,7 +37,7 @@
|
||||
throw new Error('Import is empty')
|
||||
}
|
||||
$colors = JSON.parse(importText)
|
||||
toast({ content: 'Import successful', type: 'success' })
|
||||
toast({ content: $t('message.success'), type: 'success' })
|
||||
importing = false
|
||||
} catch (err) {
|
||||
// @ts-ignore
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
}
|
||||
|
||||
toast({
|
||||
content: `Successfully ${blocked ? 'unblocked' : 'blocked'} that user.`,
|
||||
content: blocked ? $t('toast.unblockUser') : $t('toast.blockUser'),
|
||||
type: 'success',
|
||||
})
|
||||
|
||||
@@ -99,14 +99,14 @@
|
||||
|
||||
async function purgeUser() {
|
||||
purgingUser = false
|
||||
const purgeToast = toast({ content: 'Purging user...', loading: true })
|
||||
const purgeToast = toast({ content: '', loading: true })
|
||||
|
||||
try {
|
||||
await client().purgePerson({
|
||||
person_id: data.person_view.person.id,
|
||||
})
|
||||
removeToast(purgeToast)
|
||||
toast({ content: 'Purged that user.', type: 'success' })
|
||||
toast({ content: $t('toast.purgeUser'), type: 'success' })
|
||||
} catch (e) {
|
||||
toast({ content: e as any, type: 'error' })
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user