Some small changes
This commit is contained in:
parent
c728688c88
commit
8a21a8dd53
4 changed files with 55 additions and 50 deletions
|
|
@ -82,9 +82,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,7 +94,7 @@ CODE408 = False # Warning, translates comments and can inflate costs.
|
|||
CODE122 = False
|
||||
|
||||
# Other
|
||||
CODE355655 = False
|
||||
CODE355655 = True
|
||||
CODE357 = False
|
||||
CODE657 = False
|
||||
CODE356 = False
|
||||
|
|
@ -1515,26 +1515,35 @@ 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'ShowName\("(.+)"\)']
|
||||
regexPatterns = [r'^"?([^=+_$]+[^")])"?\)?$']
|
||||
|
||||
# Iterate over the list of regex patterns
|
||||
for regex in regexPatterns:
|
||||
match = re.search(regex, jaString)
|
||||
if re.search(regex, jaString):
|
||||
finalJAString = match.group(1)
|
||||
# Pass 1
|
||||
if setData is False:
|
||||
list355655.append(finalJAString)
|
||||
if match.group(1) and match.group(1) != "\u3000":
|
||||
finalJAString = match.group(1)
|
||||
|
||||
# Pass 2
|
||||
else:
|
||||
# Grab and Replace
|
||||
translatedText = list355655[0]
|
||||
translatedText = translatedText.replace("'", "\\'")
|
||||
# Remove Textwrap
|
||||
finalJAString = finalJAString.replace("\\n", " ")
|
||||
# Pass 1
|
||||
if setData is False:
|
||||
list355655.append(finalJAString)
|
||||
|
||||
# Set
|
||||
codeList[i]["p"][0] = codeList[i]["p"][0].replace(finalJAString, translatedText)
|
||||
list355655.pop(0)
|
||||
# Pass 2
|
||||
else:
|
||||
# Grab and Replace
|
||||
translatedText = list355655[0]
|
||||
translatedText = re.sub(r"(?<!\\)'", r"\\'", translatedText)
|
||||
translatedText = re.sub(r'(?<!\\)"', r'\\"', translatedText)
|
||||
|
||||
# Textwrap
|
||||
translatedText = textwrap.fill(translatedText, width=WIDTH)
|
||||
translatedText = translatedText.replace("\n", "\\n")
|
||||
|
||||
# Set
|
||||
codeList[i]["p"][0] = codeList[i]["p"][0].replace(finalJAString, translatedText)
|
||||
list355655.pop(0)
|
||||
|
||||
## Event Code: 408 (Script)
|
||||
if "c" in codeList[i] and (codeList[i]["c"] == 408) and CODE408 is True:
|
||||
|
|
|
|||
|
|
@ -1455,20 +1455,12 @@ def searchCodes(page, pbar, jobList, filename):
|
|||
continue
|
||||
|
||||
# Force Speaker using var
|
||||
if "\\ap[1左]" in jaString.lower() or "\\ap[1右]" in jaString.lower():
|
||||
speaker = "Cecily"
|
||||
if "memerisu" in jaString.lower():
|
||||
speaker = "Memerisu"
|
||||
i += 1
|
||||
continue
|
||||
elif "\\ap[2左]" in jaString.lower() or "\\ap[2右]" in jaString.lower():
|
||||
speaker = "Amelia"
|
||||
i += 1
|
||||
continue
|
||||
elif "\\ap[3左]" in jaString.lower() or "\\ap[3右]" in jaString.lower():
|
||||
speaker = "Henry"
|
||||
i += 1
|
||||
continue
|
||||
elif "\\ap[4左]" in jaString.lower() or "\\ap[4右]" in jaString.lower():
|
||||
speaker = "Oswald"
|
||||
elif "thina" in jaString.lower():
|
||||
speaker = "Tina"
|
||||
i += 1
|
||||
continue
|
||||
elif "\\ap" in jaString:
|
||||
|
|
@ -1531,6 +1523,10 @@ def searchCodes(page, pbar, jobList, filename):
|
|||
match = re.search(regex, jaString)
|
||||
if re.search(regex, jaString):
|
||||
finalJAString = match.group(1)
|
||||
|
||||
# Remove Textwrap
|
||||
finalJAString = finalJAString.replace("\n", " ")
|
||||
|
||||
# Pass 1
|
||||
if setData:
|
||||
list355655.append(finalJAString)
|
||||
|
|
@ -1541,6 +1537,9 @@ def searchCodes(page, pbar, jobList, filename):
|
|||
translatedText = list355655[0]
|
||||
translatedText = translatedText.replace("'", "\\'")
|
||||
|
||||
# Textwrap
|
||||
translatedText = textwrap.fill(translatedText, width=WIDTH)
|
||||
|
||||
# Set
|
||||
codeList[i]["parameters"][0] = codeList[i]["parameters"][0].replace(finalJAString, translatedText)
|
||||
list355655.pop(0)
|
||||
|
|
|
|||
|
|
@ -438,8 +438,8 @@ def searchCodes(events, pbar, jobList, filename):
|
|||
|
||||
originalString = jaString
|
||||
|
||||
# Textwrap
|
||||
# jaString = jaString.replace('\n', ' ')
|
||||
# Remove Textwrap
|
||||
jaString = jaString.replace('\n', ' ')
|
||||
|
||||
# Translate Conversations
|
||||
if ":Nothing" in jaString:
|
||||
|
|
@ -485,22 +485,22 @@ def searchCodes(events, pbar, jobList, filename):
|
|||
and "/" not in jaString
|
||||
):
|
||||
# Japanese Text Only
|
||||
if re.search(r"[一-龠ぁ-ゔァ-ヴーa-zA-Z0-9]+", jaString):
|
||||
# Translate
|
||||
response = translateGPT(
|
||||
jaString,
|
||||
f"Maintain any newlines and Reply with the {LANGUAGE} translation of the text",
|
||||
True,
|
||||
)
|
||||
translatedText = response[0]
|
||||
totalTokens[0] += response[1][0]
|
||||
totalTokens[1] += response[1][1]
|
||||
# if re.search(r"[一-龠ぁ-ゔァ-ヴーa-zA-Z0-9]+", jaString):
|
||||
# Translate
|
||||
response = translateGPT(
|
||||
jaString,
|
||||
f"Maintain any newlines and Reply with the {LANGUAGE} translation of the text",
|
||||
True,
|
||||
)
|
||||
translatedText = response[0]
|
||||
totalTokens[0] += response[1][0]
|
||||
totalTokens[1] += response[1][1]
|
||||
|
||||
# Textwrap
|
||||
# translatedText = textwrap.fill(translatedText, WIDTH)
|
||||
# Textwrap
|
||||
translatedText = textwrap.fill(translatedText, 30)
|
||||
|
||||
# Set String
|
||||
codeList[i]["stringArgs"][0] = codeList[i]["stringArgs"][0].replace(originalString, translatedText)
|
||||
# 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:
|
||||
|
|
|
|||
|
|
@ -1,11 +1,8 @@
|
|||
Here are some vocabulary and terms so that you know the proper spelling and translation.
|
||||
```
|
||||
# Game Characters
|
||||
イルル (Illul) - Neutral
|
||||
オペ子 (Opeko) - Female
|
||||
キョーコ (Kyoko) - Female
|
||||
サキュマ (Sakyuma) - Female
|
||||
ましろ (Mashiro) - Female
|
||||
メメリス (Memerisu) - Female
|
||||
ティーナ (Tina) - Female
|
||||
|
||||
# Lewd Terms
|
||||
マンコ (pussy)
|
||||
|
|
|
|||
Loading…
Reference in a new issue