This commit is contained in:
2022-12-13 02:18:04 -03:00
parent bcefd76d0f
commit e59ecf694a
5 changed files with 27 additions and 23 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
*.rpy
*.rpyc
*.bak

View File

@ -1,11 +1,15 @@
##############################################################################################################################
# This script simply places the strings from files_old into files_new. This is useful if for some reason the labels in the #
# script thanged and you needed to regenerate the translations, or if you already translated the game without using the #
# translation system. #
# #
# Make sure that both files have the same ammounts of lines. Then, simply place the old files into files_old #
# And the new files into files_new. #
##############################################################################################################################
############################################################################################################################
# This script simply places the strings from files_old into files_new. This is useful if for some reason the labels in the #
# script changed and you needed to regenerate the translations, or if you already translated the game without using the #
# built-in translation system. #
# #
# Make sure that both files have the same ammount of lines. Then, simply place the old files into files_old #
# And the new files into files_new. #
############################################################################################################################
####
# This shit sucks. But it works (As long as you didn't add any extra lines to the translation file)
####
from os import listdir
@ -13,34 +17,33 @@ cont = 0
nextOne = False
next_One = False
OUT = "out"
FOLDERS = ["old","new"]
for file in listdir(f"files_{FOLDERS[0]}"):
for file in listdir(f"files_old"):
if file.endswith(".rpy"):
with open(f"files_{FOLDERS[0]}/{file}",'r', encoding="utf8") as f:
with open(f"files_old/{file}",'r', encoding="utf8") as f:
linesOne = f.readlines()
with open(f"files_{FOLDERS[1]}/{file}",'r', encoding="utf8") as f2:
with open(f"files_old/{file}",'r', encoding="utf8") as f2:
linesTwo = f2.readlines()
if len(linesOne) == len(linesTwo):
with open(f"files_{OUT}/{file}",'w', encoding="utf8") as fp:
with open(f"files_out/{file}",'w', encoding="utf8") as fp:
for number,line in enumerate(linesOne):
if line.strip().startswith("#") and line != 0:
if nextOne:
fp.write(linesOne[number])
nextOne = False
elif next_One and number % 2 == 0:
fp.write(linesOne[number])
next_One = False
cont = 0
elif line.strip().startswith("#") and number != 0:
next_One = True
cont += 1
fp.write(linesTwo[number])
elif line.strip().startswith("old"):
nextOne = True
fp.write(linesTwo[number])
elif nextOne:
fp.write(linesOne[number])
nextOne = False
elif next_One and cont == 2:
fp.write(linesOne[number])
next_One = False
cont = 0
else:
fp.write(linesTwo[number])
else:
print(f"{file}, couldn't be proccesed. There's a discrepancy in the lines. old: {len(linesOne)} - new: {len(linesTwo)}")
print(f"ERROR processing {file}. There's a discrepancy in the lines. old: {len(linesOne)} - new: {len(linesTwo)}\n\n")
continue