Fix prompt encoding

This commit is contained in:
DazedAnon 2024-12-21 17:41:28 -06:00
parent a20788ca11
commit 9816c8cf3d
5 changed files with 42 additions and 61 deletions

1
csv.tmp Normal file
View file

@ -0,0 +1 @@
4

View file

@ -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

View file

@ -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

View file

@ -30,8 +30,8 @@ You will be translating text from a game. I will provide you with lines of text
Input:
{
"Line1": "「こいつからは幼女の匂いが しないでござる」",
"Line2": "「えぇ…\\c[7]こんなに可愛いのに…」"
"Line1": "「こいつからは幼女の匂いが しないでござる」",
"Line2": "「えぇ…\\c[7]こんなに可愛いのに…」"
}
Output:
{
@ -43,12 +43,12 @@ 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]どウかお許シを"
"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:
{

View file

@ -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)
```