diff --git a/src/lib/components/lemmy/comment/Comment.svelte b/src/lib/components/lemmy/comment/Comment.svelte
index 0a98af0e..34e08e59 100644
--- a/src/lib/components/lemmy/comment/Comment.svelte
+++ b/src/lib/components/lemmy/comment/Comment.svelte
@@ -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
diff --git a/src/lib/components/lemmy/comment/CommentForm.svelte b/src/lib/components/lemmy/comment/CommentForm.svelte
index 907503c5..33b56a83 100644
--- a/src/lib/components/lemmy/comment/CommentForm.svelte
+++ b/src/lib/components/lemmy/comment/CommentForm.svelte
@@ -41,10 +41,6 @@
dispatch('comment', response)
value = ''
- toast({
- content: 'Your comment was submitted.',
- type: 'success',
- })
} catch (err) {
console.error(err)
toast({
diff --git a/src/lib/components/lemmy/comment/CommentVote.svelte b/src/lib/components/lemmy/comment/CommentVote.svelte
index 4cda666d..4725b814 100644
--- a/src/lib/components/lemmy/comment/CommentVote.svelte
+++ b/src/lib/components/lemmy/comment/CommentVote.svelte
@@ -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
}
diff --git a/src/lib/components/lemmy/comment/Comments.svelte b/src/lib/components/lemmy/comment/Comments.svelte
index e2fd645e..a89e8229 100644
--- a/src/lib/components/lemmy/comment/Comments.svelte
+++ b/src/lib/components/lemmy/comment/Comments.svelte
@@ -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',
})
}
diff --git a/src/lib/components/lemmy/community/CommunityCard.svelte b/src/lib/components/lemmy/community/CommunityCard.svelte
index ef21acc4..ec811cae 100644
--- a/src/lib/components/lemmy/community/CommunityCard.svelte
+++ b/src/lib/components/lemmy/community/CommunityCard.svelte
@@ -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}
- Purging Community
+
+ {$t('admin.purgeCommunity.title')}
+
+
- Purging community
- {community_view.community.title}
-
-
-
- Are you sure you want to do this? (The button will enable in 3 seconds.)
+ {$t('admin.purgeCommunity.warning')}
diff --git a/src/lib/components/lemmy/community/CommunityForm.svelte b/src/lib/components/lemmy/community/CommunityForm.svelte
index 8d7aa724..bde3e043 100644
--- a/src/lib/components/lemmy/community/CommunityForm.svelte
+++ b/src/lib/components/lemmy/community/CommunityForm.svelte
@@ -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',
})
diff --git a/src/lib/components/lemmy/modal/PrivateMessageModal.svelte b/src/lib/components/lemmy/modal/PrivateMessageModal.svelte
index fba0e753..9662b72c 100644
--- a/src/lib/components/lemmy/modal/PrivateMessageModal.svelte
+++ b/src/lib/components/lemmy/modal/PrivateMessageModal.svelte
@@ -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 @@
Message
diff --git a/src/lib/components/lemmy/moderation/BanModal.svelte b/src/lib/components/lemmy/moderation/BanModal.svelte
index e8f97eff..04671dc2 100644
--- a/src/lib/components/lemmy/moderation/BanModal.svelte
+++ b/src/lib/components/lemmy/moderation/BanModal.svelte
@@ -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',
})
diff --git a/src/lib/components/lemmy/post/Post.svelte b/src/lib/components/lemmy/post/Post.svelte
index 8a8ecf7e..835805de 100644
--- a/src/lib/components/lemmy/post/Post.svelte
+++ b/src/lib/components/lemmy/post/Post.svelte
@@ -107,16 +107,7 @@
{/if}
{#if actions}
- {
- toast({
- content: 'The post was edited successfully.',
- type: 'success',
- })
- }}
- style="grid-area: actions;"
- />
+
{:else if view == 'compact'}
diff --git a/src/lib/components/lemmy/post/PostForm.svelte b/src/lib/components/lemmy/post/PostForm.svelte
index b2594476..aa920127 100644
--- a/src/lib/components/lemmy/post/PostForm.svelte
+++ b/src/lib/components/lemmy/post/PostForm.svelte
@@ -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}
- {#if LINKED_INSTANCE_URL === undefined}
-
-
-
-
- {/if}
{:else}
diff --git a/src/routes/admin/applications/Application.svelte b/src/routes/admin/applications/Application.svelte
index 4b754408..0c3e73f7 100644
--- a/src/routes/admin/applications/Application.svelte
+++ b/src/routes/admin/applications/Application.svelte
@@ -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
diff --git a/src/routes/admin/config/+page.svelte b/src/routes/admin/config/+page.svelte
index 8ac019eb..2950a43f 100644
--- a/src/routes/admin/config/+page.svelte
+++ b/src/routes/admin/config/+page.svelte
@@ -31,7 +31,7 @@
...formData,
})
toast({
- content: 'Updated your site.',
+ content: $t('toast.updatedSite'),
type: 'success',
})
} catch (err) {
diff --git a/src/routes/admin/federation/+page.svelte b/src/routes/admin/federation/+page.svelte
index 11a417ed..a7bbe21a 100644
--- a/src/routes/admin/federation/+page.svelte
+++ b/src/routes/admin/federation/+page.svelte
@@ -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])
}
diff --git a/src/routes/admin/taglines/+page.svelte b/src/routes/admin/taglines/+page.svelte
index e34788b3..fa59ffec 100644
--- a/src/routes/admin/taglines/+page.svelte
+++ b/src/routes/admin/taglines/+page.svelte
@@ -29,7 +29,7 @@
taglines: taglines,
})
toast({
- content: 'Successfully saved taglines.',
+ content: $t('toast.updatedSite'),
type: 'success',
})
} catch (err) {
diff --git a/src/routes/admin/team/+page.svelte b/src/routes/admin/team/+page.svelte
index d2cd3eb8..1c2bbded 100644
--- a/src/routes/admin/team/+page.svelte
+++ b/src/routes/admin/team/+page.svelte
@@ -21,7 +21,7 @@
async function removeAdmin(id: number, confirm: boolean): Promise {
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',
})
}
diff --git a/src/routes/c/[name]/+page.svelte b/src/routes/c/[name]/+page.svelte
index 6d40bbdf..499fd985 100644
--- a/src/routes/c/[name]/+page.svelte
+++ b/src/routes/c/[name]/+page.svelte
@@ -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"
>
diff --git a/src/routes/c/[name]/settings/team/+page.svelte b/src/routes/c/[name]/settings/team/+page.svelte
index 979276ac..fcd502ad 100644
--- a/src/routes/c/[name]/settings/team/+page.svelte
+++ b/src/routes/c/[name]/settings/team/+page.svelte
@@ -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 @@
}
-
- Moderator Team
-
-
-Moderators
+
{
diff --git a/src/routes/communities/Subscribe.svelte b/src/routes/communities/Subscribe.svelte
index 83faff51..e85c2cfd 100644
--- a/src/routes/communities/Subscribe.svelte
+++ b/src/routes/communities/Subscribe.svelte
@@ -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
diff --git a/src/routes/login/+page.svelte b/src/routes/login/+page.svelte
index 82df9e8e..f5b85e98 100644
--- a/src/routes/login/+page.svelte
+++ b/src/routes/login/+page.svelte
@@ -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 {
diff --git a/src/routes/login/guest/+page.svelte b/src/routes/login/guest/+page.svelte
index 3d0b62a5..112f45cb 100644
--- a/src/routes/login/guest/+page.svelte
+++ b/src/routes/login/guest/+page.svelte
@@ -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('/')
diff --git a/src/routes/login_reset/+page.svelte b/src/routes/login_reset/+page.svelte
index faacc23d..007d8c5a 100644
--- a/src/routes/login_reset/+page.svelte
+++ b/src/routes/login_reset/+page.svelte
@@ -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) {
diff --git a/src/routes/moderation/Report.svelte b/src/routes/moderation/Report.svelte
index fafc76bd..b26ae229 100644
--- a/src/routes/moderation/Report.svelte
+++ b/src/routes/moderation/Report.svelte
@@ -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',
})
diff --git a/src/routes/password_change/[token]/+page.svelte b/src/routes/password_change/[token]/+page.svelte
index 2f1dedd0..2b08e19a 100644
--- a/src/routes/password_change/[token]/+page.svelte
+++ b/src/routes/password_change/[token]/+page.svelte
@@ -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',
})
diff --git a/src/routes/post/[instance]/[id=integer]/+page.svelte b/src/routes/post/[instance]/[id=integer]/+page.svelte
index d8598193..66001a81 100644
--- a/src/routes/post/[instance]/[id=integer]/+page.svelte
+++ b/src/routes/post/[instance]/[id=integer]/+page.svelte
@@ -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,
})
diff --git a/src/routes/profile/(local_user)/password/+page.svelte b/src/routes/profile/(local_user)/password/+page.svelte
index 0bca28f9..8f432ce8 100644
--- a/src/routes/profile/(local_user)/password/+page.svelte
+++ b/src/routes/profile/(local_user)/password/+page.svelte
@@ -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') })
}}
>
diff --git a/src/routes/profile/(local_user)/settings/+page.svelte b/src/routes/profile/(local_user)/settings/+page.svelte
index 55b30a08..00bbd165 100644
--- a/src/routes/profile/(local_user)/settings/+page.svelte
+++ b/src/routes/profile/(local_user)/settings/+page.svelte
@@ -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) {
diff --git a/src/routes/settings/+page.svelte b/src/routes/settings/+page.svelte
index 374965b6..634e23de 100644
--- a/src/routes/settings/+page.svelte
+++ b/src/routes/settings/+page.svelte
@@ -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'
@@ -43,7 +43,7 @@
Settings