Save changes
This commit is contained in:
parent
da871d6eb1
commit
33dcdf7256
5 changed files with 78 additions and 45 deletions
|
|
@ -183,11 +183,11 @@ def translateJSON(data, translatedList):
|
|||
i = 0
|
||||
|
||||
while i < len(data):
|
||||
speakerKey = "name"
|
||||
messageKey = "message"
|
||||
speakerKey = "character_nameText"
|
||||
messageKey = "m_text"
|
||||
|
||||
# Speaker
|
||||
if speakerKey in data[i]:
|
||||
if speakerKey in data[i] and data[i][speakerKey]:
|
||||
# Grab and TL
|
||||
speaker = data[i][speakerKey]
|
||||
response = getSpeaker(speaker)
|
||||
|
|
@ -199,19 +199,27 @@ def translateJSON(data, translatedList):
|
|||
data[i][speakerKey] = speaker
|
||||
|
||||
# Dialogue
|
||||
if messageKey in data[i]:
|
||||
if messageKey in data[i]\
|
||||
and data[i][messageKey].strip()\
|
||||
and data[i][messageKey] != "a"\
|
||||
and data[i][messageKey].replace("\u3000", "").strip() != "":
|
||||
jaString = data[i][messageKey]
|
||||
|
||||
# Save Original String
|
||||
originalString = jaString
|
||||
|
||||
# If there isn't any Japanese in the text just skip
|
||||
if not re.search(LANGREGEX, jaString):
|
||||
i += 1
|
||||
continue
|
||||
|
||||
# Pass 1
|
||||
if not translatedList:
|
||||
# Strip Spaces
|
||||
jaString = jaString.strip()
|
||||
|
||||
# Remove Textwrap
|
||||
jaString = jaString.replace('\n', ' ')
|
||||
# jaString = jaString.replace('\n', ' ')
|
||||
|
||||
if jaString:
|
||||
if speaker:
|
||||
|
|
@ -232,33 +240,38 @@ def translateJSON(data, translatedList):
|
|||
stringList = None
|
||||
|
||||
# Remove speaker
|
||||
translatedText = re.sub(r"^\[?(.+?)\]?\s?[|:]\s?", "", translatedText)
|
||||
match = re.search(r'(^\[.+?\]\s?[|:]\s?)', translatedText)
|
||||
if match:
|
||||
translatedText = translatedText.replace(match.group(1), "")
|
||||
|
||||
# Escape Quotes
|
||||
translatedText = re.sub(r'(?<!\\)"', r"", translatedText)
|
||||
|
||||
# Remove characters that may break scripts
|
||||
translatedText = translatedText.replace("<", "(")
|
||||
translatedText = translatedText.replace(">", ")")
|
||||
# translatedText = translatedText.replace("<", "(")
|
||||
# translatedText = translatedText.replace(">", ")")
|
||||
translatedText = translatedText.replace("『", "")
|
||||
translatedText = translatedText.replace("』", "")
|
||||
|
||||
# Remove GPT ' Quotes
|
||||
if translatedText[0] == "'":
|
||||
translatedText = translatedText[1:]
|
||||
if translatedText[-1] == "'":
|
||||
translatedText = translatedText[:-1]
|
||||
if translatedText:
|
||||
if translatedText[0] == "'":
|
||||
translatedText = translatedText[1:]
|
||||
if translatedText[-1] == "'":
|
||||
translatedText = translatedText[:-1]
|
||||
else:
|
||||
print("Warning: Empty Translation for", originalString)
|
||||
|
||||
# Textwrap
|
||||
translatedText = dazedwrap.wrapText(translatedText, width=WIDTH)
|
||||
# translatedText = dazedwrap.wrapText(translatedText, width=WIDTH)
|
||||
|
||||
# Set Data
|
||||
if "『" in data[i][messageKey] and "』" not in translatedText:
|
||||
data[i][messageKey] = data[i][messageKey].replace(originalString, f"『{translatedText}』")
|
||||
else:
|
||||
data[i][messageKey] = data[i][messageKey].replace(originalString, f"{translatedText}")
|
||||
# Next Value
|
||||
i += 1
|
||||
# Next Value
|
||||
i += 1
|
||||
|
||||
# EOF
|
||||
if not translatedList:
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ def translateRegex(data, translatedList):
|
|||
|
||||
while i < len(data):
|
||||
voice = False
|
||||
lineRegexText = r"◆B.+?◆(.+)"
|
||||
lineRegexText = r'"Text":\s"(.+)",'
|
||||
lineRegexSpeaker = r"◆A.+?◆(.+)"
|
||||
choiceRegex = r"\$menu_item.+?,(.*?),"
|
||||
titleRegex = r"title\s'(.*)'$"
|
||||
|
|
|
|||
|
|
@ -1025,6 +1025,15 @@ def searchCodes(page, pbar, jobList, filename):
|
|||
and len(codeList[i + 1]["parameters"][0]) > 0
|
||||
):
|
||||
nextString = codeList[i + 1]["parameters"][0].strip()
|
||||
|
||||
# Remove any RPGMaker Code at start
|
||||
ffMatchNS = re.search(
|
||||
r"^((?:[\\]+[^cCnNiIkKvV{}]+\[[\d\w\W]+\])+)",
|
||||
nextString,
|
||||
)
|
||||
if ffMatchNS != None:
|
||||
nextString = nextString.replace(ffMatchNS.group(1), "")
|
||||
|
||||
if nextString and nextString[0] in [
|
||||
"「",
|
||||
'"',
|
||||
|
|
@ -1141,7 +1150,7 @@ def searchCodes(page, pbar, jobList, filename):
|
|||
|
||||
# Remove any RPGMaker Code at start
|
||||
ffMatch = re.search(
|
||||
r"^((?:[\\]+[^cCnNiIkKvV{}]+\[[\d\w]+\])+)",
|
||||
r"^((?:[\\]+[^cCnNiIkKvV{}]+\[[\d\w\W]+\])+)",
|
||||
finalJAString,
|
||||
)
|
||||
if ffMatch != None:
|
||||
|
|
@ -1473,7 +1482,7 @@ def searchCodes(page, pbar, jobList, filename):
|
|||
|
||||
# Replace Strings
|
||||
for j in range(len(matchList)):
|
||||
translatedText = translatedText.replace(matchList[j], response[0][j])
|
||||
translatedText = translatedText.replace(matchList[j], response[0][j].replace('"', ''))
|
||||
|
||||
# Set Data
|
||||
codeList[i]["parameters"][3]["choices"] = translatedText
|
||||
|
|
|
|||
|
|
@ -204,10 +204,14 @@ def translatePlugin(data, pbar, filename, translatedList):
|
|||
voice = False
|
||||
speaker = ""
|
||||
newline = r"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n"
|
||||
colorCode = r"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\C"
|
||||
colorCode = r"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\c"
|
||||
|
||||
# Custom
|
||||
regex = r'=\s\[".+?",\s"(.+)"\]'
|
||||
# Useful Regex's
|
||||
# r'"Text[\\]+":[\\]+"(.+?)[\\]+",'
|
||||
# r'"HelpText[\\]+":[\\]+"(.+?)[\\]+",'
|
||||
# r"this.drawTextEx\(\\'(.+?)\',"
|
||||
regex = r"this.drawTextEx\(\\'(.+?)\',"
|
||||
matchList = re.findall(regex, data[i])
|
||||
if len(matchList) > 0:
|
||||
for match in matchList:
|
||||
|
|
@ -215,12 +219,17 @@ def translatePlugin(data, pbar, filename, translatedList):
|
|||
jaString = match
|
||||
originalString = jaString
|
||||
|
||||
# Make sure didn't grab \\
|
||||
if re.search(r"^[\\]+$", jaString):
|
||||
i += 1
|
||||
continue
|
||||
|
||||
# Replace \n and \c
|
||||
jaString = re.sub(r"\\+n", r"\\n", jaString)
|
||||
jaString = re.sub(r"\\+C", r"\\C", jaString)
|
||||
|
||||
# Remove any textwrap
|
||||
# jaString = jaString.replace(newline, " ")
|
||||
jaString = jaString.replace("\\n", " ")
|
||||
|
||||
if jaString.replace("\u3000", "") and jaString:
|
||||
# Pass 1
|
||||
|
|
@ -239,15 +248,15 @@ def translatePlugin(data, pbar, filename, translatedList):
|
|||
translatedList = None
|
||||
|
||||
# Replace Single Quotes
|
||||
translatedText = re.sub(r"([^\\'])'", r"\1\\'", translatedText)
|
||||
translatedText = re.sub(r"([^\\'])\"", r"\1\\'", translatedText)
|
||||
translatedText = re.sub(r"([^\\'])'", r"\1՚", translatedText)
|
||||
translatedText = re.sub(r"([^\\'])\"", r"\1՚", translatedText)
|
||||
|
||||
# Textwrap
|
||||
translatedText = dazedwrap.wrapText(translatedText, WIDTH)
|
||||
|
||||
# Replace \n and \c
|
||||
translatedText = re.sub(r"\\+n", re.escape(newline), translatedText)
|
||||
translatedText = re.sub(r"\\+C", re.escape(colorCode), translatedText)
|
||||
translatedText = re.sub(r"\n", re.escape(newline), translatedText)
|
||||
translatedText = re.sub(r"\n", re.escape(colorCode), translatedText)
|
||||
|
||||
# Set Data
|
||||
with open("translations.txt", "a+", encoding="utf-8") as tlFile:
|
||||
|
|
|
|||
42
vocab.txt
42
vocab.txt
|
|
@ -1,7 +1,7 @@
|
|||
Here are some vocabulary and terms so that you know the proper spelling and translation.
|
||||
```
|
||||
# Game Characters
|
||||
クリスティア (Kristia)
|
||||
天川 紗雪 (Amakawa Sayuki) - Female
|
||||
|
||||
# Lewd Terms
|
||||
マンコ (pussy)
|
||||
|
|
@ -160,24 +160,26 @@ w ((lol))
|
|||
』 (』)
|
||||
|
||||
# Game Specific
|
||||
遊楽都市メイピア (Pleasure City Meipia)
|
||||
フォルム浴場 (Form Bathhouse)
|
||||
夜蝶舞台 (Night Butterfly Stage)
|
||||
ピエールの美術工房 (Pierre’s Art Workshop)
|
||||
ウェヌス神殿 (Venus Temple)
|
||||
ウェヌス神殿2F (Venus Temple 2F)
|
||||
剣闘士の宿舎 (Gladiator Dormitory)
|
||||
宿屋テアトロン (Teatron Inn)
|
||||
死者の門 (Gate of the Dead)
|
||||
ニギディウス邸 (Nigidius Residence)
|
||||
魔法道具店 (Magic Item Shop)
|
||||
簡易娼館2/3 (Simple Brothel 2/3)
|
||||
秘儀荘 (Secret Ritual Lodge)
|
||||
世界樹神殿 (Yggdrasil Temple)
|
||||
淫具屋 (Sex Toy Shop)
|
||||
剣闘士治療所 (Gladiator Clinic)
|
||||
第Ⅳ霊写室 (Spirit Photography Room IV)
|
||||
雷獣の回廊 (Thunder Beast Corridor)
|
||||
フィリア舞台 (Philia Stage)
|
||||
お試し空間 (Trial Space)
|
||||
ゲーミングちんぽ茶道部 (Gaming Dick Tea Ceremony Club)
|
||||
マゾちんぽランド運営部 (Masochist Dick Land Management Club)
|
||||
オホ声合唱部 (Moaning Chorus Club)
|
||||
ドスケベ物理学部 (Lewd Physics Club)
|
||||
バトルファックお嬢様部 (Battle Fuck Ojou-sama Club)
|
||||
ご令嬢聖水開発部 (Young Lady's Holy Water Development Club)
|
||||
オナニー大会執行部 (Masturbation Tournament Executive Club)
|
||||
母乳研究部 (Breast Milk Research Club)
|
||||
SM館 (SM Hall)
|
||||
ドスケベ学園 (Lewd Academy)
|
||||
牢獄 (Prison)
|
||||
神社 (Shrine)
|
||||
裏山隠し部屋 (Back Mountain Hidden Room)
|
||||
体育館管理室 (Gymnasium Management Room)
|
||||
監禁部屋 (Confinement Room)
|
||||
マリィの部屋 (Mari's Room)
|
||||
ペット小屋 (Pet House)
|
||||
亀頭漫湖の隠し部屋 (Glans Lake's Secret Room)
|
||||
秘密の部屋 (Secret Room)
|
||||
特別肉便器棟 (Special Meat Toilet Building)
|
||||
|
||||
```
|
||||
Loading…
Reference in a new issue