forked from mirrors/akkoma-fe
Add visual feedback when clicking translate
In a status, we can choose to translate the status (assuming there's a translator enabled on the backend) It will translate, in practice generally according to detected language, and also provide an option to override the source language. Translating can take a while, and there wasn't really a visual feedback when it was translating. Now the translate button will be dissabled while translating.
This commit is contained in:
parent
f391cf70a4
commit
9838545904
2 changed files with 7 additions and 2 deletions
|
@ -41,7 +41,8 @@ const StatusContent = {
|
||||||
postLength: this.status.text.length,
|
postLength: this.status.text.length,
|
||||||
parseReadyDone: false,
|
parseReadyDone: false,
|
||||||
renderMisskeyMarkdown,
|
renderMisskeyMarkdown,
|
||||||
translateFrom: null
|
translateFrom: null,
|
||||||
|
translating: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -135,7 +136,10 @@ const StatusContent = {
|
||||||
},
|
},
|
||||||
translateStatus () {
|
translateStatus () {
|
||||||
const translateTo = this.$store.getters.mergedConfig.translationLanguage || this.$store.state.instance.interfaceLanguage
|
const translateTo = this.$store.getters.mergedConfig.translationLanguage || this.$store.state.instance.interfaceLanguage
|
||||||
this.$store.dispatch('translateStatus', { id: this.status.id, language: translateTo, from: this.translateFrom })
|
this.translating = true
|
||||||
|
this.$store.dispatch(
|
||||||
|
'translateStatus', { id: this.status.id, language: translateTo, from: this.translateFrom }
|
||||||
|
).finally(() => { this.translating = false })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,6 +91,7 @@
|
||||||
{{ ' ' }}
|
{{ ' ' }}
|
||||||
<button
|
<button
|
||||||
class="btn button-default"
|
class="btn button-default"
|
||||||
|
:disabled="translating"
|
||||||
@click="translateStatus"
|
@click="translateStatus"
|
||||||
>
|
>
|
||||||
{{ $t('status.translate') }}
|
{{ $t('status.translate') }}
|
||||||
|
|
Loading…
Reference in a new issue