Merge branch 'bugfix_translation' into UI_2.0
This commit is contained in:
12
main.py
12
main.py
@@ -19,6 +19,10 @@ def sendMicMessage(message):
|
|||||||
else:
|
else:
|
||||||
translation = model.getInputTranslate(message)
|
translation = model.getInputTranslate(message)
|
||||||
|
|
||||||
|
if translation == None:
|
||||||
|
view.printToTextbox_AuthenticationError()
|
||||||
|
translation = ""
|
||||||
|
|
||||||
if config.ENABLE_TRANSCRIPTION_SEND is True:
|
if config.ENABLE_TRANSCRIPTION_SEND is True:
|
||||||
if config.ENABLE_OSC is True:
|
if config.ENABLE_OSC is True:
|
||||||
if len(translation) > 0:
|
if len(translation) > 0:
|
||||||
@@ -56,6 +60,10 @@ def receiveSpeakerMessage(message):
|
|||||||
else:
|
else:
|
||||||
translation = model.getOutputTranslate(message)
|
translation = model.getOutputTranslate(message)
|
||||||
|
|
||||||
|
if translation == None:
|
||||||
|
view.printToTextbox_AuthenticationError()
|
||||||
|
translation = ""
|
||||||
|
|
||||||
if config.ENABLE_TRANSCRIPTION_RECEIVE is True:
|
if config.ENABLE_TRANSCRIPTION_RECEIVE is True:
|
||||||
if config.ENABLE_NOTICE_XSOVERLAY is True:
|
if config.ENABLE_NOTICE_XSOVERLAY is True:
|
||||||
xsoverlay_message = config.MESSAGE_FORMAT.replace("[message]", message)
|
xsoverlay_message = config.MESSAGE_FORMAT.replace("[message]", message)
|
||||||
@@ -86,6 +94,10 @@ def sendChatMessage(message):
|
|||||||
else:
|
else:
|
||||||
translation = model.getInputTranslate(message)
|
translation = model.getInputTranslate(message)
|
||||||
|
|
||||||
|
if translation == None:
|
||||||
|
view.printToTextbox_AuthenticationError()
|
||||||
|
translation = ""
|
||||||
|
|
||||||
# send OSC message
|
# send OSC message
|
||||||
if config.ENABLE_OSC is True:
|
if config.ENABLE_OSC is True:
|
||||||
if len(translation) > 0:
|
if len(translation) > 0:
|
||||||
|
|||||||
30
model.py
30
model.py
@@ -135,21 +135,27 @@ class Model:
|
|||||||
return list(self.translator.translator_status.keys())
|
return list(self.translator.translator_status.keys())
|
||||||
|
|
||||||
def getInputTranslate(self, message):
|
def getInputTranslate(self, message):
|
||||||
translation = self.translator.translate(
|
try:
|
||||||
translator_name=config.CHOICE_TRANSLATOR,
|
translation = self.translator.translate(
|
||||||
source_language=config.SOURCE_LANGUAGE,
|
translator_name=config.CHOICE_TRANSLATOR,
|
||||||
target_language=config.TARGET_LANGUAGE,
|
source_language=config.SOURCE_LANGUAGE,
|
||||||
message=message
|
target_language=config.TARGET_LANGUAGE,
|
||||||
)
|
message=message
|
||||||
|
)
|
||||||
|
except:
|
||||||
|
translation = None
|
||||||
return translation
|
return translation
|
||||||
|
|
||||||
def getOutputTranslate(self, message):
|
def getOutputTranslate(self, message):
|
||||||
translation = self.translator.translate(
|
try:
|
||||||
translator_name=config.CHOICE_TRANSLATOR,
|
translation = self.translator.translate(
|
||||||
source_language=config.TARGET_LANGUAGE,
|
translator_name=config.CHOICE_TRANSLATOR,
|
||||||
target_language=config.SOURCE_LANGUAGE,
|
source_language=config.TARGET_LANGUAGE,
|
||||||
message=message
|
target_language=config.SOURCE_LANGUAGE,
|
||||||
)
|
message=message
|
||||||
|
)
|
||||||
|
except:
|
||||||
|
translation = None
|
||||||
return translation
|
return translation
|
||||||
|
|
||||||
def addKeywords(self):
|
def addKeywords(self):
|
||||||
|
|||||||
2
view.py
2
view.py
@@ -416,7 +416,7 @@ class View():
|
|||||||
self._printToTextbox_Info("Auth key update completed")
|
self._printToTextbox_Info("Auth key update completed")
|
||||||
|
|
||||||
def printToTextbox_AuthenticationError(self):
|
def printToTextbox_AuthenticationError(self):
|
||||||
self._printToTextbox_Info("Auth Key or language setting is incorrect")
|
self._printToTextbox_Info("Auth Key is incorrect or Usage limit reached")
|
||||||
|
|
||||||
def printToTextbox_OSCError(self):
|
def printToTextbox_OSCError(self):
|
||||||
self._printToTextbox_Info("OSC is not enabled, please enable OSC and rejoin")
|
self._printToTextbox_Info("OSC is not enabled, please enable OSC and rejoin")
|
||||||
|
|||||||
Reference in New Issue
Block a user