This commit is contained in:
dazedanon 2025-05-06 16:45:33 -05:00
parent ceda9b5fbf
commit 7cdf5b0930
4 changed files with 221 additions and 625 deletions

View file

@ -45,7 +45,7 @@ FACENAME101 = False # Find Speakers in 101 Codes based on Face Name
NAMES = False # Output a list of all the character names found
BRFLAG = False # If the game uses <br> instead
FIXTEXTWRAP = True # Overwrites textwrap
IGNORETLTEXT = False # Ignores all translated text.
IGNORETLTEXT = True # Ignores all translated text.
MISMATCH = [] # Lists files that throw a mismatch error (Length of GPT list response is wrong)
PBAR = None
FILENAME = None
@ -83,9 +83,9 @@ POSITION = 0
LEAVE = False
# Dialogue / Scroll / Choices (Main Codes)
CODE401 = False
CODE405 = False
CODE102 = False
CODE401 = True
CODE405 = True
CODE102 = True
# Optional
CODE101 = False # Turn this one when names exist in 101
@ -320,7 +320,7 @@ def translateNote(event, regex, wrap=True):
# translatedText = translatedText.replace("\n", "\\n")
translatedText = translatedText.replace('"', "")
translatedText = translatedText.replace(' ', "_")
# translatedText = translatedText.replace(' ', "_")
jaString = jaString.replace(initialJAString, translatedText)
event["note"] = jaString
i += 1
@ -661,8 +661,8 @@ def searchNames(data, pbar, context):
tokensResponse = translateNote(data[i], r"ADTs?:(.+?)>")
totalTokens[0] += tokensResponse[0]
totalTokens[1] += tokensResponse[1]
if "=前提スキル" in data[i]["note"]:
tokensResponse = translateNote(data[i], r"<習得ヘルプ=前提スキル:(.+?)>")
if "習得ヘルプ" in data[i]["note"]:
tokensResponse = translateNote(data[i], r"<習得ヘルプ=(.+?)>")
totalTokens[0] += tokensResponse[0]
totalTokens[1] += tokensResponse[1]
@ -1553,258 +1553,38 @@ def searchCodes(page, pbar, jobList, filename):
## Event Code: 355 or 655 Scripts [Optional]
if "c" in codeList[i] and (codeList[i]["c"] == 355 or codeList[i]["c"] == 655) and CODE355655 is True:
jaString = codeList[i]["p"][0]
patterns = {
"テキスト-": (r"テキスト-(.+)", "'"),
"logtxt = ": (r"logtxt\s=\s'(.+)'", "'"),
".setNickname": (r'.setNickname\(\\?"(.+?)\\?"\)', "'"),
"_subject=": (r'_subject=(.+?)_', "'"),
"text =": (r'text\s=\s"(.+)"', '"'),
"ex_a_name": (r'ex_a_name\(\d+,"(.+)"\)', '"')
}
if "テキスト-" in jaString:
jaString = codeList[i]["p"][0]
regex = r"テキスト-(.+)"
for key, (regex, escape_char) in patterns.items():
if key in jaString:
match = re.search(regex, jaString)
if match:
replaceString = match.group(1)
finalJAString = replaceString.replace("\u3000", "").strip()
if finalJAString:
# Pass 1
if setData == False:
list355655.append(finalJAString)
# Check Exist
match = re.search(regex, jaString)
if match:
replaceString = match.group(1)
finalJAString = replaceString
# Pass 2
else:
# Grab and Replace
translatedText = list355655[0]
translatedText = re.sub(f'(?<!\\\\){escape_char}', f'\\\\{escape_char}', translatedText)
# Remove Textwrap
# finalJAString = finalJAString.replace("\n", " ")
# Remove Spaces
finalJAString = finalJAString.replace("\u3000", "")
finalJAString = finalJAString.strip()
# Final Set
if finalJAString:
# Pass 1
if setData:
list355655.append(finalJAString)
# Pass 2
else:
# Grab and Replace
translatedText = list355655[0]
translatedText = re.sub(r"(?<!\\)'", r"\\'", translatedText)
# Textwrap
# translatedText = textwrap.fill(translatedText, width=WIDTH)
# Set
codeList[i]["p"][0] = codeList[i]["p"][0].replace(replaceString, translatedText)
list355655.pop(0)
elif "logtxt = " in jaString:
jaString = codeList[i]["p"][0]
regex = r"logtxt\s=\s'(.+)'"
# Check Exist
match = re.search(regex, jaString)
if match:
replaceString = match.group(1)
finalJAString = replaceString
# Remove Textwrap
# finalJAString = finalJAString.replace("\n", " ")
# Remove Spaces
finalJAString = finalJAString.replace("\u3000", "")
finalJAString = finalJAString.strip()
# Final Set
if finalJAString:
# Pass 1
if setData:
list355655.append(finalJAString)
# Pass 2
else:
# Grab and Replace
translatedText = list355655[0]
translatedText = re.sub(r"(?<!\\)'", r"\\'", translatedText)
# Textwrap
# translatedText = textwrap.fill(translatedText, width=WIDTH)
# Set
codeList[i]["p"][0] = codeList[i]["p"][0].replace(replaceString, translatedText)
list355655.pop(0)
elif ".setNickname" in jaString:
jaString = codeList[i]["p"][0]
regex = r'.setNickname\(\\?"(.+?)\\?"\)'
# Check Exist
match = re.search(regex, jaString)
if match:
replaceString = match.group(1)
finalJAString = replaceString
# Remove Textwrap
# finalJAString = finalJAString.replace("\n", " ")
# Remove Spaces
finalJAString = finalJAString.replace("\u3000", "")
finalJAString = finalJAString.strip()
# Final Set
if finalJAString:
# Pass 1
if setData:
list355655.append(finalJAString)
# Pass 2
else:
# Grab and Replace
translatedText = list355655[0]
translatedText = re.sub(r"(?<!\\)'", r"\\'", translatedText)
# Textwrap
# translatedText = textwrap.fill(translatedText, width=WIDTH)
# Set
codeList[i]["p"][0] = codeList[i]["p"][0].replace(replaceString, translatedText)
list355655.pop(0)
elif "_subject=" in jaString:
jaString = codeList[i]["p"][0]
regex = r'_subject=(.+?)_'
# Check Exist
match = re.search(regex, jaString)
if match:
replaceString = match.group(1)
finalJAString = replaceString
# Remove Textwrap
# finalJAString = finalJAString.replace("\n", " ")
# Remove Spaces
finalJAString = finalJAString.replace("\u3000", "")
finalJAString = finalJAString.strip()
# Final Set
if finalJAString:
# Pass 1
if setData:
list355655.append(finalJAString)
# Pass 2
else:
# Grab and Replace
translatedText = list355655[0]
translatedText = re.sub(r"(?<!\\)'", r"\\'", translatedText)
# Textwrap
# translatedText = textwrap.fill(translatedText, width=WIDTH)
# Set
codeList[i]["p"][0] = codeList[i]["p"][0].replace(replaceString, translatedText)
list355655.pop(0)
elif "\")" in jaString:
jaString = codeList[i]["p"][0]
regex = r'^([^(]+)"\)$'
# Check Exist
match = re.search(regex, jaString)
if match:
replaceString = match.group(1)
finalJAString = replaceString
# Remove Textwrap
# finalJAString = finalJAString.replace("\n", " ")
# Remove Spaces
finalJAString = finalJAString.replace("\u3000", "")
finalJAString = finalJAString.strip()
# Final Set
if finalJAString:
# Pass 1
if not setData:
list355655.append(finalJAString)
# Pass 2
else:
# Grab and Replace
translatedText = list355655[0]
translatedText = re.sub(r"(?<!\\)'", r"\\'", translatedText)
# Textwrap
# translatedText = textwrap.fill(translatedText, width=WIDTH)
# Set
codeList[i]["p"][0] = codeList[i]["p"][0].replace(replaceString, translatedText)
list355655.pop(0)
# elif "$game_variables" in jaString:
# jaString = codeList[i]["p"][0]
# regex = r'^\$game_variables\[\d+\]\s=\s"(.+)"'
# # Check Exist
# match = re.search(regex, jaString)
# if match:
# replaceString = match.group(1)
# finalJAString = replaceString
# # Remove Textwrap
# # finalJAString = finalJAString.replace("\n", " ")
# # Remove Spaces
# finalJAString = finalJAString.replace("\u3000", "")
# finalJAString = finalJAString.strip()
# # Final Set
# if finalJAString:
# # Pass 1
# if not setData:
# list355655.append(finalJAString)
# # Pass 2
# else:
# # Grab and Replace
# translatedText = list355655[0]
# translatedText = re.sub(r"(?<!\\)'", r"\\'", translatedText)
# # Textwrap
# # translatedText = textwrap.fill(translatedText, width=WIDTH)
# # Set
# codeList[i]["p"][0] = codeList[i]["p"][0].replace(replaceString, translatedText)
# list355655.pop(0)
elif "text =" in jaString:
jaString = codeList[i]["p"][0]
regex = r'text\s=\s"(.+)"'
# Check Exist
match = re.search(regex, jaString)
if match:
replaceString = match.group(1)
finalJAString = replaceString
# Remove Textwrap
# finalJAString = finalJAString.replace("\n", " ")
# Remove Spaces
finalJAString = finalJAString.replace("\u3000", "")
finalJAString = finalJAString.strip()
# Final Set
if finalJAString:
# Pass 1
if not setData:
list355655.append(finalJAString)
# Pass 2
else:
# Grab and Replace
translatedText = list355655[0]
translatedText = re.sub(r'(?<!\\)"', r'\\"', translatedText)
# Textwrap
# translatedText = textwrap.fill(translatedText, width=WIDTH)
# Set
codeList[i]["p"][0] = codeList[i]["p"][0].replace(replaceString, translatedText)
list355655.pop(0)
# Set
codeList[i]["p"][0] = codeList[i]["p"][0].replace(replaceString, translatedText)
list355655.pop(0)
break
## Event Code: 408 (Script)
if "c" in codeList[i] and (codeList[i]["c"] == 408) and CODE408 is True:

View file

@ -274,7 +274,7 @@ def parseMap(data, filename):
if event is not None:
# This translates ID of events. (May break the game)
if "<namePop:" in event["note"]:
response = translateNoteOmitSpace(event, r"<namePop:(.*?)\s?\d?>.*")
response = translateNoteOmitSpace(event, r"<namePop:(.*?)\s?[\d-]+?")
totalTokens[0] += response[0]
totalTokens[1] += response[1]
if "<LB:" in event["note"]:
@ -617,6 +617,27 @@ def searchNames(data, pbar, context):
tokensResponse = translateNote(data[i], r"<detail:(.*?)>")
totalTokens[0] += tokensResponse[0]
totalTokens[1] += tokensResponse[1]
if "<Name" in data[i]["note"]:
tokensResponse = translateNote(data[i], r"<Name:(.*?)>")
totalTokens[0] += tokensResponse[0]
totalTokens[1] += tokensResponse[1]
if "sub_1" in data[i]["note"]:
tokensResponse = translateNote(data[i], r"<sub_1:([^>]+)", True)
totalTokens[0] += tokensResponse[0]
totalTokens[1] += tokensResponse[1]
if "sub_2" in data[i]["note"]:
tokensResponse = translateNote(data[i], r"<sub_2:([^>]+)", True)
totalTokens[0] += tokensResponse[0]
totalTokens[1] += tokensResponse[1]
if "sub_3" in data[i]["note"]:
tokensResponse = translateNote(data[i], r"<sub_3:([^>]+)", True)
totalTokens[0] += tokensResponse[0]
totalTokens[1] += tokensResponse[1]
if "infowindow" in data[i]["note"]:
tokensResponse = translateNote(data[i], r"<infowindow:(.*?)>", True)
totalTokens[0] += tokensResponse[0]
totalTokens[1] += tokensResponse[1]
i += 1
else:
@ -786,7 +807,8 @@ def searchNames(data, pbar, context):
data[j]["name"] = translatedNameBatch[0]
translatedNameBatch.pop(0)
if "description" in data[j] and data[j]["description"] != "":
data[j]["description"] = textwrap.fill(translatedDescriptionBatch[0], LISTWIDTH)
translatedDescriptionBatch[0] = textwrap.fill(translatedDescriptionBatch[0], LISTWIDTH)
data[j]["description"] = translatedDescriptionBatch[0]
translatedDescriptionBatch.pop(0)
# If Batch is empty. Move on.
@ -851,6 +873,7 @@ def searchCodes(page, pbar, jobList, filename):
list108 = jobList[3]
list356 = jobList[4]
list357 = jobList[5]
list408 = jobList[6]
setData = False
else:
list401 = []
@ -859,6 +882,7 @@ def searchCodes(page, pbar, jobList, filename):
list108 = []
list356 = []
list357 = []
list408 = []
setData = True
textHistory = []
match = []
@ -1210,7 +1234,7 @@ def searchCodes(page, pbar, jobList, filename):
# 1. Split translatedText by newlines
lines = [line for line in translatedText.split('\n') if line.strip() != ""]
# 2. Set the first string to codeList[j]["p"]
# 2. Set the first string to codeList[j]["parameters"]
codeList[j]["parameters"] = [lines[0]]
# 3. Make copies for each additional line and insert them
@ -1237,7 +1261,7 @@ def searchCodes(page, pbar, jobList, filename):
## Event Code: 122 [Set Variables]
if "code" in codeList[i] and codeList[i]["code"] == 122 and CODE122 is True:
# This is going to be the var being set. (IMPORTANT)
if codeList[i]["parameters"][0] not in list(range(0, 1200)):
if codeList[i]["parameters"][0] not in list(range(0, 99999)):
i += 1
continue
@ -1254,14 +1278,14 @@ def searchCodes(page, pbar, jobList, filename):
continue
# Definitely don't want to mess with files
if 'gameV' in jaString or '_' in jaString:
if 'gameV' in jaString or '_' in jaString or '"[' in jaString:
i += 1
continue
# Avoid anything not quoted
if '\"' not in jaString:
i += 1
continue
# # Avoid anything not quoted
# if '\"' not in jaString:
# i += 1
# continue
# Validate Japanese Text
if not re.search(LANGREGEX, jaString):
@ -1293,6 +1317,9 @@ def searchCodes(page, pbar, jobList, filename):
for char in charList:
translatedText = translatedText.replace(char, "")
# Force 4 Escapes
translatedText = re.sub(r'(?<![\\])([\\]{1})(?=\w)', r'\\\\', translatedText)
# Textwrap
translatedText = textwrap.fill(translatedText, width=WIDTH)
translatedText = translatedText.replace("\n", "\\n")
@ -1552,195 +1579,64 @@ def searchCodes(page, pbar, jobList, filename):
## Event Code: 355 or 655 Scripts [Optional]
if "code" in codeList[i] and (codeList[i]["code"] == 355 or codeList[i]["code"] == 655) and CODE355655 is True:
jaString = codeList[i]["parameters"][0]
patterns = {
# "テキスト-": (r"テキスト-(.+)"
# "var text": (r"var\stext\d+\s=\s\"(.+)\""),
# "logtxt = ": (r"logtxt\s=\s'(.+)'"
# ".setNickname": (r'.setNickname\(\\?"(.+?)\\?"\)'
# "_subject=": (r'_subject=(.+?)_'
"text =": (r"text\s+=\s+'(.+?[^\\])'"),
# "ex_a_name": (r'ex_a_name\(\d+,"(.+)"\)'),
# "gameVariables.setValue": (r":\$gameVariables.setValue\(\d+,'(.+)'\)"),
# "BattleManager._logWindow.push('addText'": (r"BattleManager._logWindow.push\('addText',\s'(.+)'\)"),
}
if "テキスト-" in jaString:
jaString = codeList[i]["parameters"][0]
regex = r"テキスト-(.+)"
# Check Exist
match = re.search(regex, jaString)
if match:
replaceString = match.group(1)
finalJAString = replaceString
# Remove Textwrap
# finalJAString = finalJAString.replace("\n", " ")
# Remove Spaces
finalJAString = finalJAString.replace("\u3000", "")
finalJAString = finalJAString.strip()
# Final Set
if finalJAString:
for key, (regex) in patterns.items():
if key in jaString:
match = re.search(regex, jaString)
if match:
# Pass 1
if setData:
list355655.append(finalJAString)
list355655.append(match.group(1))
# Pass 2
else:
# Grab and Replace
translatedText = list355655[0]
translatedText = re.sub(r"(?<!\\)'", r"\\'", translatedText)
# Textwrap
# translatedText = textwrap.fill(translatedText, width=WIDTH)
# Set
codeList[i]["parameters"][0] = codeList[i]["parameters"][0].replace(replaceString, translatedText)
list355655.pop(0)
elif "logtxt = " in jaString:
jaString = codeList[i]["parameters"][0]
regex = r"logtxt\s=\s'(.+)'"
# Check Exist
match = re.search(regex, jaString)
if match:
replaceString = match.group(1)
finalJAString = replaceString
# Remove Textwrap
# finalJAString = finalJAString.replace("\n", " ")
# Remove Spaces
finalJAString = finalJAString.replace("\u3000", "")
finalJAString = finalJAString.strip()
# Final Set
if finalJAString:
# Pass 1
if setData:
list355655.append(finalJAString)
# Pass 2
else:
# Grab and Replace
translatedText = list355655[0]
# Only escape if not already escaped
translatedText = re.sub(r"(?<!\\)'", r"\\'", translatedText)
# Textwrap
# translatedText = textwrap.fill(translatedText, width=WIDTH)
translatedText = re.sub(r'(?<!\\)"', r'"', translatedText)
# Double backslashes before control codes
translatedText = re.sub(r'(?<![\\])([\\]{1})(?=\w)', r'\\\\', translatedText)
# Set
codeList[i]["parameters"][0] = codeList[i]["parameters"][0].replace(replaceString, translatedText)
list355655.pop(0)
elif ".setNickname" in jaString:
jaString = codeList[i]["parameters"][0]
regex = r'.setNickname\(\\?"(.+?)\\?"\)'
# Check Exist
match = re.search(regex, jaString)
if match:
replaceString = match.group(1)
finalJAString = replaceString
# Remove Textwrap
# finalJAString = finalJAString.replace("\n", " ")
# Remove Spaces
finalJAString = finalJAString.replace("\u3000", "")
finalJAString = finalJAString.strip()
# Final Set
if finalJAString:
# Pass 1
if setData:
list355655.append(finalJAString)
# Pass 2
else:
# Grab and Replace
translatedText = list355655[0]
translatedText = re.sub(r"(?<!\\)'", r"\\'", translatedText)
# Textwrap
# translatedText = textwrap.fill(translatedText, width=WIDTH)
# Set
codeList[i]["parameters"][0] = codeList[i]["parameters"][0].replace(replaceString, translatedText)
list355655.pop(0)
elif "_subject=" in jaString:
jaString = codeList[i]["parameters"][0]
regex = r'_subject=(.+?)_'
# Check Exist
match = re.search(regex, jaString)
if match:
replaceString = match.group(1)
finalJAString = replaceString
# Remove Textwrap
# finalJAString = finalJAString.replace("\n", " ")
# Remove Spaces
finalJAString = finalJAString.replace("\u3000", "")
finalJAString = finalJAString.strip()
# Final Set
if finalJAString:
# Pass 1
if setData:
list355655.append(finalJAString)
# Pass 2
else:
# Grab and Replace
translatedText = list355655[0]
translatedText = re.sub(r"(?<!\\)'", r"\\'", translatedText)
# Textwrap
# translatedText = textwrap.fill(translatedText, width=WIDTH)
# Set
codeList[i]["parameters"][0] = codeList[i]["parameters"][0].replace(replaceString, translatedText)
list355655.pop(0)
codeList[i]["parameters"][0] = jaString.replace(match.group(1), translatedText)
break
## Event Code: 408 (Script)
if "code" in codeList[i] and (codeList[i]["code"] == 408) and CODE408 is True:
# Remove Textwrap
jaString = codeList[i]["parameters"][0]
jaString = jaString.replace("\n", " ")
# If there isn't any Japanese in the text just skip
if not re.search(LANGREGEX, jaString):
i += 1
continue
if "secretText" in jaString:
regex = r"secretText:\s?(.+)"
elif "title" in jaString:
regex = r"title:\s?(.+)"
# Pass 1
if setData:
list408.append(jaString)
# Pass 2
else:
regex = r"(.+)"
# Need to remove outside code and put it back later
matchList = re.findall(regex, jaString)
for match in matchList:
# Remove Textwrap
match = match.replace("\n", " ")
response = translateGPT(
match,
"Reply with the " + LANGUAGE + " translation of the achievement title.",
False,
)
translatedText = response[0]
totalTokens[0] += response[1][0]
totalTokens[1] += response[1][1]
# Replace
translatedText = jaString.replace(match, translatedText)
# Remove characters that may break scripts
charList = [".", '"', "\\n"]
for char in charList:
translatedText = translatedText.replace(char, "")
translatedText = list408[0]
list408.pop(0)
# Textwrap
translatedText = textwrap.fill(translatedText, width=WIDTH)
# translatedText = textwrap.fill(translatedText, width=LISTWIDTH)
# Set Data
codeList[i]["parameters"][0] = translatedText
translatedText = jaString.replace("\\fs[18]", "")
codeList[i]["parameters"][0] = f"\\fs[18]{translatedText}"
## Event Code: 108 (Script)
if "code" in codeList[i] and (codeList[i]["code"] == 108) and CODE108 is True:
@ -1882,7 +1778,7 @@ def searchCodes(page, pbar, jobList, filename):
list356.pop(0)
if "namePop" in jaString:
matchList = re.findall(r"namePop\s\d+\s(.+?)\s.+", jaString)
matchList = re.findall(r"<namePop:(.*?)\s?[\d-]+?", jaString)
if len(matchList) > 0:
# Translate
text = matchList[0]
@ -2115,6 +2011,7 @@ def searchCodes(page, pbar, jobList, filename):
# EOF
list401TL = []
list408TL = []
list122TL = []
list356TL = []
list357TL = []
@ -2188,12 +2085,23 @@ def searchCodes(page, pbar, jobList, filename):
if filename not in MISMATCH:
MISMATCH.append(filename)
# 408
if len(list408) > 0:
response = translateGPT(list408, "", True)
list408TL = response[0]
totalTokens[0] += response[1][0]
totalTokens[1] += response[1][1]
if len(list408TL) != len(list408):
with LOCK:
if filename not in MISMATCH:
MISMATCH.append(filename)
# Start Pass 2
if setData:
searchCodes(
page,
pbar,
[list401TL, list122TL, list355655TL, list108TL, list356TL, list357TL],
[list401TL, list122TL, list355655TL, list108TL, list356TL, list357TL, list408TL],
filename,
)
@ -2354,6 +2262,10 @@ Translate 'Taroを倒した' as 'Taro was defeated!'",
noteResponse = translateNote(state, r"<ShowHoverState:\s?(.+?)>")
totalTokens[0] += noteResponse[0]
totalTokens[1] += noteResponse[1]
if "<Detail" in state["note"]:
noteResponse = translateNote(state, r"<Detail:\s?(.+?)>")
totalTokens[0] += noteResponse[0]
totalTokens[1] += noteResponse[1]
# Count totalTokens
totalTokens[0] += nameResponse[1][0] if nameResponse != "" else 0

View file

@ -85,8 +85,8 @@ CODE101 = False
CODE102 = False
# Set String (Fragile but necessary)
CODE122 = True
CODE150 = False
CODE122 = False
CODE150 = True
# Other
CODE210 = False
@ -265,11 +265,13 @@ def searchCodes(events, pbar, jobList, filename):
stringList = jobList[0]
list210 = jobList[1]
list300 = jobList[2]
list150TL = jobList[3] # Add this line
setData = True
else:
stringList = []
list210 = []
list300 = []
list150TL = [] # Add this line
setData = False
# Other
@ -300,7 +302,7 @@ def searchCodes(events, pbar, jobList, filename):
while i < len(codeList):
### Event Code: 101 Message
if codeList[i]["code"] == 101 and CODE101 == True:
speakerRegex = r"@\d+\r?\n(.*)\r?\n" # Default: r"@\d+\r?\n(.*)\r?\n"
speakerRegex = r"^(.+?)\n" # Default: r"@\d+\r?\n(.*)\r?\n"
textRegex = r"@?\d*\r?\n?\u3000*([\w\W]+)\r?\n?" # Default: r"@?\d*\r?\n?\u3000*([\w\W]+)\r?\n?"
# Grab String
@ -308,7 +310,7 @@ def searchCodes(events, pbar, jobList, filename):
speaker = ""
# Grab Speaker
if "\n" in jaString or "\r\n" in jaString:
if "\n" in jaString:
match = re.search(speakerRegex, jaString)
if match:
# TL Speaker
@ -370,9 +372,13 @@ def searchCodes(events, pbar, jobList, filename):
choiceList.append(jaChoiceList[j])
# Translate
if 'jaString' in locals():
choiceString = f"Previous Line: {jaString}\n\nReply with the {LANGUAGE} translation of the dialogue choice"
else:
choiceString = f"Reply with the {LANGUAGE} translation of the dialogue choice"
response = translateGPT(
choiceList,
f"Reply with the {LANGUAGE} translation of the dialogue choice",
choiceString,
True,
)
translatedChoiceList = response[0]
@ -439,7 +445,7 @@ def searchCodes(events, pbar, jobList, filename):
originalString = jaString
# Remove Textwrap
jaString = jaString.replace('\n', ' ')
# jaString = jaString.replace('\n', ' ')
# Translate Conversations
if "Nothing" in jaString:
@ -497,14 +503,15 @@ def searchCodes(events, pbar, jobList, filename):
totalTokens[1] += response[1][1]
# Textwrap
translatedText = textwrap.fill(translatedText, 30)
# translatedText = textwrap.fill(translatedText, 30)
# Set String
codeList[i]["stringArgs"][0] = codeList[i]["stringArgs"][0].replace(originalString, translatedText)
### Event Code: 150 Picture String
if codeList[i]["code"] == 150 and CODE150 == True:
if "stringArgs" in codeList[i] and len(codeList[i]["stringArgs"]) > 0:
if "stringArgs" in codeList[i] and len(codeList[i]["stringArgs"]) > 0:
font150 = "\\f[8]"
# Grab String
jaString = re.search(r"^\n?(.*)\n?$", codeList[i]["stringArgs"][0])
if jaString:
@ -512,9 +519,14 @@ def searchCodes(events, pbar, jobList, filename):
else:
jaString = codeList[i]["stringArgs"][0]
# Japanses Text Only
if not re.search(r"[一-龠ぁ-ゔァ-ヴーa---]+", jaString):
i += 1
continue
# Remove Textwrap
jaString = jaString.replace("\n", " ")
jaString = jaString.replace("\r", "")
# jaString = jaString.replace("\n", " ")
# jaString = jaString.replace("\r", "")
# Translate Other Strings [Specific Files Only]
if (
@ -523,24 +535,25 @@ def searchCodes(events, pbar, jobList, filename):
and "_" not in jaString
and '",' not in jaString
and "/" not in jaString
and ">" not in jaString
and "<" not in jaString
):
# Japanese Text Only
if re.search(r"[一-龠ぁ-ゔァ-ヴーa---]+", jaString):
# Translate
response = translateGPT(
jaString,
f"Reply with the {LANGUAGE} translation of the text",
True,
)
translatedText = response[0]
totalTokens[0] += response[1][0]
totalTokens[1] += response[1][1]
# Pass 1 (Save Text to List)
if not setData:
list150TL.append(jaString)
# Pass 2 (Set Text)
else:
translatedText = list150TL[0]
# Textwrap
translatedText = textwrap.fill(translatedText, WIDTH)
# translatedText = textwrap.fill(translatedText, WIDTH)
# Set String
codeList[i]["stringArgs"][0] = translatedText
# Set String with font formatting
codeList[i]["stringArgs"][0] = re.sub(r'\\f\[(\d+)\]', lambda x: f'\\f[{int(x.group(1))-2}]', translatedText)
# Pop processed item
list150TL.pop(0)
### Event Code: 300 Common Events
if codeList[i]["code"] == 300 and CODE300 == True and "stringArgs" in codeList[i] and len(codeList[i]["stringArgs"]) > 1:
@ -750,10 +763,37 @@ def searchCodes(events, pbar, jobList, filename):
else:
setData = True
# Pass 2
if setData:
# 150 List
if len(list150TL) > 0:
# Progress Bar
pbar.total = len(list150TL)
pbar.refresh()
# Translate
response = translateGPT(
list150TL,
textHistory,
True,
)
stringList150TL = response[0]
totalTokens[0] += response[1][0]
totalTokens[1] += response[1][1]
# Check Mismatch
if len(stringList150TL) != len(list150TL):
with LOCK:
if filename not in MISMATCH:
MISMATCH.append(filename)
else:
list150TL = stringList150TL
setData = True
# Update jobList before recursive call
if setData == True:
stringList = []
searchCodes(events, pbar, [stringListTL, list210TL, list300TL], filename)
jobList = [stringListTL, list210TL, list300TL, list150TL] # Add list150TL
searchCodes(events, pbar, jobList, filename)
else:
# Set Data
events = codeList
@ -974,7 +1014,7 @@ def searchDB(events, pbar, jobList, filename):
# Pass 2 (Set Data)
else:
if dataList[j].get("value") != "":
dataList[j].update({"value": choiceList[0][0]})
dataList[j].update({"value": optionsList[0][0]})
optionsList[0].pop(0)
# Description

192
vocab.txt
View file

@ -1,153 +1,19 @@
Here are some vocabulary and terms so that you know the proper spelling and translation.
```
# Game Characters
ネイビス (Neibis) - Male
ビダール (Bidal) - Male
エルニン (Elnin) - Female
メマ (Mema) - Female
教皇 (Pope) - Female
ボルカヌス (Volcanus) - Male
トリスリタン (Trisritan) - Female
ノビッサ (Novissa) - Male
ルー (Rue) - Female
エルニン (Elnin) - Female
ギロ (Giro) - Female
クスミ (Kusumi) - Female
パラコーン (Paracon) - Female
チヤ (Chiya) - Female
コアンタ (Koanta) - Female
ハイプリ神官長 (High Priest Haipri) - Female
メマ (Mema) - Female
ハノン (Hanon) - Female
ミッシェル (Michelle) - Female
エクスキューショナー (Executioner) - Female
オーガトゥース (Ogretooth) - Female
ミステルテイン (Misteltein) - Female
シャシー (Shashi) - Female
ルセーダ (Luceda) - Female
プリン (Purin) - Female
アンベル (Amber) - Female
アンカープ (Anchorp) - Female
ヨルク (Yoruku) - Female
ハーター (Harter) - Female
コキューン (Cocoon) - Male
ビルドルフ - Male
ゼロジー (Zero-G) - Male
ベルマ (Belma) - Male
ヴォルゼブ (Volzeb) - Male
# Enemies (Mostly Female)
透明君 (Transparent-kun)
ゼリン (Zerin)
ミリア (Milia)
マヤ (Maya)
ミステルテイン (Misteltein)
怪しい二人組 (Suspicious Duo)
ガレオン (Galion)
グリフォン (Griffon)
キッスプラント (Kiss Plant)
ゴーレム (Golem)
所属不明(ゴーグル) (Unknown Affiliation (Goggles))
所属不明(マスク) (Unknown Affiliation (Mask))
憲兵 (Military Police)
トニオ (Tonio)
ロベルタ (Roberta)
アモーレ (Amore)
ビタラ (Vitata)
軍隊砂漠蟻 (Desert Army Ant)
盗賊 (Thief)
鳥人間(槍) (Birdman (Spear))
鳥人間 (Birdman)
ガーツ (Gartz)
アイスアー (Ice Arrow)
フリーズゴーレム (Freeze Golem)
ハーティー (Harty)
トリスリタン (Trisritan)
ハノン (Hanon)
マグゼリン (Magzellin)
バーストリアー (Burstrier)
インプ (Imp)
フェーニ (Feny)
トールドラゴン (Thor Dragon)
イフリート (Ifrit)
ターゼリン (Tazerin)
ハーパキャット (Harpercat)
ヨヨ (Yoyo)
野良ガーディアン (Stray Guardian)
グルームの牙 (Groom's Fang)
ハプリコーン (Harpricorn)
聖十字隊 (Holy Cross Squad)
フレイア教徒 (Freya Cultist)
プリースト (Priest)
フレイア神官 (Freya Priest)
チヤ (Chiya)
コアンタ (Koanta)
パラコーン (Paracon)
ムラタン (Muratan)
コアハンター (Core Hunter)
イヴ (Eve)
レタ (Leta)
ダークレタ (Dark Leta)
ババヤン (Babayan)
沼の魔女 (Swamp Witch)
マヴィチャ (Mavicha)
ビヨンド (Beyond)
セイバーガーディアン (Saber Guardian)
アーチャーガーディアン (Archer Guardian)
エクスキューショナー (Executioner)
オーガトゥース (Orgatous)
ギロ (Giro)
ドイレン=ベッシェ (Doiren=Besshe)
エレメェス=ショーサ (Eremees=Shosa)
ローレンス=ランブル (Lawrence=Rumble)
グレムリン (Gremlin)
ドゲザエ (Dogezae)
心を失った者 (The Heartless)
エキューオ (Equio)
エルニン (Elnin)
グルームの夜 (Gloom's Night)
ラギッドグール (Ragged Ghoul)
デスプードル (Death Poodle)
グールデストロイ (Ghoul Destroyer)
ヴァンシィ (Banshee)
ネクロマンサー (Necromancer)
ヘルチョンチョニ (Hell Chonchoni)
羽蟲の魔物 (Winged Insect Monster)
堕ちた大神官フィーヴァム (Fallen High Priest Fivam)
ヴィージヨ (Vijyo)
ヴェルセブブ (Versebub)
親衛隊トニオ (Royal Guard Tonio)
親衛隊ロベルタ (Royal Guard Roberta)
親衛隊アモーレ (Royal Guard Amore)
女王親衛隊 (Queen's Royal Guard)
マヤゴールド (Mayagold)
クィーンハーピー (Queen Harpy)
イクリプス (Eclipse)
マスクドフレイア (Masked Freya)
クルトラナッソス (Cultranassus)
サイドワインダー (Sidewinder)
マーリン (Merlin)
トレント=イニー (Trent=Inny)
アストロス (Astros)
タンクウガ (Tankuga)
ヴィーゴニク (Vigonik)
スラムのゴロツキ (Slum Thug)
スライム娘 (Slime Girl)
ジェネラルマーメイド (General Mermaid)
ヴァルキリー (Valkyrie)
防衛装置 (Defense Device)
ヘルヴァンシー (Helvancy)
マーガレット=ソニア (Margaret=Sonia)
ガーディアン改修型 (Modified Guardian)
イグゼニム (Igzenim)
アビスガード (Abyss Guard)
ルカ=ドッペル (Luca=Doppel)
シグルドリーヴァ (Sigurdrieva)
オニール (O'Neill)
訓練兵たち (Trainees)
没オニール (Dead O'Neill)
没オニール使う枠 (Dead O'Neill Slot)
聖十字隊副隊長 (Holy Cross Squad Vice-Captain)
姫野 彩羽 (Himeno Iroha) - Female
朝樹 (Asaki) - Male
リリィ (Lily) - Female
佐井 民太郎 (Sai Mintaro) - Male
鐘尾原 真久 (Kaneobara Maku) - Male
岡根 梨 (Okane Nashi) - Female
藍場 結奈 (Aiba Yuna) - Female
スーティ (Suti) - Female
収集家レティシア (Collector Leticia) - Female
アルフ (Alf) - Male
カドーナ (Kadona) - Female
保田区くん (Potaku-kun) - Male
衿澄 雫 (Erisumi Shizuku) - Female
# Lewd Terms
マンコ (pussy)
@ -241,6 +107,8 @@ ME 音量 (ME Volume)
魂 (Soul)
巫女 (Shrine Maiden)
刀 (Sword)
龍神神社 (Dragon God Shrine)
# Demons/Angels/Monsters
悪魔 (Devil)
@ -267,6 +135,7 @@ ME 音量 (ME Volume)
幽鬼 (Revenant)
デーモン (Daemon)
ローバー (Roper)
夢魔 (Succubus)
# Other
w ((lol))
@ -275,21 +144,16 @@ w ((lol))
』 (』)
# Game Specific
フレイア大神殿 (Freya Grand Temple)
スードリ草原 (Sudri Grasslands)
ポルナトル渓谷 (Polnator Valley)
ホテル・ドラゴンエンペラー (Hotel Dragon Emperor)
バレルゼン路地裏 (Barrelzen Back Alley)
ビルドルフの部屋 (Bildolf's Room)
ベインスゥ・酒場 (Veins Tavern)
ムジョルニア火山01 (Mujornia Volcano 01)
ラ・フェール歓楽街 (Ra Feele Pleasure District)
ジェマの部屋 (Jema's Room)
ベルマの研究室 (Belma's Laboratory)
エユタヤー (Eyutaya)
ヴォルゼブの部屋 (Wolfchev's Room)
モスフィア島 (Mosfia Island)
バー・止まり木 (Bar・Perch)
バー・スクサマッド (Bar・Sukusamadd)
ラフェルムーン (Rafel Moon)
すけモン (Sukemon)
夢見町 (Dream Town)
夢見学 (Dream Academy)
龍神神社 (Dragon God Shrine)
鐘尾原 (Kaneohara)
カドーナ (Kadona)
助平の湯 (Lewd Bath)
リーゴ (Ligo)
サキュバンク (Succubank)
ジャーク堂書店 (Jerkdo Bookstore)
風紀委員は女淫魔の夢を見るか? (Do Disciplinary Committee Members Dream of Succubi?)
```