👍[Update] Model : 翻訳失敗時のフェールセーフ処理を追加
This commit is contained in:
13
model.py
13
model.py
@@ -187,7 +187,7 @@ class Model:
|
|||||||
translator_name=config.CHOICE_OUTPUT_TRANSLATOR
|
translator_name=config.CHOICE_OUTPUT_TRANSLATOR
|
||||||
source_language=config.TARGET_LANGUAGE
|
source_language=config.TARGET_LANGUAGE
|
||||||
target_language=config.SOURCE_LANGUAGE
|
target_language=config.SOURCE_LANGUAGE
|
||||||
target_country = config.SOURCE_COUNTRY
|
target_country=config.SOURCE_COUNTRY
|
||||||
|
|
||||||
if translator_name == "DeepL_API":
|
if translator_name == "DeepL_API":
|
||||||
if target_language == "English":
|
if target_language == "English":
|
||||||
@@ -212,6 +212,15 @@ class Model:
|
|||||||
target_language=target_language,
|
target_language=target_language,
|
||||||
message=message
|
message=message
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# 翻訳失敗時のフェールセーフ処理
|
||||||
|
if translation is False and "Filipino":
|
||||||
|
translation = self.translator.translate(
|
||||||
|
translator_name="CTranslate2",
|
||||||
|
source_language=config.TARGET_LANGUAGE,
|
||||||
|
target_language=config.SOURCE_LANGUAGE,
|
||||||
|
message=message
|
||||||
|
)
|
||||||
return translation
|
return translation
|
||||||
|
|
||||||
def addKeywords(self):
|
def addKeywords(self):
|
||||||
@@ -496,4 +505,4 @@ class Model:
|
|||||||
def notificationXSOverlay(self, message):
|
def notificationXSOverlay(self, message):
|
||||||
xsoverlayForVRCT(content=f"{message}")
|
xsoverlayForVRCT(content=f"{message}")
|
||||||
|
|
||||||
model = Model()
|
model = Model()
|
||||||
Reference in New Issue
Block a user