diff --git a/modules/rpgmakermvmz.py b/modules/rpgmakermvmz.py index aa026cc..796483c 100644 --- a/modules/rpgmakermvmz.py +++ b/modules/rpgmakermvmz.py @@ -80,13 +80,13 @@ 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 -CODE408 = False # Warning, translates comments and can inflate costs. +CODE408 = True # Warning, translates comments and can inflate costs. # Variables CODE122 = False @@ -1397,64 +1397,64 @@ def searchCodes(page, pbar, jobList, filename): codeList[i]["parameters"][3][argVar] = translatedText pbar.update(1) - # if "TextPicture" in headerString or "BalloonInBattle" in headerString: - # argVar = "text" - # font = None - # ### Message Text First - # if argVar in codeList[i]["parameters"][3]: - # acExist = False - # jaString = codeList[i]["parameters"][3][argVar] + if "TextPicture" in headerString or "BalloonInBattle" in headerString: + argVar = "text" + font = None + ### Message Text First + if argVar in codeList[i]["parameters"][3]: + acExist = False + jaString = codeList[i]["parameters"][3][argVar] - # # Check ac - # if "\\ac" in jaString: - # acExist = True - # else: - # acExist = False + # Check ac + if "\\ac" in jaString: + acExist = True + else: + acExist = False - # # If there isn't any Japanese in the text just skip - # # if not re.search(r'[一-龠]+|[ぁ-ゔ]+|[ァ-ヴー]+', jaString): - # # i += 1 - # # continue + # If there isn't any Japanese in the text just skip + # if not re.search(r'[一-龠]+|[ぁ-ゔ]+|[ァ-ヴー]+', jaString): + # i += 1 + # continue - # # Remove any textwrap & TL - # if '[Lewd Power' in jaString: - # jaString = re.sub(r"\n", " ", jaString) - # if acExist: - # jaString = jaString.replace("\\ac ", " ") - # jaString = jaString.replace("\\ac", "") + # Remove any textwrap & TL + if '[Lewd Power' in jaString: + jaString = re.sub(r"\n", " ", jaString) + if acExist: + jaString = jaString.replace("\\ac ", " ") + jaString = jaString.replace("\\ac", "") - # # Pass 1 - # if setData == False: - # list357.append(jaString) + # Pass 1 + if setData == False: + list357.append(jaString) - # # Pass 2 - # else: - # if len(list357) > 0: - # # Grab and Replace - # translatedText = list357[0] - # translatedText = jaString.replace(jaString, translatedText) + # Pass 2 + else: + if len(list357) > 0: + # Grab and Replace + translatedText = list357[0] + translatedText = jaString.replace(jaString, translatedText) - # # Remove characters that may break scripts - # charList = ['"', "\\n"] - # for char in charList: - # translatedText = translatedText.replace(char, "") + # Remove characters that may break scripts + charList = ['"', "\\n"] + for char in charList: + translatedText = translatedText.replace(char, "") - # # Textwrap - # if '[Lewd Power' in jaString: - # translatedText = textwrap.fill(translatedText, 50) + # Textwrap + if '[Lewd Power' in jaString: + translatedText = textwrap.fill(translatedText, 50) - # # Center Text - # if acExist: - # translatedText = f'\\ac {translatedText.replace('\n', '\n\\ac ')}' + # Center Text + if acExist: + translatedText = f'\\ac {translatedText.replace('\n', '\n\\ac ')}' - # # Check and Set Font - # if "fontSize" in codeList[i]["parameters"][3]: - # if font: - # codeList[i]["parameters"][3]["fontSize"] = font + # Check and Set Font + if "fontSize" in codeList[i]["parameters"][3]: + if font: + codeList[i]["parameters"][3]["fontSize"] = font - # # Set - # codeList[i]["parameters"][3][argVar] = translatedText - # list357.pop(0) + # Set + codeList[i]["parameters"][3][argVar] = translatedText + list357.pop(0) if "QuestSystem" in headerString: argVar = "DetailNote" @@ -1516,6 +1516,66 @@ def searchCodes(page, pbar, jobList, filename): codeList[i]["parameters"][3][argVar] = f"\"{translatedText}\"" list357.pop(0) + if "LL_InfoPopupWIndow" in headerString: + argVar = "messageText" + font = None + ### Message Text First + if argVar in codeList[i]["parameters"][3]: + acExist = False + jaString = codeList[i]["parameters"][3][argVar] + + # Check ac + if "\\ac" in jaString: + acExist = True + else: + acExist = False + + # If there isn't any Japanese in the text just skip + # if not re.search(r'[一-龠]+|[ぁ-ゔ]+|[ァ-ヴー]+', jaString): + # i += 1 + # continue + + # Remove any textwrap & TL + jaString = jaString.replace('\\n', ' ') + if acExist: + jaString = jaString.replace("\\ac ", " ") + jaString = jaString.replace("\\ac", "") + + # Pass 1 + if setData == False: + list357.append(jaString) + + # Pass 2 + else: + if len(list357) > 0: + # Grab and Replace + translatedText = list357[0] + translatedText = jaString.replace(jaString, translatedText) + + # Remove characters that may break scripts + charList = ['"', "\\n"] + for char in charList: + translatedText = translatedText.replace(char, "") + + # Textwrap + translatedText = textwrap.fill(translatedText, 80) + translatedText = translatedText.replace('\n', '\\n') + translatedText = re.sub(r"[\\]+c", r"\\\\c", translatedText) + translatedText = re.sub(r"[\\]+\*item", r"\\\\*item", translatedText) + + # Center Text + if acExist: + translatedText = f'\\ac {translatedText.replace('\n', '\n\\ac ')}' + + # Check and Set Font + if "fontSize" in codeList[i]["parameters"][3]: + if font: + codeList[i]["parameters"][3]["fontSize"] = font + + # Set + codeList[i]["parameters"][3][argVar] = f"{translatedText}" + list357.pop(0) + ## Event Code: 657 [Picture Text] [Optional] if "code" in codeList[i] and codeList[i]["code"] == 657 and CODE657 is True: if "text" in codeList[i]["parameters"][0]: @@ -1661,7 +1721,7 @@ 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] - regexPatterns = [r"^'(.*)'\)$"] + regexPatterns = [r"テキスト-(.*)"] # Iterate over the list of regex patterns for regex in regexPatterns: @@ -2493,7 +2553,7 @@ def getSpeaker(speaker): response = translateGPT( f"{speaker}", "Reply with the " + LANGUAGE + " translation of the NPC name.", - True, + False, ) response[0] = response[0].title() response[0] = response[0].replace("'S", "'s") diff --git a/modules/rpgmakerplugin.py b/modules/rpgmakerplugin.py index 6bab259..94a6788 100644 --- a/modules/rpgmakerplugin.py +++ b/modules/rpgmakerplugin.py @@ -198,10 +198,11 @@ def translatePlugin(data, pbar, filename, translatedList): while i < len(data): voice = False speaker = "" - newline = r"\n" + newline = r"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n" + colorCode = r"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\C" # Custom - regex = r'{.+?"Text[\\]+":[\\]+"[\\]+}[\\]*(.+?)[\\]' + regex = r'\\+"HelpText\\+":\\+"(.+?)\\+",' matchList = re.findall(regex, data[i]) if len(matchList) > 0: for match in matchList: @@ -209,8 +210,12 @@ def translatePlugin(data, pbar, filename, translatedList): jaString = match originalString = jaString + # 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(newline, " ") # Pass 1 if setData == False: @@ -225,10 +230,18 @@ def translatePlugin(data, pbar, filename, translatedList): # Set to None if empty list if len(translatedList) <= 0: - translatedList = None + translatedList = None # Replace Single Quotes - translatedText = re.sub(r'[^\\]"', '\\"', translatedText) + translatedText = re.sub(r"([^\\'])'", r"\1\\'", translatedText) + translatedText = re.sub(r"([^\\'])\"", r"\1\\'", translatedText) + + # Textwrap + # translatedText = textwrap.fill(translatedText, WIDTH) + + # Replace \n and \c + translatedText = re.sub(r"\\+n", re.escape(newline), translatedText) + translatedText = re.sub(r"\\+C", re.escape(colorCode), translatedText) # Set Data data[i] = data[i].replace(originalString, translatedText) diff --git a/vocab.txt b/vocab.txt index 26af8a0..67411b2 100644 --- a/vocab.txt +++ b/vocab.txt @@ -1,10 +1,16 @@ Here are some vocabulary and terms so that you know the proper spelling and translation. ``` # Game Characters -イルミナ (Lumina) - Female -セラ (Sera) - Female -リアン (Lian) - Female -イニス (Inis) - Female +レイア (Leia) - Female +リード (Reed) - Male +プリシア (Priscia) - Female +ゲイル (Gale) - Male +ミシェル (Michelle) - Female +アルベール (Albert) - Male +ケイシー (Casey) - Gender Neutral +エリオット (Elliot) - Male +ローザ (Rosa) - Female +ユーリ (Yuri) - Gender Neutral # Lewd Terms マンコ (pussy) @@ -96,50 +102,46 @@ w ((lol)) 巫女 (Shrine Maiden) 2万 (20,000) -# Locations -サイノ河 (Saino River) -オソレ峠 一幕 (Osore Pass Act One) +#Weapons +ショートソード (Short Sword) +ロングソード (Long Sword) +ファルシオン (Falchion) +ミスリルソード (Mithril Sword) +ドラゴンブレード (Dragon Blade) +ウッドスタッフ (Wood Staff) +マジックワンド (Magic Wand) +フォースワンド (Force Wand) +ミスリルロッド (Mithril Rod) +ドラゴンスタッフ (Dragon Staff) +ストーンフレイル (Stone Flail) +ブロンズフレイル (Bronze Flail) +モーニングスター (Morning Star) +ミスリルフレイル (Mithril Flail) +ドラゴンフレイル (Dragon Flail) +ハンドアクス (Hand Axe) +バトルアクス (Battle Axe) +バルディッシュ (Bardiche) +ミスリルアクス (Mithril Axe) +ドラゴンアクス (Dragon Axe) +ショートスピア (Short Spear) +ロングスピア (Long Spear) +ハルバード (Halberd) +ミスリルスピア (Mithril Spear) +ドラゴンスピア (Dragon Spear) +セスタス (Cestus) +バグナウ (Bagh Nakh) +アイアンクロウ (Iron Claw) +ミスリルクロウ (Mithril Claw) +ドラゴンクロウ (Dragon Claw) +ショートボウ (Short Bow) +ロングボウ (Long Bow) +クロスボウ (Crossbow) +ミスリルボウ (Mithril Bow) +ドラゴンボウ (Dragon Bow) +ナイフ (Knife) +ダガー (Dagger) +マシェット (Machete) +ミスリルダガー (Mithril Dagger) +ドラゴンダガー (Dragon Dagger) -#Skills -ヒール (Heal) -ファイア (Fire) -スパーク (Spark) -アーマーブレイク (Armor Break) -チートアタック (Cheat Attack) -ゴブリン拘束攻撃 (Goblin Restraint Attack) -ゴブリン拘束攻撃バックアップ (Goblin Restraint Attack Backup) -■↓イルミナの技↓■ (■↓Lumina's Skills↓■) -ホーリーインパクト (Holy Impact) -セイントアロー (Saint Arrow) -ホーリーインパクトII (Holy Impact II) -セイントアローII (Saint Arrow II) -ヒール (Heal) -クリアウィンド (Clear Wind) -エクスプロージョン (Explosion) -アンチマジック (Anti-Magic) -リザレクション (Resurrection) -リジェネ (Regen) -ルミナス・ゲイル (Luminous Gale) -プロメテウスバースト (Prometheus Burst) -コキュートス (Cocytus) -ディエス・イラ (Dies Irae) -■インフェリアード行動■ (■ Inferiard Actions ■) -ブロッサムスラッシュ (Blossom Slash) -ラッシュオブアイビー (Rush of Ivy) -デバウアーブロッサム (Devour Blossom) -■マクスウェル行動■ (■ Maxwell Actions ■) -チャージ (Charge) -サンダーフォース (Thunder Force) -オーバードライブ・キャノン (Overdrive Cannon) -マシンガン (Machine Gun) -■ナイトメア (■ Nightmare) -イントロイトゥス (Introitus) -タルタロス・ハウル (Tartarus Howl) -ユーディキウム (Eudicium) -ソムニウム・シネフィーネ (Somnium Cinefine) -ラクリモーサ (Lacrimosa) -モルス・ウルティマ (Mors Ultima) -リベラ・メ (Libera Me) -ディエス・イレ (Dies Irae) -乱舞 (Wild Dance) ``` \ No newline at end of file