Skip to content

Commit dff2fe3

Browse files
committed
Make the Open Browser screen significantly less ambiguous.
1 parent bb64081 commit dff2fe3

File tree

6 files changed

+22
-11
lines changed

6 files changed

+22
-11
lines changed

src/main/kotlin/xyz/bluspring/unitytranslate/client/gui/OpenBrowserScreen.kt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ package xyz.bluspring.unitytranslate.client.gui
33
import net.minecraft.Util
44
import net.minecraft.client.gui.GuiGraphics
55
import net.minecraft.client.gui.components.Button
6+
import net.minecraft.client.gui.components.Tooltip
67
import net.minecraft.client.gui.screens.Screen
78
import net.minecraft.client.resources.language.I18n
89
import net.minecraft.network.chat.Component
910
import net.minecraft.network.chat.FormattedText
1011
import xyz.bluspring.unitytranslate.UnityTranslate
12+
import xyz.bluspring.unitytranslate.client.UnityTranslateClient
1113
import xyz.bluspring.unitytranslate.config.UnityTranslateConfig
1214

1315
class OpenBrowserScreen(val address: String) : Screen(Component.empty()) {
@@ -16,12 +18,15 @@ class OpenBrowserScreen(val address: String) : Screen(Component.empty()) {
1618

1719
addRenderableWidget(
1820
Button.builder(Component.translatable("unitytranslate.do_not_show_again")) {
19-
Util.getPlatform().openUri(address)
20-
UnityTranslate.config.client.openBrowserWithoutPrompt = UnityTranslateConfig.TriState.TRUE
21+
UnityTranslate.config.client.openBrowserWithoutPromptV2 = UnityTranslateConfig.TriState.FALSE
2122
UnityTranslate.saveConfig()
23+
24+
UnityTranslateClient.displayMessage(Component.translatable("unitytranslate.disabled_browser_transcription", Component.keybind("unitytranslate.open_config")))
25+
2226
this.onClose()
2327
}
2428
.pos(this.width / 2 - (Button.DEFAULT_WIDTH / 2), this.height - 20 - Button.DEFAULT_HEIGHT - 5 - Button.DEFAULT_HEIGHT - 15)
29+
.tooltip(Tooltip.create(Component.translatable("unitytranslate.do_not_show_again.desc")))
2530
.build()
2631
)
2732

@@ -36,10 +41,13 @@ class OpenBrowserScreen(val address: String) : Screen(Component.empty()) {
3641

3742
addRenderableWidget(
3843
Button.builder(Component.translatable("unitytranslate.open_browser.open_in_browser")) {
44+
UnityTranslate.config.client.openBrowserWithoutPromptV2 = UnityTranslateConfig.TriState.TRUE
45+
UnityTranslate.saveConfig()
3946
Util.getPlatform().openUri(address)
4047
this.onClose()
4148
}
4249
.pos(this.width / 2 - (Button.DEFAULT_WIDTH / 2), this.height - 20 - Button.DEFAULT_HEIGHT - 15)
50+
.tooltip(Tooltip.create(Component.translatable("unitytranslate.open_browser.open_in_browser.desc")))
4351
.build()
4452
)
4553
}

src/main/kotlin/xyz/bluspring/unitytranslate/client/transcribers/browser/BrowserSpeechTranscriber.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ class BrowserSpeechTranscriber(language: Language) : SpeechTranscriber(language)
5050
val mc = Minecraft.getInstance()
5151

5252
if (socket.totalConnections <= 0 && UnityTranslate.config.client.enabled) {
53-
if (UnityTranslate.config.client.openBrowserWithoutPrompt == UnityTranslateConfig.TriState.TRUE) {
53+
if (UnityTranslate.config.client.openBrowserWithoutPromptV2 == UnityTranslateConfig.TriState.TRUE) {
5454
Util.getPlatform().openUri("http://127.0.0.1:$serverPort")
55-
} else if (UnityTranslate.config.client.openBrowserWithoutPrompt == UnityTranslateConfig.TriState.DEFAULT) {
55+
} else if (UnityTranslate.config.client.openBrowserWithoutPromptV2 == UnityTranslateConfig.TriState.DEFAULT) {
5656
Minecraft.getInstance().execute {
5757
if (mc.screen is RequestDownloadScreen) {
5858
(mc.screen as RequestDownloadScreen).parent = OpenBrowserScreen("http://127.0.0.1:$serverPort")

src/main/kotlin/xyz/bluspring/unitytranslate/config/UnityTranslateConfig.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ data class UnityTranslateConfig(
1313
@Serializable
1414
data class ClientConfig(
1515
var enabled: Boolean = true,
16-
var openBrowserWithoutPrompt: TriState = TriState.DEFAULT,
16+
var openBrowserWithoutPromptV2: TriState = TriState.DEFAULT,
1717
var muteTranscriptWhenVoiceChatMuted: Boolean = true,
1818

1919
@get:IntRange(from = 10, to = 300, increment = 10)

src/main/resources/assets/unitytranslate/lang/en_us.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33

44
"unitytranslate.open_browser.prompt": "For UnityTranslate to transcribe your speech in Browser Transcription mode, your browser must be left opened to a website running locally. You may close your browser once you are no longer using UnityTranslate.",
55
"unitytranslate.do_not_show_again": "Don't show me again",
6+
"unitytranslate.do_not_show_again.desc": "Disables Browser Transcription, and also makes this screen never appear again.",
7+
"unitytranslate.disabled_browser_transcription": "Browser Transcription is now disabled. To turn it back on, you may access the UnityTranslate Config by pressing %s.",
68
"unitytranslate.open_browser.open_in_browser": "Open in Browser",
9+
"unitytranslate.open_browser.open_in_browser.desc": "Enables automatically opening the browser every time you connect to a world.",
710
"unitytranslate.request_download": "UnityTranslate is requesting to download a LibreTranslate instance to run locally on your computer. This download will run in the background so you can continue playing, but it may disrupt your internet bandwidth.\n\nThis download will only occur §lonce§r, and §lno LibreTranslate software updates will be installed§r unless you delete the .unitytranslate folder in your Minecraft folder.\n\nAdditionally, the LibreTranslate instance will only run when Minecraft is running. If it doesn't close when Minecraft is closed, please report it on our GitHub.\n\nThis local LibreTranslate instance will be able to assist in reducing translation latency as much as possible for your optimal experience.\n\nIf you wish to disable the local instance, you may turn it off in the UnityTranslate config.",
811
"unitytranslate.request_download.allow": "Allow",
912
"unitytranslate.request_download.deny": "Deny",
@@ -90,8 +93,8 @@
9093
"config.unitytranslate.client.language.desc": "Selects the currently spoken language.",
9194
"config.unitytranslate.client.muteTranscriptWhenVoiceChatMuted": "Mute Transcript when Voice Chat Muted?",
9295
"config.unitytranslate.client.muteTranscriptWhenVoiceChatMuted.desc": "If Simple Voice Chat / Plasmo Voice is muted, and this option is set to True, UnityTranslate will not transcribe audio while you are muted.",
93-
"config.unitytranslate.client.openBrowserWithoutPrompt": "Open Browser without Prompt?",
94-
"config.unitytranslate.client.openBrowserWithoutPrompt.desc": "When you join a world for the first time in a session, UnityTranslate will automatically open the browser for you without prompting you.",
96+
"config.unitytranslate.client.openBrowserWithoutPromptV2": "Open Browser without Prompt?",
97+
"config.unitytranslate.client.openBrowserWithoutPromptV2.desc": "When you join a world for the first time in a session, UnityTranslate will automatically open the browser for you without prompting you.",
9598
"config.unitytranslate.client.textScale": "Text Scale (%)",
9699
"config.unitytranslate.client.textScale.desc": "The scale of the text inside the transcript boxes.",
97100
"config.unitytranslate.client.disappearingText": "Enable Disappearing Text?",

src/main/resources/assets/unitytranslate/lang/es_es.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@
5050
"config.unitytranslate.client.language.desc": "Selecciona el idioma hablado en ese momento.",
5151
"config.unitytranslate.client.muteTranscriptWhenVoiceChatMuted": "¿Silenciar la transcripción cuando el chat de voz está silenciado?",
5252
"config.unitytranslate.client.muteTranscriptWhenVoiceChatMuted.desc": "Si Simple Voice Chat / Plasmo Voice está silenciado, y esta opción está establecida en True, UnityTranslate no transcribirá audio mientras esté silenciado.",
53-
"config.unitytranslate.client.openBrowserWithoutPrompt": "¿Abrir el navegador sin preguntar?",
54-
"config.unitytranslate.client.openBrowserWithoutPrompt.desc": "Cuando se una a un mundo por primera vez en una sesión, UnityTranslate abrirá automáticamente el navegador por usted sin preguntarle.",
53+
"config.unitytranslate.client.openBrowserWithoutPromptV2": "¿Abrir el navegador sin preguntar?",
54+
"config.unitytranslate.client.openBrowserWithoutPromptV2.desc": "Cuando se una a un mundo por primera vez en una sesión, UnityTranslate abrirá automáticamente el navegador por usted sin preguntarle.",
5555
"config.unitytranslate.client.textScale": "Texto Escala (%)",
5656
"config.unitytranslate.client.textScale.desc": "La escala del texto dentro de los cuadros de transcripción.",
5757
"config.unitytranslate.client.disappearingText": "¿Activar la desaparición del texto?",

src/main/resources/assets/unitytranslate/lang/es_mx.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@
5050
"config.unitytranslate.client.language.desc": "Selecciona el idioma hablado en ese momento.",
5151
"config.unitytranslate.client.muteTranscriptWhenVoiceChatMuted": "¿Silenciar la transcripción cuando el chat de voz está silenciado?",
5252
"config.unitytranslate.client.muteTranscriptWhenVoiceChatMuted.desc": "Si Simple Voice Chat / Plasmo Voice está silenciado, y esta opción está establecida en True, UnityTranslate no transcribirá audio mientras esté silenciado.",
53-
"config.unitytranslate.client.openBrowserWithoutPrompt": "¿Abrir el navegador sin preguntar?",
54-
"config.unitytranslate.client.openBrowserWithoutPrompt.desc": "Cuando se una a un mundo por primera vez en una sesión, UnityTranslate abrirá automáticamente el navegador por usted sin preguntarle.",
53+
"config.unitytranslate.client.openBrowserWithoutPromptV2": "¿Abrir el navegador sin preguntar?",
54+
"config.unitytranslate.client.openBrowserWithoutPromptV2.desc": "Cuando se una a un mundo por primera vez en una sesión, UnityTranslate abrirá automáticamente el navegador por usted sin preguntarle.",
5555
"config.unitytranslate.client.textScale": "Texto Escala (%)",
5656
"config.unitytranslate.client.textScale.desc": "La escala del texto dentro de los cuadros de transcripción.",
5757
"config.unitytranslate.client.disappearingText": "¿Activar la desaparición del texto?",

0 commit comments

Comments
 (0)