diff --git a/bun.lockb b/bun.lockb index 45e1b00d..537d7449 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/src/lib/components/lemmy/comment/CommentActions.svelte b/src/lib/components/lemmy/comment/CommentActions.svelte index 697d71fd..01b54968 100644 --- a/src/lib/components/lemmy/comment/CommentActions.svelte +++ b/src/lib/components/lemmy/comment/CommentActions.svelte @@ -8,6 +8,7 @@ EllipsisHorizontal, Flag, Icon, + Language, PencilSquare, Square2Stack, Trash, @@ -24,6 +25,9 @@ import { deleteItem, save } from '$lib/lemmy/contentview.js' import { Button, Menu, MenuButton, MenuDivider } from 'mono-svelte' import { t } from '$lib/translations' + import Translation from '$lib/components/translate/Translation.svelte' + import { text } from '$lib/components/translate/translation' + import { userSettings } from '$lib/settings' export let comment: CommentView export let replying: boolean = false @@ -31,8 +35,13 @@ const dispatcher = createEventDispatcher<{ edit: CommentView }>() let reply = '' + let translating = false +{#if translating} + +{/if} +
{$t('comment.actions.link')}
+ {#if $userSettings.translator} + { + // @ts-ignore + text.set(comment.comment.content) + translating = !translating + }} + > + + {$t('post.actions.more.translate')} + + {/if} {#if $profile?.jwt} {#if comment.creator.id == $profile.user?.local_user_view.person.id} dispatcher('edit', comment)}> diff --git a/src/lib/components/lemmy/post/PostActions.svelte b/src/lib/components/lemmy/post/PostActions.svelte index a8ae48a5..af956f09 100644 --- a/src/lib/components/lemmy/post/PostActions.svelte +++ b/src/lib/components/lemmy/post/PostActions.svelte @@ -14,6 +14,7 @@ EyeSlash, Flag, Icon, + Language, Newspaper, PencilSquare, ServerStack, @@ -50,6 +51,8 @@ import { fediseer, type Data } from '$lib/fediseer/fediseer' import Fediseer from '$lib/fediseer/Fediseer.svelte' import { t } from '$lib/translations' + import { text } from '$lib/components/translate/translation' + import Translation from '$lib/components/translate/Translation.svelte' export let post: PostView @@ -62,6 +65,8 @@ let fediseerOpen = false let fediseerData: Data | null = null let fediseerLoading = false + + let translating = false {#if fediseerData} @@ -94,6 +99,8 @@ {/if} + +
{$t('post.actions.more.share')} + {#if post.post.body && $userSettings.translator} + { + // @ts-ignore + text.set(post.post.body) + translating = !translating + }} + > + + {$t('post.actions.more.translate')} + + {/if} {#if $profile?.jwt} { diff --git a/src/lib/components/markdown/MarkdownEditor.svelte b/src/lib/components/markdown/MarkdownEditor.svelte index 5df9b5b0..298e5a4e 100644 --- a/src/lib/components/markdown/MarkdownEditor.svelte +++ b/src/lib/components/markdown/MarkdownEditor.svelte @@ -97,7 +97,7 @@ loading = false } - let previewing = false + export let previewing = false const shortcuts = { KeyB: () => wrapSelection('**', '**'), @@ -174,7 +174,8 @@ overflow-hidden transition-colors" > {#if previewing}
diff --git a/src/lib/components/translate/Translation.svelte b/src/lib/components/translate/Translation.svelte new file mode 100644 index 00000000..c3c7c971 --- /dev/null +++ b/src/lib/components/translate/Translation.svelte @@ -0,0 +1,90 @@ + + + + +
+ + + +
+ {#if result} + {#await result} +
+ +
+ {:then result} + + {:catch err} + + {/await} + {:else} +