More ace changes and other
This commit is contained in:
parent
06106315ff
commit
ceda9b5fbf
5 changed files with 506 additions and 86 deletions
|
|
@ -63,7 +63,7 @@ THREADS = int(os.getenv("fileThreads"))
|
|||
# [Display name, file extension, handle function]
|
||||
MODULES = [
|
||||
["RPGMaker MV/MZ", ["json"], handleMVMZ],
|
||||
["RPGMaker Plugins", ["js"], handlePlugin],
|
||||
["RPGMaker Plugins", ["js", "rb"], handlePlugin],
|
||||
["RPGMaker ACE", ["yaml"], handleACE],
|
||||
["CSV (From Translator++)", ["csv"], handleCSV],
|
||||
["Eushully", ["txt"], handleEushully],
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import time
|
|||
import traceback
|
||||
import tiktoken
|
||||
import openai
|
||||
import copy
|
||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||
from pathlib import Path
|
||||
from colorama import Fore
|
||||
|
|
@ -82,9 +83,9 @@ POSITION = 0
|
|||
LEAVE = False
|
||||
|
||||
# Dialogue / Scroll / Choices (Main Codes)
|
||||
CODE401 = True
|
||||
CODE405 = True
|
||||
CODE102 = True
|
||||
CODE401 = False
|
||||
CODE405 = False
|
||||
CODE102 = False
|
||||
|
||||
# Optional
|
||||
CODE101 = False # Turn this one when names exist in 101
|
||||
|
|
@ -94,8 +95,8 @@ CODE408 = False # Warning, translates comments and can inflate costs.
|
|||
CODE122 = False
|
||||
|
||||
# Other
|
||||
CODE355655 = False
|
||||
CODE357 = True
|
||||
CODE355655 = True
|
||||
CODE357 = False
|
||||
CODE657 = False
|
||||
CODE356 = False
|
||||
CODE320 = False
|
||||
|
|
@ -271,6 +272,11 @@ def parseMap(data, filename):
|
|||
with ThreadPoolExecutor(max_workers=THREADS) as executor:
|
||||
for key in events:
|
||||
if key is not None:
|
||||
# This translates ID of events. (May break the game)
|
||||
if "<namepop" in events[key]["name"]:
|
||||
response = translateNoteOmitSpace(events[key], r"<namepop\s(.*?)\s?\d?>.*")
|
||||
totalTokens[0] += response[0]
|
||||
totalTokens[1] += response[1]
|
||||
futures = [executor.submit(searchCodes, page, pbar, [], filename) for page in events[key]["pages"] if page is not None]
|
||||
for future in as_completed(futures):
|
||||
try:
|
||||
|
|
@ -311,9 +317,10 @@ def translateNote(event, regex, wrap=True):
|
|||
# Textwrap
|
||||
if wrap:
|
||||
translatedText = textwrap.fill(translatedText, width=NOTEWIDTH)
|
||||
translatedText = translatedText.replace("\n", "\\n")
|
||||
# translatedText = translatedText.replace("\n", "\\n")
|
||||
|
||||
translatedText = translatedText.replace('"', "")
|
||||
translatedText = translatedText.replace(' ', "_")
|
||||
jaString = jaString.replace(initialJAString, translatedText)
|
||||
event["note"] = jaString
|
||||
i += 1
|
||||
|
|
@ -324,7 +331,7 @@ def translateNote(event, regex, wrap=True):
|
|||
# For notes that can't have spaces.
|
||||
def translateNoteOmitSpace(event, regex):
|
||||
# Regex that only matches text inside LB.
|
||||
jaString = event["note"]
|
||||
jaString = event["name"]
|
||||
|
||||
match = re.findall(regex, jaString, re.DOTALL)
|
||||
if match:
|
||||
|
|
@ -342,7 +349,7 @@ def translateNoteOmitSpace(event, regex):
|
|||
|
||||
translatedText = translatedText.replace('"', "")
|
||||
translatedText = translatedText.replace(" ", "_")
|
||||
event["note"] = event["note"].replace(oldJAString, translatedText)
|
||||
event["name"] = event["name"].replace(oldJAString, translatedText)
|
||||
return response[1]
|
||||
return [0, 0]
|
||||
|
||||
|
|
@ -654,6 +661,10 @@ 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"<習得ヘルプ=前提スキル:(.+?)>")
|
||||
totalTokens[0] += tokensResponse[0]
|
||||
totalTokens[1] += tokensResponse[1]
|
||||
|
||||
i += 1
|
||||
else:
|
||||
|
|
@ -763,7 +774,7 @@ def searchNames(data, pbar, context):
|
|||
translatedNameBatch.pop(0)
|
||||
if "description" in data[j] and data[j]["description"] != "":
|
||||
translatedText = textwrap.fill(translatedDescriptionBatch[0], LISTWIDTH)
|
||||
translatedText = translatedText.replace("\n", "\\n")
|
||||
# translatedText = translatedText.replace("\n", "\\n")
|
||||
data[j]["description"] = translatedText
|
||||
translatedDescriptionBatch.pop(0)
|
||||
|
||||
|
|
@ -941,6 +952,10 @@ def searchCodes(page, pbar, jobList, filename):
|
|||
else:
|
||||
speakerList = [speakerList[0][1]]
|
||||
|
||||
# Diamonds
|
||||
if len(speakerList) == 0:
|
||||
speakerList = re.findall(r"^◆(.*)", jaString)
|
||||
|
||||
# Colors
|
||||
if len(speakerList) == 0:
|
||||
speakerList = re.findall(
|
||||
|
|
@ -1144,10 +1159,10 @@ def searchCodes(page, pbar, jobList, filename):
|
|||
|
||||
if FIXTEXTWRAP is True and "_ABL" in nametag:
|
||||
translatedText = textwrap.fill(translatedText, width=100)
|
||||
translatedText = translatedText.replace("\n", "\\n")
|
||||
# # translatedText = translatedText.replace("\n", "\\n")
|
||||
elif FIXTEXTWRAP is True:
|
||||
translatedText = textwrap.fill(translatedText, width=WIDTH)
|
||||
translatedText = translatedText.replace("\n", "\\n")
|
||||
# # translatedText = translatedText.replace("\n", "\\n")
|
||||
|
||||
# BR Flag
|
||||
if BRFLAG is True:
|
||||
|
|
@ -1178,19 +1193,42 @@ def searchCodes(page, pbar, jobList, filename):
|
|||
translatedText = translatedText + endtag
|
||||
endtag = ""
|
||||
|
||||
# Set Data
|
||||
codeList[j]["p"] = [translatedText]
|
||||
# Set Code
|
||||
codeList[j]["c"] = code
|
||||
|
||||
# Handle 405
|
||||
if codeList[j]["c"] == 405:
|
||||
# 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"]
|
||||
codeList[j]["p"] = [lines[0]]
|
||||
|
||||
# 3. Make copies for each additional line and insert them
|
||||
for idx, line in enumerate(lines[1:]):
|
||||
new_item = copy.deepcopy(codeList[j])
|
||||
new_item["p"] = [line]
|
||||
codeList.insert(j + idx + 1, new_item)
|
||||
|
||||
# 4. Update syncIndex to the last modified/added position
|
||||
syncIndex = j + len(lines)
|
||||
|
||||
# Handle 401
|
||||
else:
|
||||
codeList[j]["p"] = [translatedText]
|
||||
codeList[j]["c"] = code
|
||||
syncIndex = i + 1
|
||||
|
||||
# Reset
|
||||
speaker = ""
|
||||
match = []
|
||||
currentGroup = []
|
||||
syncIndex = i + 1
|
||||
list401.pop(0)
|
||||
|
||||
## Event Code: 122 [Set Variables]
|
||||
if "c" in codeList[i] and codeList[i]["c"] == 122 and CODE122 is True:
|
||||
# This is going to be the var being set. (IMPORTANT)
|
||||
if codeList[i]["p"][0] not in list(range(20, 150)):
|
||||
if codeList[i]["p"][0] not in list(range(0, 1500)):
|
||||
i += 1
|
||||
continue
|
||||
|
||||
|
|
@ -1237,16 +1275,16 @@ def searchCodes(page, pbar, jobList, filename):
|
|||
translatedText = jaString.replace(jaString, translatedText)
|
||||
|
||||
# Remove characters that may break scripts
|
||||
charList = ['"', "\\n"]
|
||||
charList = ['"', "\\n", "'"]
|
||||
for char in charList:
|
||||
translatedText = translatedText.replace(char, "")
|
||||
|
||||
# Textwrap
|
||||
translatedText = textwrap.fill(translatedText, width=WIDTH)
|
||||
translatedText = translatedText.replace("\n", "\\n")
|
||||
# translatedText = translatedText.replace("\n", "\\n")
|
||||
|
||||
# Set
|
||||
codeList[i]["p"][4] = f"`{translatedText}`"
|
||||
codeList[i]["p"][4] = f'"{translatedText}"'
|
||||
list122.pop(0)
|
||||
|
||||
## Event Code: 357 [Picture Text] [Optional]
|
||||
|
|
@ -1295,7 +1333,7 @@ def searchCodes(page, pbar, jobList, filename):
|
|||
|
||||
# Textwrap
|
||||
# translatedText = textwrap.fill(translatedText, 80)
|
||||
# translatedText = translatedText.replace("\n", "\\n")
|
||||
# # translatedText = translatedText.replace("\n", "\\n")
|
||||
# translatedText = re.sub(r"[\\]+c", r"\\\\c", translatedText)
|
||||
translatedText = re.sub(r"[\\]+\*item", r"\\\\*item", translatedText)
|
||||
|
||||
|
|
@ -1344,7 +1382,7 @@ def searchCodes(page, pbar, jobList, filename):
|
|||
|
||||
# Textwrap & Set
|
||||
translatedText = textwrap.fill(translatedText, width=WIDTH)
|
||||
translatedText = translatedText.replace("\n", "\\n")
|
||||
# translatedText = translatedText.replace("\n", "\\n")
|
||||
codeList[i]["p"][3]["messageText"] = translatedText
|
||||
|
||||
### Choices
|
||||
|
|
@ -1417,7 +1455,7 @@ def searchCodes(page, pbar, jobList, filename):
|
|||
|
||||
# Textwrap
|
||||
translatedText = textwrap.fill(translatedText, width=WIDTH)
|
||||
translatedText = translatedText.replace("\n", "\\n")
|
||||
# translatedText = translatedText.replace("\n", "\\n")
|
||||
translatedText = startString + translatedText + endString
|
||||
|
||||
# Set Data
|
||||
|
|
@ -1515,19 +1553,28 @@ 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]
|
||||
regexPatterns = [r'^"?([^=+_$]+[^")])"?\)?$']
|
||||
|
||||
# Iterate over the list of regex patterns
|
||||
for regex in regexPatterns:
|
||||
if "テキスト-" in jaString:
|
||||
jaString = codeList[i]["p"][0]
|
||||
regex = r"テキスト-(.+)"
|
||||
|
||||
# Check Exist
|
||||
match = re.search(regex, jaString)
|
||||
if re.search(regex, jaString):
|
||||
if match.group(1) and match.group(1) != "\u3000":
|
||||
finalJAString = match.group(1)
|
||||
if match:
|
||||
replaceString = match.group(1)
|
||||
finalJAString = replaceString
|
||||
|
||||
# Remove Textwrap
|
||||
finalJAString = finalJAString.replace("\\n", " ")
|
||||
# Remove Textwrap
|
||||
# finalJAString = finalJAString.replace("\n", " ")
|
||||
|
||||
# Remove Spaces
|
||||
finalJAString = finalJAString.replace("\u3000", "")
|
||||
finalJAString = finalJAString.strip()
|
||||
|
||||
# Final Set
|
||||
if finalJAString:
|
||||
# Pass 1
|
||||
if setData is False:
|
||||
if setData:
|
||||
list355655.append(finalJAString)
|
||||
|
||||
# Pass 2
|
||||
|
|
@ -1535,14 +1582,228 @@ def searchCodes(page, pbar, jobList, filename):
|
|||
# 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)
|
||||
translatedText = translatedText.replace("\n", "\\n")
|
||||
# translatedText = textwrap.fill(translatedText, width=WIDTH)
|
||||
|
||||
# Set
|
||||
codeList[i]["p"][0] = codeList[i]["p"][0].replace(finalJAString, translatedText)
|
||||
codeList[i]["p"][0] = codeList[i]["p"][0].replace(replaceString, translatedText)
|
||||
list355655.pop(0)
|
||||
|
||||
## Event Code: 408 (Script)
|
||||
|
|
@ -1587,7 +1848,7 @@ def searchCodes(page, pbar, jobList, filename):
|
|||
|
||||
# Textwrap
|
||||
translatedText = textwrap.fill(translatedText, width=WIDTH)
|
||||
translatedText = translatedText.replace("\n", "\\n")
|
||||
# translatedText = translatedText.replace("\n", "\\n")
|
||||
|
||||
# Set Data
|
||||
codeList[i]["p"][0] = translatedText
|
||||
|
|
@ -1610,6 +1871,8 @@ def searchCodes(page, pbar, jobList, filename):
|
|||
regex = r"event_text\s*:\s*(.*)"
|
||||
elif "拡張選択肢" in jaString:
|
||||
regex = r"拡張選択肢.+?\[(.+)"
|
||||
elif "namepop" in jaString:
|
||||
regex = r"<namepop(.+)>"
|
||||
else:
|
||||
i += 1
|
||||
continue
|
||||
|
|
@ -1639,7 +1902,7 @@ def searchCodes(page, pbar, jobList, filename):
|
|||
# Textwrap
|
||||
# if codeList[i + 1]["c"] == 408:
|
||||
# translatedText = textwrap.fill(translatedText, WIDTH)
|
||||
# translatedText = translatedText.replace("\n", "\\n")
|
||||
# # translatedText = translatedText.replace("\n", "\\n")
|
||||
|
||||
# Remove characters that may break scripts
|
||||
charList = ['"']
|
||||
|
|
@ -1647,6 +1910,12 @@ def searchCodes(page, pbar, jobList, filename):
|
|||
translatedText = translatedText.replace(char, "")
|
||||
translatedText = translatedText.replace('"', '"')
|
||||
# translatedText = translatedText.replace(" ", "_")
|
||||
|
||||
# Namepop
|
||||
if "namepop" in jaString:
|
||||
translatedText = translatedText.replace(" ", "_")
|
||||
|
||||
# Replace Original String
|
||||
translatedText = jaString.replace(match.group(1), translatedText)
|
||||
|
||||
# Add >
|
||||
|
|
@ -1793,7 +2062,7 @@ def searchCodes(page, pbar, jobList, filename):
|
|||
|
||||
# Textwrap & Replace Whitespace
|
||||
translatedText = textwrap.fill(translatedText, width=WIDTH)
|
||||
translatedText = translatedText.replace("\n", "\\n")
|
||||
# translatedText = translatedText.replace("\n", "\\n")
|
||||
translatedText = translatedText.replace(" ", "_")
|
||||
|
||||
# Replace and Set
|
||||
|
|
@ -2248,7 +2517,7 @@ Translate 'Taroを倒した!' as 'Taro was defeated!'",
|
|||
# Textwrap
|
||||
translatedText = descriptionResponse[0]
|
||||
translatedText = textwrap.fill(translatedText, width=LISTWIDTH)
|
||||
translatedText = translatedText.replace("\n", "\\n")
|
||||
# translatedText = translatedText.replace("\n", "\\n")
|
||||
state["description"] = translatedText.replace('"', "")
|
||||
if "message1" in state:
|
||||
state["message1"] = message1Response[0].replace('"', "").replace("Taro", "")
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import time
|
|||
import traceback
|
||||
import tiktoken
|
||||
import openai
|
||||
import copy
|
||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||
from pathlib import Path
|
||||
from colorama import Fore
|
||||
|
|
@ -1201,13 +1202,36 @@ def searchCodes(page, pbar, jobList, filename):
|
|||
translatedText = translatedText + endtag
|
||||
endtag = ""
|
||||
|
||||
# Set Data
|
||||
codeList[j]["parameters"] = [translatedText]
|
||||
# Set Code
|
||||
codeList[j]["code"] = code
|
||||
|
||||
# Handle 405
|
||||
if codeList[j]["code"] == 405:
|
||||
# 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"]
|
||||
codeList[j]["parameters"] = [lines[0]]
|
||||
|
||||
# 3. Make copies for each additional line and insert them
|
||||
for idx, line in enumerate(lines[1:]):
|
||||
new_item = copy.deepcopy(codeList[j])
|
||||
new_item["parameters"] = [line]
|
||||
codeList.insert(j + idx + 1, new_item)
|
||||
|
||||
# 4. Update syncIndex to the last modified/added position
|
||||
syncIndex = j + len(lines)
|
||||
|
||||
# Handle 401
|
||||
else:
|
||||
codeList[j]["parameters"] = [translatedText]
|
||||
codeList[j]["code"] = code
|
||||
syncIndex = i + 1
|
||||
|
||||
# Reset
|
||||
speaker = ""
|
||||
match = []
|
||||
currentGroup = []
|
||||
syncIndex = i + 1
|
||||
list401.pop(0)
|
||||
|
||||
## Event Code: 122 [Set Variables]
|
||||
|
|
@ -1565,44 +1589,6 @@ def searchCodes(page, pbar, jobList, filename):
|
|||
codeList[i]["parameters"][0] = codeList[i]["parameters"][0].replace(replaceString, translatedText)
|
||||
list355655.pop(0)
|
||||
|
||||
# Grab Next Instead if Text
|
||||
elif "テキスト" in jaString:
|
||||
i += 1
|
||||
jaString = codeList[i]["parameters"][0]
|
||||
|
||||
# Regex
|
||||
regex = r'setValue\(\d+,[\\]?"([^_]+)"'
|
||||
|
||||
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()
|
||||
|
||||
# Pass 1
|
||||
if finalJAString:
|
||||
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 "logtxt = " in jaString:
|
||||
jaString = codeList[i]["parameters"][0]
|
||||
regex = r"logtxt\s=\s'(.+)'"
|
||||
|
|
@ -2609,6 +2595,8 @@ def cleanTranslatedText(translatedText):
|
|||
"this guy": "this bastard",
|
||||
"This guy": "This bastard",
|
||||
"Placeholder Text": "",
|
||||
"```json": "",
|
||||
"```": "",
|
||||
# Add more replacements as needed
|
||||
}
|
||||
for target, replacement in placeholders.items():
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ def translatePlugin(data, pbar, filename, translatedList):
|
|||
colorCode = r"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\C"
|
||||
|
||||
# Custom
|
||||
regex = r'"description":\s"(.+?)",?$'
|
||||
regex = r'=\s\[".+?",\s"(.+)"\]'
|
||||
matchList = re.findall(regex, data[i])
|
||||
if len(matchList) > 0:
|
||||
for match in matchList:
|
||||
|
|
@ -243,7 +243,7 @@ def translatePlugin(data, pbar, filename, translatedList):
|
|||
translatedText = re.sub(r"([^\\'])\"", r"\1\\'", translatedText)
|
||||
|
||||
# Textwrap
|
||||
# translatedText = textwrap.fill(translatedText, WIDTH)
|
||||
translatedText = textwrap.fill(translatedText, WIDTH)
|
||||
|
||||
# Replace \n and \c
|
||||
translatedText = re.sub(r"\\+n", re.escape(newline), translatedText)
|
||||
|
|
|
|||
173
vocab.txt
173
vocab.txt
|
|
@ -1,7 +1,153 @@
|
|||
Here are some vocabulary and terms so that you know the proper spelling and translation.
|
||||
```
|
||||
# Game Characters
|
||||
愛里沙 (Arisa) - Female
|
||||
ネイビス (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)
|
||||
|
||||
# Lewd Terms
|
||||
マンコ (pussy)
|
||||
|
|
@ -44,6 +190,8 @@ Here are some vocabulary and terms so that you know the proper spelling and tran
|
|||
舐めた (Lick)
|
||||
舐められ (Licked By)
|
||||
衣装ごとの性行為回数 (Sex Acts per Outfit)
|
||||
回 (x)
|
||||
人 (x)
|
||||
|
||||
# Honorifics
|
||||
さん (san)
|
||||
|
|
@ -92,8 +240,7 @@ ME 音量 (ME Volume)
|
|||
破滅 (Destruction)
|
||||
魂 (Soul)
|
||||
巫女 (Shrine Maiden)
|
||||
回 (x)
|
||||
人 (x)
|
||||
刀 (Sword)
|
||||
|
||||
# Demons/Angels/Monsters
|
||||
悪魔 (Devil)
|
||||
|
|
@ -117,6 +264,7 @@ ME 音量 (ME Volume)
|
|||
妖怪 (Yokai)
|
||||
式神 (Shikigami)
|
||||
幽霊 (Ghost)
|
||||
幽鬼 (Revenant)
|
||||
デーモン (Daemon)
|
||||
ローバー (Roper)
|
||||
|
||||
|
|
@ -127,6 +275,21 @@ w ((lol))
|
|||
』 (』)
|
||||
|
||||
# Game Specific
|
||||
エロザウルス (Erozaurus)
|
||||
|
||||
フレイア大神殿 (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)
|
||||
```
|
||||
Loading…
Reference in a new issue