fix: translate posts target language is not current selected language (#1263)

This commit is contained in:
Alex 2023-01-18 05:41:26 +08:00 committed by GitHub
parent a7e1dad3d2
commit 0b77ad3f43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 21 deletions

View file

@ -27,18 +27,6 @@ const userSettings = useUserSettings()
const isAuthor = $computed(() => status.account.id === currentUser.value?.account.id)
const {
toggle: _toggleTranslation,
translation,
enabled: isTranslationEnabled,
} = useTranslation(props.status)
const toggleTranslation = async () => {
isLoading.translation = true
await _toggleTranslation()
isLoading.translation = false
}
const { client } = $(useMasto())
const getPermalinkUrl = (status: mastodon.v1.Status) => {

View file

@ -9,7 +9,7 @@ const {
withAction?: boolean
}>()
const { translation } = useTranslation(status)
const { translation } = useTranslation(status, getLanguageCode())
const emojisObject = useEmojisFallback(() => status.emojis)
const vnode = $computed(() => {

View file

@ -9,7 +9,7 @@ const {
toggle: _toggleTranslation,
translation,
enabled: isTranslationEnabled,
} = useTranslation(status)
} = useTranslation(status, getLanguageCode())
let translating = $ref(false)
const toggleTranslation = async () => {
@ -26,7 +26,7 @@ const toggleTranslation = async () => {
<template>
<div>
<button
v-if="isTranslationEnabled && status.language !== languageCode" p-0 flex="~ center" gap-2 text-sm
v-if="isTranslationEnabled && status.language !== getLanguageCode()" p-0 flex="~ center" gap-2 text-sm
:disabled="translating" disabled-bg-transparent btn-text class="disabled-text-$c-text-btn-disabled-deeper" @click="toggleTranslation"
>
<span v-if="translating" block animate-spin preserve-3d>