[Update/Refactor] フェールセーフとしてCTranslate2への切り替わり時に、システムログとして表示を変更。ポップアップ表示のコードなどは一旦コメントアウト。
controller.py: 重複していたコードを関数として切り出しなど。
This commit is contained in:
@@ -55,6 +55,12 @@ def messageFormatter(format_type:str, translation, message):
|
|||||||
osc_message = FORMAT.replace("[message]", message)
|
osc_message = FORMAT.replace("[message]", message)
|
||||||
return osc_message
|
return osc_message
|
||||||
|
|
||||||
|
def changeToCTranslate2Process():
|
||||||
|
config.CHOICE_INPUT_TRANSLATOR = "CTranslate2"
|
||||||
|
config.CHOICE_OUTPUT_TRANSLATOR = "CTranslate2"
|
||||||
|
updateTranslationEngineAndEngineList()
|
||||||
|
view.printToTextbox_TranslationEngineLimitError()
|
||||||
|
|
||||||
# func transcription send message
|
# func transcription send message
|
||||||
def sendMicMessage(message):
|
def sendMicMessage(message):
|
||||||
if len(message) > 0:
|
if len(message) > 0:
|
||||||
@@ -67,9 +73,7 @@ def sendMicMessage(message):
|
|||||||
else:
|
else:
|
||||||
translation, success = model.getInputTranslate(message)
|
translation, success = model.getInputTranslate(message)
|
||||||
if success is False:
|
if success is False:
|
||||||
config.CHOICE_INPUT_TRANSLATOR = "CTranslate2"
|
changeToCTranslate2Process()
|
||||||
config.CHOICE_OUTPUT_TRANSLATOR = "CTranslate2"
|
|
||||||
updateTranslationEngineAndEngineList()
|
|
||||||
|
|
||||||
if config.ENABLE_TRANSCRIPTION_SEND is True:
|
if config.ENABLE_TRANSCRIPTION_SEND is True:
|
||||||
if config.ENABLE_SEND_MESSAGE_TO_VRC is True:
|
if config.ENABLE_SEND_MESSAGE_TO_VRC is True:
|
||||||
@@ -134,9 +138,7 @@ def receiveSpeakerMessage(message):
|
|||||||
else:
|
else:
|
||||||
translation, success = model.getOutputTranslate(message)
|
translation, success = model.getOutputTranslate(message)
|
||||||
if success is False:
|
if success is False:
|
||||||
config.CHOICE_INPUT_TRANSLATOR = "CTranslate2"
|
changeToCTranslate2Process()
|
||||||
config.CHOICE_OUTPUT_TRANSLATOR = "CTranslate2"
|
|
||||||
updateTranslationEngineAndEngineList()
|
|
||||||
|
|
||||||
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:
|
||||||
@@ -204,9 +206,8 @@ def sendChatMessage(message):
|
|||||||
else:
|
else:
|
||||||
translation, success = model.getInputTranslate(message)
|
translation, success = model.getInputTranslate(message)
|
||||||
if success is False:
|
if success is False:
|
||||||
config.CHOICE_INPUT_TRANSLATOR = "CTranslate2"
|
changeToCTranslate2Process()
|
||||||
config.CHOICE_OUTPUT_TRANSLATOR = "CTranslate2"
|
|
||||||
updateTranslationEngineAndEngineList()
|
|
||||||
# send OSC message
|
# send OSC message
|
||||||
if config.ENABLE_SEND_MESSAGE_TO_VRC is True:
|
if config.ENABLE_SEND_MESSAGE_TO_VRC is True:
|
||||||
if config.ENABLE_SEND_ONLY_TRANSLATED_MESSAGES is True:
|
if config.ENABLE_SEND_ONLY_TRANSLATED_MESSAGES is True:
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ main_window:
|
|||||||
|
|
||||||
no_mic_device_detected_error: No mic device detected.
|
no_mic_device_detected_error: No mic device detected.
|
||||||
no_speaker_device_detected_error: No speaker device detected.
|
no_speaker_device_detected_error: No speaker device detected.
|
||||||
translation_engine_limit_error: It has automatically disabled the translation feature. Access has been temporarily restricted due to an excessive number of requests to the translation engine. Please wait for a while, restart VRCT, and try again.
|
translation_engine_limit_error: It has automatically changed the translation engine. Access has been temporarily restricted due to an excessive number of requests to the translation engine. If you want to use the same translation engine, please wait for a while, restart VRCT, and try again.
|
||||||
|
|
||||||
detected_by_word_filter: The word %{detected_message} has not been sent due to detection by the word filter.
|
detected_by_word_filter: The word %{detected_message} has not been sent due to detection by the word filter.
|
||||||
|
|
||||||
@@ -58,9 +58,9 @@ main_window:
|
|||||||
deny_adjust_ui_size: "Keep it at this size"
|
deny_adjust_ui_size: "Keep it at this size"
|
||||||
accept_adjust_ui_size: "Set it smaller and restart"
|
accept_adjust_ui_size: "Set it smaller and restart"
|
||||||
|
|
||||||
|
# [Deprecated]
|
||||||
translation_engine_limit_error: "It has automatically disabled the translation feature.\nAccess has been temporarily restricted\ndue to an excessive number of requests to the translation engine.\nPlease wait for a while, restart VRCT, and try again."
|
# translation_engine_limit_error: "It has automatically disabled the translation feature.\nAccess has been temporarily restricted\ndue to an excessive number of requests to the translation engine.\nPlease wait for a while, restart VRCT, and try again."
|
||||||
accept_translation_engine_limit_error: Accept and close
|
# accept_translation_engine_limit_error: Accept and close
|
||||||
|
|
||||||
|
|
||||||
selectable_language_window:
|
selectable_language_window:
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ main_window:
|
|||||||
|
|
||||||
no_mic_device_detected_error: マイクデバイスが検出されませんでした。
|
no_mic_device_detected_error: マイクデバイスが検出されませんでした。
|
||||||
no_speaker_device_detected_error: スピーカーデバイスが検出されませんでした。
|
no_speaker_device_detected_error: スピーカーデバイスが検出されませんでした。
|
||||||
translation_engine_limit_error: 翻訳機能を自動的に停止しました。翻訳エンジンへのリクエストが多すぎるため、一時的にアクセスが制限されています。しばらく待ってから、VRCTの再起動をしてもう一度試してみてください。
|
translation_engine_limit_error: 翻訳エンジンを自動的に変更しました。対象翻訳エンジンへのリクエストが多すぎるため、一時的にアクセスが制限されています。同じ翻訳エンジンを使用したい場合はしばらく待ってから、VRCTの再起動をしてもう一度試してみてください。
|
||||||
|
|
||||||
detected_by_word_filter: ワードフィルターに登録されている単語 %{detected_message} が検出されたため送信しませんでした。
|
detected_by_word_filter: ワードフィルターに登録されている単語 %{detected_message} が検出されたため送信しませんでした。
|
||||||
|
|
||||||
@@ -58,9 +58,9 @@ main_window:
|
|||||||
deny_adjust_ui_size: このサイズのままで良い
|
deny_adjust_ui_size: このサイズのままで良い
|
||||||
accept_adjust_ui_size: 小さく設定して再起動
|
accept_adjust_ui_size: 小さく設定して再起動
|
||||||
|
|
||||||
|
# [Deprecated]
|
||||||
translation_engine_limit_error: "翻訳機能を自動的に停止しました。\n翻訳エンジンへのリクエストが多すぎるため\n一時的にアクセスが制限されています。\nしばらく待ってから、VRCTの再起動をしてもう一度試してみてください。"
|
# translation_engine_limit_error: "翻訳機能を自動的に停止しました。\n翻訳エンジンへのリクエストが多すぎるため\n一時的にアクセスが制限されています。\nしばらく待ってから、VRCTの再起動をしてもう一度試してみてください。"
|
||||||
accept_translation_engine_limit_error: 了承して閉じる
|
# accept_translation_engine_limit_error: 了承して閉じる
|
||||||
|
|
||||||
|
|
||||||
selectable_language_window:
|
selectable_language_window:
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ main_window:
|
|||||||
|
|
||||||
no_mic_device_detected_error: 마이크 디바이스를 찾지 못했습니다.
|
no_mic_device_detected_error: 마이크 디바이스를 찾지 못했습니다.
|
||||||
no_speaker_device_detected_error: 스피커 디바이스를 찾지 못했습니다.
|
no_speaker_device_detected_error: 스피커 디바이스를 찾지 못했습니다.
|
||||||
translation_engine_limit_error: 번역 기능이 자동으로 중지되었습니다. 번역 엔진에 대한 요청이 너무 많아 일시적으로 사용이 제한되고 있습니다. 잠시 기다렸다가 VRCT를 재부팅하고 다시 시도해 보세요.
|
# translation_engine_limit_error: 번역 기능이 자동으로 중지되었습니다. 번역 엔진에 대한 요청이 너무 많아 일시적으로 사용이 제한되고 있습니다. 잠시 기다렸다가 VRCT를 재부팅하고 다시 시도해 보세요.
|
||||||
|
|
||||||
detected_by_word_filter: 단어 필터에 등록된 단어 %{detected_message}(이)가 감지되어 전송하지 않았습니다.
|
detected_by_word_filter: 단어 필터에 등록된 단어 %{detected_message}(이)가 감지되어 전송하지 않았습니다.
|
||||||
|
|
||||||
@@ -57,8 +57,9 @@ main_window:
|
|||||||
accept_adjust_ui_size: "작게 줄이고 재부팅"
|
accept_adjust_ui_size: "작게 줄이고 재부팅"
|
||||||
|
|
||||||
|
|
||||||
translation_engine_limit_error: "번역 기능이 자동으로 중지되었습니다. \n번역 엔진에 대한 요청이 너무 많아 \n일시적으로 사용이 제한되었습니다. \n잠시 기다렸다가 VRCT를 재부팅한 후 다시 시도해 보십시오."
|
# [Deprecated]
|
||||||
accept_translation_engine_limit_error: 확인하고 닫기
|
# translation_engine_limit_error: "번역 기능이 자동으로 중지되었습니다. \n번역 엔진에 대한 요청이 너무 많아 \n일시적으로 사용이 제한되었습니다. \n잠시 기다렸다가 VRCT를 재부팅한 후 다시 시도해 보십시오."
|
||||||
|
# accept_translation_engine_limit_error: 확인하고 닫기
|
||||||
|
|
||||||
|
|
||||||
selectable_language_window:
|
selectable_language_window:
|
||||||
|
|||||||
40
view.py
40
view.py
@@ -1214,18 +1214,18 @@ class View():
|
|||||||
# ※Below 40% of the UI size is not supported, and we cannot handle it at this time.
|
# ※Below 40% of the UI size is not supported, and we cannot handle it at this time.
|
||||||
|
|
||||||
|
|
||||||
|
# [Deprecated]
|
||||||
|
# def translationEngineLimitErrorProcess(self):
|
||||||
|
# # turn off translation switch.
|
||||||
|
# vrct_gui.translation_switch_box.deselect()
|
||||||
|
# vrct_gui.translation_frame.markToggleManually(False)
|
||||||
|
|
||||||
def translationEngineLimitErrorProcess(self):
|
# # disable translation feature.
|
||||||
# turn off translation switch.
|
# vrct_gui._changeMainWindowWidgetsStatus("disabled", ["translation_switch"], to_hold_state=True)
|
||||||
vrct_gui.translation_switch_box.deselect()
|
|
||||||
vrct_gui.translation_frame.markToggleManually(False)
|
|
||||||
|
|
||||||
# disable translation feature.
|
# # print system message that mention to stopped translation feature.
|
||||||
vrct_gui._changeMainWindowWidgetsStatus("disabled", ["translation_switch"], to_hold_state=True)
|
# view.printToTextbox_TranslationEngineLimitError()
|
||||||
|
# view.showTheLimitOfTranslationEngineConfirmationModal()
|
||||||
# print system message that mention to stopped translation feature.
|
|
||||||
view.printToTextbox_TranslationEngineLimitError()
|
|
||||||
view.showTheLimitOfTranslationEngineConfirmationModal()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1267,19 +1267,19 @@ class View():
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [Deprecated]
|
||||||
|
# def showTheLimitOfTranslationEngineConfirmationModal(self):
|
||||||
|
# self.foregroundOffIfForegroundEnabled()
|
||||||
|
|
||||||
def showTheLimitOfTranslationEngineConfirmationModal(self):
|
# self.view_variable.VAR_LABEL_MAIN_WINDOW_COVER_MESSAGE.set("")
|
||||||
self.foregroundOffIfForegroundEnabled()
|
# vrct_gui.main_window_cover.show()
|
||||||
|
|
||||||
self.view_variable.VAR_LABEL_MAIN_WINDOW_COVER_MESSAGE.set("")
|
# self.view_variable.CALLBACK_HIDE_CONFIRMATION_MODAL=self._hideInformationModal
|
||||||
vrct_gui.main_window_cover.show()
|
# self.view_variable.CALLBACK_ACCEPTED_CONFIRMATION_MODAL=self._hideInformationModal
|
||||||
|
|
||||||
self.view_variable.CALLBACK_HIDE_CONFIRMATION_MODAL=self._hideInformationModal
|
# self.view_variable.VAR_MESSAGE_CONFIRMATION_MODAL.set(i18n.t("main_window.confirmation_message.translation_engine_limit_error"))
|
||||||
self.view_variable.CALLBACK_ACCEPTED_CONFIRMATION_MODAL=self._hideInformationModal
|
# self.view_variable.VAR_LABEL_CONFIRMATION_MODAL_ACCEPT_BUTTON.set(i18n.t("main_window.confirmation_message.accept_translation_engine_limit_error"))
|
||||||
|
# vrct_gui.information_modal.show(hide_title_bar=False, close_when_focusout=False)
|
||||||
self.view_variable.VAR_MESSAGE_CONFIRMATION_MODAL.set(i18n.t("main_window.confirmation_message.translation_engine_limit_error"))
|
|
||||||
self.view_variable.VAR_LABEL_CONFIRMATION_MODAL_ACCEPT_BUTTON.set(i18n.t("main_window.confirmation_message.accept_translation_engine_limit_error"))
|
|
||||||
vrct_gui.information_modal.show(hide_title_bar=False, close_when_focusout=False)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user