diff --git a/src-python/model.py b/src-python/model.py index 3b0ccaf1..6ffa0495 100644 --- a/src-python/model.py +++ b/src-python/model.py @@ -208,7 +208,7 @@ class Model: def getInputTranslate(self, message): translator_name=config.SELECTED_TAB_YOUR_TRANSLATOR_ENGINES[config.SELECTED_TAB_NO] - source_language=config.SELECTED_TAB_YOUR_LANGUAGES[config.SELECTED_TAB_NO] + source_language=config.SELECTED_TAB_YOUR_LANGUAGES[config.SELECTED_TAB_NO]["primary"]["language"] target_languages=config.SELECTED_TAB_TARGET_LANGUAGES[config.SELECTED_TAB_NO] translations = [] diff --git a/src-python/webui_controller.py b/src-python/webui_controller.py index 12e4ab09..d7d28025 100644 --- a/src-python/webui_controller.py +++ b/src-python/webui_controller.py @@ -324,8 +324,8 @@ class ChatMessage: # update textbox message log (Sent) if config.ENABLE_LOGGER is True: if len(translation) > 0: - translation = " (" + "/".join(translation) + ")" - model.logger.info(f"[SENT] {message}{translation}") + translation_text = " (" + "/".join(translation) + ")" + model.logger.info(f"[SENT] {message}{translation_text}") return {"status":200, "result":{ @@ -412,9 +412,14 @@ def setTargetLanguageAndCountry(select:dict, *args, **kwargs) -> dict: def swapYourLanguageAndTargetLanguage(*args, **kwargs) -> dict: printLog("swapYourLanguageAndTargetLanguage") your_language = config.SELECTED_TAB_YOUR_LANGUAGES[config.SELECTED_TAB_NO] + your_language_primary = your_language["primary"] target_language = config.SELECTED_TAB_TARGET_LANGUAGES[config.SELECTED_TAB_NO] - setYourLanguageAndCountry(target_language) - setTargetLanguageAndCountry(your_language) + target_language_primary = target_language["primary"] + + your_language["primary"] = target_language_primary + target_language["primary"] = your_language_primary + setYourLanguageAndCountry(your_language) + setTargetLanguageAndCountry(target_language) return {"status":200} def callbackSelectedLanguagePresetTab(selected_tab_no:str, *args, **kwargs) -> dict: diff --git a/src-python/webui_mainloop.py b/src-python/webui_mainloop.py index 853f2905..262e1ef4 100644 --- a/src-python/webui_mainloop.py +++ b/src-python/webui_mainloop.py @@ -326,6 +326,7 @@ if __name__ == "__main__": match endpoint: case "/controller/callback_messagebox_send": + # handleControllerRequest("/controller/callback_enable_translation") data = {"id":"123456", "message":"ใƒ†ใ‚นใƒˆ"} case "/controller/set_your_language_and_country": data = {