Skip to content

Commit

Permalink
disable translation services on website version for now
Browse files Browse the repository at this point in the history
  • Loading branch information
naeruru committed Feb 22, 2024
1 parent dd9188c commit 99b4bca
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 5 deletions.
5 changes: 5 additions & 0 deletions src/components/settings/General.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ import { useSettingsStore } from '@/stores/settings'
import { useSpeechStore } from '@/stores/speech'
import { useConnectionStore } from '@/stores/connections'
import { useLogStore } from '@/stores/logs'
import { useTranslationStore } from '@/stores/translation'
export default {
name: 'SettingsGeneral',
Expand All @@ -90,6 +91,7 @@ export default {
const speechStore = useSpeechStore()
const connectionStore = useConnectionStore()
const logStore = useLogStore()
const translationStore = useTranslationStore()
return {
appearanceStore,
Expand All @@ -98,6 +100,7 @@ export default {
speechStore,
connectionStore,
logStore,
translationStore,
}
},
data: () => ({
Expand Down Expand Up @@ -141,6 +144,8 @@ export default {
this.speechStore.$reset()
if (this.connection)
this.connectionStore.$reset()
if (this.translationStore)
this.translationStore.$reset()
this.reset_dialog = false
this.snackbar_text = this.$t('settings.general.reset.snackbar.title')
this.snackbar = true
Expand Down
19 changes: 15 additions & 4 deletions src/components/settings/Translation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<v-card :title="$t('settings.translation.title')" :subtitle="$t('settings.translation.description')" color="transparent" flat>
<v-divider />
<v-card-text>
<v-row>
<v-row v-if="is_electron()">
<v-col>
<v-chip variant="outlined" label color="error" size="large">
<v-icon start icon="mdi-alert" />
Expand Down Expand Up @@ -89,6 +89,15 @@
</v-card>
</v-col>
</v-row>
<v-card-text v-else>
<v-alert variant="outlined" type="warning" prominent>
<v-alert-title>
<i18n-t keypath="settings.translation.unsupported.text" tag="label" for="link" scope="global">
<a class="text-primary pointer" @click="openURL('https://github.com/naeruru/mimiuchi/releases')">{{ $t('settings.translation.unsupported.link') }}</a>
</i18n-t>
</v-alert-title>
</v-alert>
</v-card-text>
</v-card-text>
</v-card>
</template>
Expand All @@ -98,6 +107,8 @@ import { useTranslationStore } from '@/stores/translation'
import { useSpeechStore } from '@/stores/speech'
import translation_options from '@/constants/translation_options'
import is_electron from '@/helpers/is_electron'
export default {
name: 'SettingsTranslation',
setup() {
Expand All @@ -107,6 +118,7 @@ export default {
return {
translationStore,
stt_language: speechStore.stt.language,
is_electron,
}
},
data() {
Expand All @@ -125,9 +137,8 @@ export default {
},
methods: {
open_external(link: string | null) {
if (link)
window.open(link, '_blank')
openURL(url: string) {
window.open(url, '_blank')
},
},
}
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/localization/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ export default {
show_original: 'Show original phrase before translating',
ml_notice: '{0} is an ML-powered library that uses local compute resources (CPU) to generate translations on your device. On lower end computers, it might not run well.',
speech_lang: 'Your Speech-to-text language is ',
unsupported: {
text: 'Translations are currently only available on the {0}. (^・ω・^)',
link: 'desktop version',
},
},
connections: {
title: 'Connections',
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/localization/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ export default {
show_original: 'Mostrar frase original antes de traducir',
ml_notice: '{0} es una biblioteca basada en ML que utiliza recursos locales (CPU) para generar traducciones en su dispositivo. En dispositivos de gama baja, es posible que no funcione bien.',
speech_lang: 'Tu lenguaje para Voz a Texto es ',
unsupported: {
text: 'Traducciones solo está disponible en {0}. (^・ω・^)',
link: 'Aplicación de Escritorio',
},
},
connections: {
title: 'Conexiones',
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/localization/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ export default {
show_original: '翻訳する前に元のテキストを表示する',
ml_notice: '{0}はCPUを使用して、デバイス上で翻訳を生成する機械学習を搭載したライブラリです。ローエンドのコンピュータでは、うまく動作しない場合があります。',
speech_lang: 'Speech-to-text言語は',
unsupported: {
text: '翻訳サービスは{0}で利用できます。 (^・ω・^)',
link: 'デスクトップアプリ版',
},
},
connections: {
title: '接続',
Expand Down
2 changes: 1 addition & 1 deletion src/stores/speech.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export const useSpeechStore = defineStore('speech', {
logStore.loading_result = false

// translate if not translating and enabled
if (translationStore.enabled && !log.translate && !log.translation) {
if (is_electron() && translationStore.enabled && !log.translate && !log.translation) {
logStore.logs[i].translate = true
defaultStore.worker.postMessage({
text: log.transcript,
Expand Down

0 comments on commit 99b4bca

Please sign in to comment.