fix: make translate feature mostly work
This commit is contained in:
1 parent
4b42e40817
commit
19fa06b5bd
5 files changed
+27
-30
No files matched your search
@@ -8,19 +8,15 @@
|
||||
BookmarkSlash,
|
||||
BugAnt,
|
||||
ChatBubbleOvalLeft,
|
||||
ChatBubbleOvalLeftEllipsis,
|
||||
CheckBadge,
|
||||
EllipsisHorizontal,
|
||||
Eye,
|
||||
EyeSlash,
|
||||
Flag,
|
||||
GlobeAlt,
|
||||
Home,
|
||||
Icon,
|
||||
Language,
|
||||
Newspaper,
|
||||
PencilSquare,
|
||||
Scale,
|
||||
ServerStack,
|
||||
Share,
|
||||
Trash,
|
||||
@@ -36,12 +32,7 @@
|
||||
} from '$lib/components/lemmy/moderation/moderation.js'
|
||||
import ModerationMenu from '$lib/components/lemmy/moderation/ModerationMenu.svelte'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import {
|
||||
contentView,
|
||||
deleteItem,
|
||||
markAsRead,
|
||||
save,
|
||||
} from '$lib/lemmy/contentview.js'
|
||||
import { deleteItem, markAsRead, save } from '$lib/lemmy/contentview.js'
|
||||
import { setSessionStorage } from '$lib/session.js'
|
||||
import { goto } from '$app/navigation'
|
||||
import { userSettings, type View } from '$lib/settings.js'
|
||||
@@ -55,11 +46,9 @@
|
||||
toast,
|
||||
} from 'mono-svelte'
|
||||
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'
|
||||
import { hidePost, postLink, type MediaType } from './helpers'
|
||||
import { hidePost, type MediaType } from './helpers'
|
||||
import { feature } from '$lib/version'
|
||||
import Switch from '$lib/components/input/Switch.svelte'
|
||||
import { instanceToURL } from '$lib/util'
|
||||
@@ -92,7 +81,9 @@
|
||||
</script>
|
||||
|
||||
{#if fediseerData}
|
||||
<Fediseer bind:open={fediseerOpen} data={fediseerData} />
|
||||
{#await import('$lib/fediseer/Fediseer.svelte') then { default: Fediseer }}
|
||||
<Fediseer bind:open={fediseerOpen} data={fediseerData} />
|
||||
{/await}
|
||||
{/if}
|
||||
|
||||
{#if editing}
|
||||
|
||||
@@ -173,7 +173,7 @@
|
||||
class="flex flex-col border border-slate-200 border-b-slate-300 dark:border-t-zinc-700 dark:border-zinc-800
|
||||
focus-within:border-primary-900 focus-within:dark:border-primary-100 focus-within:ring ring-slate-300
|
||||
dark:ring-zinc-700 rounded-xl
|
||||
overflow-hidden transition-colors"
|
||||
overflow-hidden transition-colors {$$props.class}"
|
||||
class:mt-1={label}
|
||||
>
|
||||
{#if previewing}
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
requestURL.searchParams.set('q', text)
|
||||
requestURL.searchParams.set('source', from)
|
||||
requestURL.searchParams.set('target', to)
|
||||
requestURL.searchParams.set('alternatives', '')
|
||||
|
||||
result = fetch(requestURL.toString(), {
|
||||
method: 'POST',
|
||||
@@ -89,16 +88,14 @@
|
||||
<Spinner width={32} />
|
||||
</div>
|
||||
{:then result}
|
||||
{#if !error}
|
||||
<MarkdownEditor
|
||||
previewButton={false}
|
||||
previewing
|
||||
tools={false}
|
||||
rows={8}
|
||||
value={result.translatedText || 'Failed to translate'}
|
||||
disabled
|
||||
></MarkdownEditor>
|
||||
{/if}
|
||||
<MarkdownEditor
|
||||
previewButton={false}
|
||||
previewing
|
||||
tools={false}
|
||||
rows={8}
|
||||
value={result.translatedText || 'Failed to translate'}
|
||||
disabled
|
||||
></MarkdownEditor>
|
||||
{:catch err}
|
||||
<MarkdownEditor
|
||||
previewButton={false}
|
||||
@@ -106,7 +103,7 @@
|
||||
tools={false}
|
||||
disabled
|
||||
rows={8}
|
||||
value={err || 'Failed to translate'}
|
||||
value="Failed to translate: {err}"
|
||||
class="!border-red-500 !ring-red-500 !text-red-500"
|
||||
></MarkdownEditor>
|
||||
{/await}
|
||||
|
||||
@@ -143,9 +143,18 @@
|
||||
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
||||
<div class="contents" on:click|stopPropagation={() => {}}>
|
||||
<Select bind:value={$colorScheme} class="ml-auto my-auto w-24" size="sm">
|
||||
<option value="system">{$t('nav.menu.colorscheme.system')}</option>
|
||||
<option value="light">{$t('nav.menu.colorscheme.light')}</option>
|
||||
<option value="dark">{$t('nav.menu.colorscheme.dark')}</option>
|
||||
<option value="system">
|
||||
<Icon src={ComputerDesktop} size="16" mini />
|
||||
{$t('nav.menu.colorscheme.system')}
|
||||
</option>
|
||||
<option value="light">
|
||||
<Icon src={Sun} size="16" mini />
|
||||
{$t('nav.menu.colorscheme.light')}
|
||||
</option>
|
||||
<option value="dark">
|
||||
<Icon src={Moon} size="16" mini />
|
||||
{$t('nav.menu.colorscheme.dark')}
|
||||
</option>
|
||||
</Select>
|
||||
</div>
|
||||
</MenuButton>
|
||||
|
||||
Reference in new issue
Block a user