i18n: localize toasts

This commit is contained in:
Xylight committed 2024-06-04 13:02:05 -07:00
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',
})
}