diff --git a/csv.tmp b/csv.tmp new file mode 100644 index 0000000..bf0d87a --- /dev/null +++ b/csv.tmp @@ -0,0 +1 @@ +4 \ No newline at end of file diff --git a/modules/csv.py b/modules/csv.py index 37e3b1e..d021813 100644 --- a/modules/csv.py +++ b/modules/csv.py @@ -147,7 +147,14 @@ def parseCSV(readFile, writeFile, filename): totalLines = 0 global LOCK - format = "" + # Read from tmp files + if os.path.isfile("csv.tmp"): + with open("csv.tmp") as tmpFile: + format = tmpFile.readline() + else: + format = "" + + # Choices while format not in ["1", "2", "3", "4"]: format = input("\n\nSelect the CSV Format:\n\n1. Translator++\n2. Single\n3. Multiple\n4. Speaker&Text\n") match format: @@ -159,6 +166,10 @@ def parseCSV(readFile, writeFile, filename): format = "3" case "4": format = "4" + + # Write to file for later use + with open("csv.tmp", "w", encoding="utf-8") as tmpFile: + tmpFile.write(f"{format}") # Get total for progress bar totalLines = len(readFile.readlines()) @@ -166,7 +177,7 @@ def parseCSV(readFile, writeFile, filename): reader = csv.reader(readFile, delimiter=",") if not ESTIMATE: - writer = csv.writer(writeFile, delimiter=",", quotechar='"') + writer = csv.writer(writeFile, delimiter=",") else: writer = "" @@ -311,7 +322,7 @@ def translateCSV(data, pbar, writer, filename, translatedList, format): textColumn = 20 speaker = "" - if len(data[i]) > textColumn: + if len(data[i]) > textColumn and data[i][textColumn]: # Speaker if data[i][speakerColumn]: speakerResponse = getSpeaker(data[i][speakerColumn]) @@ -320,14 +331,22 @@ def translateCSV(data, pbar, writer, filename, translatedList, format): speaker = speakerResponse[0] data[i][speakerColumn] = speaker - # Check if Translated + # Get Text jaString = data[i][textColumn] # Remove Textwrap jaString = jaString.replace("\\n", " ") + # Remove Furigana + jaString = re.sub(r"<(.*)=.*>", r"\1", jaString) + # Pass 1 if not translatedList: + # Append Speaker + if speaker: + jaString = f"[{speaker}]: {jaString}" + + # Append to List stringList.append(jaString) # Pass 2 diff --git a/modules/main.py b/modules/main.py index 2528ba3..92807c0 100644 --- a/modules/main.py +++ b/modules/main.py @@ -145,6 +145,10 @@ files to translate are in the /files folder and that you picked the right game e tracebackLineNo = str(traceback.extract_tb(sys.exc_info()[2])[-1].lineno) tqdm.write(Fore.RED + str(e) + "|" + tracebackLineNo + Fore.RESET) + # Delete Tmp Files + os.remove("csv.tmp") + + # Finish if totalCost != "Fail": # if estimate is False: # This is to encourage people to grab what's in /translated instead diff --git a/prompt.example b/prompt.example index 1e293c7..796564e 100644 --- a/prompt.example +++ b/prompt.example @@ -30,8 +30,8 @@ You will be translating text from a game. I will provide you with lines of text Input: { - "Line1": "u‚͗c̓@Ȃłv", - "Line2": "uc\\c[7]Ȃɉˆ̂Ɂcv" + "Line1": "「こいつからは幼女の匂いが しないでござる」", + "Line2": "「えぇ…\\c[7]こんなに可愛いのに…」" } Output: { @@ -43,12 +43,12 @@ Input: { "Line1": "[Defense Member E]: ...", "Line2": "[Kurone]: ...\\i[100]", - "Line3": "[Kurone]: ̂", - "Line4": "[Kurone]: \\v[0]OɎĂĂ݂", - "Line5": "[Kurone]: ͂ǂłǂǁA\n\"\\c[10]̕WI\\c\"ɗ]vȎ ȂłȂH", - "Line6": "[Kurone]: E", - "Line7": "[Defense Member E]: Ђ...!...\󂲃U܃Z", - "Line8": "[Defense Member E]: Nllɉivj]܃X...\\c[18]ǃEV" + "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: { diff --git a/vocab.txt b/vocab.txt index cd2f43f..8893358 100644 --- a/vocab.txt +++ b/vocab.txt @@ -1,10 +1,12 @@ Here are some vocabulary and terms so that you know the proper spelling and translation. ``` # Game Characters -エレッタ (Eretta) - Female -セッカ (Sekka) - Female -新宮寧々 (Nene Shingu) - Female -辰野伊吹 (Ibuki Tatsuno) - Female +Adachi Tenka (足立 甜花) - Female +Komako Semenovich (コマコ セメノビッチ) - Female +Sayama Chie (狭山 千恵) - Female +Sayama Yuuko (狭山 優子) - Female +Hanano Fuuka (華野 楓花) - Female +Tachikawa Kiyoshi (立川 清) - Male # Lewd Terms マンコ (pussy) @@ -88,49 +90,4 @@ ME 音量 (ME Volume) w ((lol)) 巫女 (Shrine Maiden) コイツ (this bastard) -メナスフィア (Menacephere) - -# Armor -ガードストーン (Guard Stone) -ガードリング (Guard Ring) -パワーストーン (Power Stone) -パワーリング (Power Ring) -スピードストーン (Speed Stone) -スピードリング (Speed Ring) -ラッキーストーン (Lucky Stone) -ラッキーリング (Lucky Ring) -マジカルストーン (Magical Stone) -マジカルリング (Magical Ring) -シューターストーン (Shooter Stone) -シューターリング (Shooter Ring) - -# Classes -キュバリエエレッタ (Cavalier Eretta) - -#Enemies -ガーゴットン (Gargoton) -スライム (Slime) -スライム(エロなし) (Slime (No Lewd)) -群体スライム(中ボス) (Swarm Slime (Mid-Boss)) -スライム(黄) (Slime (Yellow)) -ボスウナズ (Boss Unaz) -スライム(道中エロ補助用) (Slime (On the Way for Lewd Support)) -スライム(取り巻き) (Slime (Minion)) -ゴブリンリーダー (Goblin Leader) -ゴブリンシャーマン (Goblin Shaman) -ゴブリンソルジャー (Goblin Soldier) -ゴブリン(取り巻き) (Goblin (Minion)) -オーク (Orc) -ボストロ (Bostro) -アイリス (Iris) -アラクネ (Arachne) -テレビフレーム (TV Frame) -コカトリス (Cockatrice) -シュトリア (Shtoria) -シュトリアビット (Shtoria Bit) -シュトリアビット2 (Shtoria Bit 2) -ボスウナズ (Boss Unaz) - -# Locations -ハレイシア (Haleisia) ``` \ No newline at end of file