diff --git a/modules/rpgmakerace.py b/modules/rpgmakerace.py index 16fe67f..cd6cdc2 100644 --- a/modules/rpgmakerace.py +++ b/modules/rpgmakerace.py @@ -85,6 +85,8 @@ FIXTEXTWRAP = True IGNORETLTEXT = False # TLSYSTEMVARIABLES: Translate System Variables. (Optional but sometimes necessary. Can break stuff.) TLSYSTEMVARIABLES = False +# Join 408 codes into a single string like 401. +JOIN408 = False # Dialogue / Scroll / Choices (Main Codes) CODE101 = False @@ -2125,13 +2127,27 @@ def searchCodes(page, pbar, jobList, filename): ojaString = jaString jaString = jaString.replace("\n", " ") - # If there isn't any Japanese in the text just skip - if not re.search(LANGREGEX, jaString): - i += 1 - continue + # Join Up 408's into single string + if len(codeList) > i + 1 and JOIN408 is True: + while codeList[i + 1]["c"] in [408] and len(codeList[i]["p"]) > 0 and len(codeList[i + 1]["p"]) > 0 and not re.match(r"^(\s*[\\]+[aAbBdDeEfFgGhHjJlLmMoOpPqQrRsStTuUwWxXyYzZ]+\[[\w\d\[\]\\]+\])", codeList[i+1]["p"][0]): + if not setData: + codeList[i]["p"] = [] + codeList[i]["c"] = -1 + i += 1 + j = i + + jaString = codeList[i]["p"][0] + if jaString.strip(): + currentGroup.append(jaString) + + # Make sure not the end of the list. + if len(codeList) <= i + 1: + break # Pass 1 if setData: + # Remove Textwrap + jaString = jaString.replace("\n", " ") list408.append(jaString) # Pass 2 @@ -2140,7 +2156,7 @@ def searchCodes(page, pbar, jobList, filename): list408.pop(0) # Textwrap - translatedText = dazedwrap.wrapText(translatedText, width=LISTWIDTH) + translatedText = dazedwrap.wrapText(translatedText, width=WIDTH) # Set Data codeList[i]["p"][0] = codeList[i]["p"][0].replace(ojaString, translatedText) diff --git a/modules/rpgmakermvmz.py b/modules/rpgmakermvmz.py index 17091b8..3951b20 100644 --- a/modules/rpgmakermvmz.py +++ b/modules/rpgmakermvmz.py @@ -83,6 +83,8 @@ FIXTEXTWRAP = True IGNORETLTEXT = False # TLSYSTEMVARIABLES: Translate System Variables. (Optional but sometimes necessary. Can break stuff.) TLSYSTEMVARIABLES = False +# Join 408 codes into a single string like 401. +JOIN408 = False # Dialogue / Scroll / Choices (Main Codes) CODE101 = True @@ -2112,13 +2114,27 @@ def searchCodes(page, pbar, jobList, filename): ojaString = jaString jaString = jaString.replace("\n", " ") - # If there isn't any Japanese in the text just skip - if not re.search(LANGREGEX, jaString): - i += 1 - continue + # Join Up 408's into single string + if len(codeList) > i + 1 and JOIN408 is True: + while codeList[i + 1]["code"] in [408] and len(codeList[i]["parameters"]) > 0 and len(codeList[i + 1]["parameters"]) > 0 and not re.match(r"^(\s*[\\]+[aAbBdDeEfFgGhHjJlLmMoOpPqQrRsStTuUwWxXyYzZ]+\[[\w\d\[\]\\]+\])", codeList[i+1]["parameters"][0]): + if not setData: + codeList[i]["parameters"] = [] + codeList[i]["code"] = -1 + i += 1 + j = i + + jaString = codeList[i]["parameters"][0] + if jaString.strip(): + currentGroup.append(jaString) + + # Make sure not the end of the list. + if len(codeList) <= i + 1: + break # Pass 1 if setData: + # Remove Textwrap + jaString = jaString.replace("\n", " ") list408.append(jaString) # Pass 2 @@ -2127,7 +2143,7 @@ def searchCodes(page, pbar, jobList, filename): list408.pop(0) # Textwrap - translatedText = dazedwrap.wrapText(translatedText, width=LISTWIDTH) + translatedText = dazedwrap.wrapText(translatedText, width=WIDTH) # Set Data codeList[i]["parameters"][0] = codeList[i]["parameters"][0].replace(ojaString, translatedText) diff --git a/set_defaults.py b/set_defaults.py index 7f75073..70d2f81 100644 --- a/set_defaults.py +++ b/set_defaults.py @@ -9,6 +9,7 @@ DEFAULTS = { 'BRFLAG': False, 'FIXTEXTWRAP': True, 'IGNORETLTEXT': False, + 'JOIN408': False, # Speakers / Dialogue / Scroll / Choices (Main Codes) 'CODE101': True, 'CODE401': True,