From 4bd240d62ac56f5e87da43c28bfa489f51ee079e Mon Sep 17 00:00:00 2001 From: DazedAnon Date: Tue, 25 Feb 2025 14:37:29 -0600 Subject: [PATCH] Properly fix recursion bug --- modules/rpgmakermvmz.py | 50 ++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/modules/rpgmakermvmz.py b/modules/rpgmakermvmz.py index 0f3e94b..e588497 100644 --- a/modules/rpgmakermvmz.py +++ b/modules/rpgmakermvmz.py @@ -893,10 +893,6 @@ def searchCodes(page, pbar, jobList, filename): # Grab String if len(codeList[i]["parameters"]) > 0: jaString = codeList[i]["parameters"][0] - # Check if there is text to translate - if not re.search(r"\w+", jaString): - i += 1 - continue oldjaString = jaString else: codeList[i]["code"] = -1 @@ -963,23 +959,23 @@ def searchCodes(page, pbar, jobList, filename): jaString = jaString.replace(ffMatch.group(0), "") nametag += ffMatch.group(0) - # Test Speaker - if ( - len(jaString) < 40 - and "code" in codeList[i + 1] - and codeList[i + 1]["code"] in [401, 405, -1] - and len(codeList[i + 1]["parameters"]) > 0 - and len(codeList[i + 1]["parameters"][0]) > 0 - ): - if codeList[i + 1]["parameters"] != "" and codeList[i + 1]["parameters"][0].strip()[0] in [ - "「", - '"', - "(", - "(", - "*", - "[", - ]: - speakerList = re.findall(r".+", jaString) + # Test Speaker + if ( + len(jaString) < 40 + and "code" in codeList[i + 1] + and codeList[i + 1]["code"] in [401, 405, -1] + and len(codeList[i + 1]["parameters"]) > 0 + and len(codeList[i + 1]["parameters"][0]) > 0 + ): + if codeList[i + 1]["parameters"] != "" and codeList[i + 1]["parameters"][0].strip()[0] in [ + "「", + '"', + "(", + "(", + "*", + "[", + ]: + speakerList = re.findall(r".+", jaString) if len(speakerList) != 0 and codeList[i + 1]["code"] in [401, 405, -1]: # Get Speaker @@ -1000,6 +996,18 @@ def searchCodes(page, pbar, jobList, filename): j = i jaString = codeList[i]["parameters"][0] + # Replace Symbols + jaString = jaString.replace("…", "...") + jaString = jaString.replace("。", ".") + jaString = jaString.replace("・", ".") + jaString = jaString.replace("「", '"') + jaString = jaString.replace("」", '"') + + # Check if there is text to translate + if not re.search(r"\w+", jaString): + i += 1 + continue + # Using this to keep track of 401's in a row. currentGroup.append(jaString)