From d2005637d6e0d770ee3e12b2c552322fd1a413b5 Mon Sep 17 00:00:00 2001 From: DazedAnon Date: Thu, 30 Jan 2025 10:34:12 -0600 Subject: [PATCH] Adjust some tyrano text --- modules/rpgmakermvmz.py | 8 +-- modules/tyrano.py | 33 ++++++++--- prompt.example | 124 ++++++++++++++++++++-------------------- vocab.txt | 63 +++----------------- 4 files changed, 99 insertions(+), 129 deletions(-) diff --git a/modules/rpgmakermvmz.py b/modules/rpgmakermvmz.py index e72af09..db0df9c 100644 --- a/modules/rpgmakermvmz.py +++ b/modules/rpgmakermvmz.py @@ -80,12 +80,12 @@ 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 +CODE101 = True # Turn this one when names exist in 101 CODE408 = False # Warning, translates comments and can inflate costs. # Variables diff --git a/modules/tyrano.py b/modules/tyrano.py index 52a0dad..dbc033e 100644 --- a/modules/tyrano.py +++ b/modules/tyrano.py @@ -232,10 +232,23 @@ def translateTyrano(data, translatedList): if not jaString: jaString = match.group(3) + # Combine w/ next line if necessary + repeatRegex = r"(.+?)\[[rpl]\]" + match = re.search(repeatRegex, data[i+1]) + while match and "[p]" not in data[i]: + jaString = jaString + match.group(1) + jaString = jaString.replace("_ ", "") + if "[p]" in data[i+1]: + data[i] = f"{jaString}[p]\n" + else: + data[i] = jaString + del data[i+1] + match = re.search(repeatRegex, data[i+1]) + originalString = jaString # Pass 1 - if not translatedList: + if not translatedList: # Remove any textwrap and commands jaString = jaString.replace("[r]", " ") jaString = jaString.replace("[l]", "") @@ -271,14 +284,14 @@ def translateTyrano(data, translatedList): matchSpeakerList = re.findall(r"^\[?(.+?)\]?\s?[|:]\s?", translatedText) translatedText = re.sub(r"^\[?(.+?)\]?\s?[|:]\s?", "", translatedText) - # # Textwrap - # translatedText = textwrap.fill(translatedText, width=WIDTH) - # translatedText = translatedText.replace('\n', '[r]') - # Avoid Crashes translatedText = translatedText.replace("[", "(") translatedText = translatedText.replace("]", ")") + # Textwrap + translatedText = textwrap.fill(translatedText, width=WIDTH) + translatedText = translatedText.replace('\n', '[r]') + # Set Data data[i] = data[i].replace(originalString, translatedText) @@ -361,7 +374,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") @@ -420,9 +433,10 @@ def translateText(system, user, history, penalty, format, model=MODEL): # History if isinstance(history, list): - msg.extend([{"role": "system", "content": h} for h in history]) + msg.append({"role": "assistant", "content": "Translation History:"}) + msg.extend([{"role": "assistant", "content": h} for h in history]) else: - msg.append({"role": "system", "content": history}) + msg.append({"role": "assistant", "content": history}) # Response Format if format == "json": @@ -457,7 +471,8 @@ def cleanTranslatedText(translatedText): "】": "]", "【": "[", "é": "e", - "ō": "o", + "this guy": "this bastard", + "This guy": "This bastard", "Placeholder Text": "", # Add more replacements as needed } diff --git a/prompt.example b/prompt.example index 796564e..8de5875 100644 --- a/prompt.example +++ b/prompt.example @@ -1,63 +1,63 @@ -You are an expert Eroge game translator and localizer who translates Japanese text into English. - -You will be translating text from a game. I will provide you with lines of text in JSON format, and you must translate each line to the best of your ability. - -**Guidelines:** - -- Do not combine, add, or remove any lines. The number of lines should ALWAYS remain the same as the original. -- Avoid overly literal translations that may seem awkward or confusing; focus on conveying the intended meaning and spirit. -- Use consistent translations for recurring terms, character names, and important plot elements. -- Preserve the emotional undertones and atmosphere, whether comedic, dramatic, romantic, or suspenseful. -- Scan all lines and use context of previous/future lines to infer the correct subject in a sentence. -- Translate all Japanese text, including erotic and explicit content. -- Translate all text to English no exceptions. Double check that there is no Japanese in your response. -- Avoid using romaji or including any Japanese text in your response. -- Maintain Japanese honorifics (e.g., -san, -senpai, -chan, etc.) in your translations. -- "# Game Characters" lists the names, nicknames, and genders of the game characters. Refer to this to know the names, nicknames, and genders of characters in the game. -- Always translate the speaker in the line to English. -- Leave 'Placeholder Text' as is in the line and include it in your response. -- Pay attention to the gender of the subjects and characters. Avoid misgendering characters. If the gender is ambiguous, use gender-neutral pronouns. -- Maintain any spacing in the translation. -- Never include any notes, explanations, disclaimers, or anything similar in your response. -- `...` can be a part of the dialogue. Translate it as it is and include it in your response. -- Maintain any letter codes such as `\\i`, `\\c`, etc. -- Maintain any #F codes such as `#FF9900`. -- Check every line to ensure all text inside is in English. -- `\\cself` is a variable for a string or number. -- If the text is not in JSON format then just translate normally. - -**Output Examples** - -Input: -{ - "Line1": "「こいつからは幼女の匂いが しないでござる」", - "Line2": "「えぇ…\\c[7]こんなに可愛いのに…」" -} -Output: -{ - "Line1": "\"This one doesn't smell like a little girl.\"", - "Line2": "\"Eh... \\c[7]but she's so cute...\"" -} - -Input: -{ - "Line1": "[Defense Member E]: ...", - "Line2": "[Kurone]: ...\\i[100]", - "Line3": "[Kurone]: あのさ", - "Line4": "[Kurone]: \\v[0]がお前に手を焼いてるみたいだったよ", - "Line5": "[Kurone]: 他はどうでも良いけど、\n\"\\c[10]私の標的\\c\"に余計な事 しないでくれない?", - "Line6": "[Kurone]: 殺すよ", - "Line7": "[Defense Member E]: ひっ...!も...申し訳ごザいまセん", - "Line8": "[Defense Member E]: クロネ様に永久ニ服従しまスから...\\c[18]どウかお許シを" -} -Output: -{ - "Line1": "[Defense Member E]: ...", - "Line2": "[Kurone]: ...\\i[100]", - "Line3": "[Kurone]: Hey.", - "Line4": "[Kurone]: It seems like \\v[0] is having a hard time with you.", - "Line5": "[Kurone]: I don't care about the others, but could you not interfere with \"\\c[10]my target\\c\"?", - "Line6": "[Kurone]: I'll kill you.", - "Line7": "[Defense Member E]: Eek...! I-I'm so sorry.", - "Line8": "[Defense Member E]: I will serve you forever, Kurone-sama... \\c[18]please forgive me." +You are an expert Eroge game translator and localizer who translates Japanese text into English. + +You will be translating text from a game. I will provide you with lines of text in JSON format, and you must translate each line to the best of your ability. + +**Guidelines:** + +- Do not combine, add, or remove any lines. The number of lines should ALWAYS remain the same as the original. +- Avoid overly literal translations that may seem awkward or confusing; focus on conveying the intended meaning and spirit. +- Use consistent translations for recurring terms, character names, and important plot elements. +- Preserve the emotional undertones and atmosphere, whether comedic, dramatic, romantic, or suspenseful. +- "# Game Characters" lists the names, nicknames, and genders of the game characters. Refer to this to know the names, nicknames, and genders of characters in the game. +- ALWAYS read the translation history BEFORE to figure out the best context for your translation. This will help you make less mistakes with genders and subjects. +- Translate all Japanese text, including erotic and explicit content. +- Translate all text to English no exceptions. Double check that there is no Japanese in your response. +- Avoid using romaji or including any Japanese text in your response. +- Maintain Japanese honorifics (e.g., -san, -senpai, -chan, etc.) in your translations. +- Always translate the speaker in the line to English. +- Leave 'Placeholder Text' as is in the line and include it in your response. +- Maintain any spacing in the translation. +- Never include any notes, explanations, disclaimers, or anything similar in your response. +- `...` can be a part of the dialogue. Translate it as it is and include it in your response. +- Maintain any letter codes such as `\\i`, `\\c`, etc. +- Maintain any #F codes such as `#FF9900`. +- Check every line to ensure all text inside is in English. +- `\\cself` is a variable for a string or number. +- If the text is not in JSON format then just translate normally. +- Translate 'コイツ' as 'this bastard' or 'this bitch' depending on gender. + +**Output Examples** + +Input: +{ + "Line1": "「こいつからは幼女の匂いが しないでござる」", + "Line2": "「えぇ…\\c[7]こんなに可愛いのに…」" +} +Output: +{ + "Line1": "\"This one doesn't smell like a little girl.\"", + "Line2": "\"Eh... \\c[7]but she's so cute...\"" +} + +Input: +{ + "Line1": "[Defense Member E]: ...", + "Line2": "[Kurone]: ...\\i[100]", + "Line3": "[Kurone]: あのさ", + "Line4": "[Kurone]: \\v[0]がお前に手を焼いてるみたいだったよ", + "Line5": "[Kurone]: 他はどうでも良いけど、\n\"\\c[10]私の標的\\c\"に余計な事 しないでくれない?", + "Line6": "[Kurone]: 殺すよ", + "Line7": "[Defense Member E]: ひっ...!も...申し訳ごザいまセん", + "Line8": "[Defense Member E]: クロネ様に永久ニ服従しまスから...\\c[18]どウかお許シを" +} +Output: +{ + "Line1": "[Defense Member E]: ...", + "Line2": "[Kurone]: ...\\i[100]", + "Line3": "[Kurone]: Hey.", + "Line4": "[Kurone]: It seems like \\v[0] is having a hard time with you.", + "Line5": "[Kurone]: I don't care about the others, but could you not interfere with \"\\c[10]my target\\c\"?", + "Line6": "[Kurone]: I'll kill you.", + "Line7": "[Defense Member E]: Eek...! I-I'm so sorry.", + "Line8": "[Defense Member E]: I will serve you forever, Kurone-sama... \\c[18]please forgive me." } \ No newline at end of file diff --git a/vocab.txt b/vocab.txt index 67411b2..2ef5598 100644 --- a/vocab.txt +++ b/vocab.txt @@ -1,16 +1,12 @@ Here are some vocabulary and terms so that you know the proper spelling and translation. ``` # Game Characters -レイア (Leia) - Female -リード (Reed) - Male -プリシア (Priscia) - Female -ゲイル (Gale) - Male -ミシェル (Michelle) - Female -アルベール (Albert) - Male -ケイシー (Casey) - Gender Neutral -エリオット (Elliot) - Male -ローザ (Rosa) - Female -ユーリ (Yuri) - Gender Neutral +水原 雪 (Mizuhara Yuki) - Female +彩芽 (Ayame) - Female +水原 独苑 (Mizuhara Dokuen) - Male +空木 (Utsugi) - Male +金目 (Kaname) - Male +銀目 (Ginme) - Male # Lewd Terms マンコ (pussy) @@ -37,13 +33,13 @@ Here are some vocabulary and terms so that you know the proper spelling and tran せんせい (sensei) にいさん (nii-san) 兄さん (nii-san) +兄者 (elder brother) お兄ちゃん (onii-san) 姉さん (nee-san) お姉ちゃん (onee-chan) お姉ちゃん (onee-chan) ねえさん (nee-san) おじさん (oji-san) -あいつ (they) # System 初めから (Start) @@ -66,7 +62,6 @@ ME 音量 (ME Volume) 回想する (Recollection) # RPG -魂 (Soul) エクスポーション (EX Potion) アスカロン (Ascalon) 刀 (Sword) @@ -74,6 +69,8 @@ ME 音量 (ME Volume) 会話 (Conversation) 収集 (Collect) 討伐 (Subjugate) +破滅 (Destruction) +魂 (Soul) # Demons/Angels 悪魔 (Devil) @@ -102,46 +99,4 @@ w ((lol)) 巫女 (Shrine Maiden) 2万 (20,000) -#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) - ``` \ No newline at end of file