I give up on trying to make escaped quotation marks work
This commit is contained in:
@ -26,7 +26,7 @@ def translate(string):
|
||||
for idx, token in enumerate(tokens):
|
||||
if token[0] == "{" or token[0] == "[":
|
||||
to_restore.append(token)
|
||||
# Emojis aren't touched by the translator and retain their position 😎
|
||||
# Emojis aren't touched by the translator and retain their relative position 😎
|
||||
tokens[idx] = "🔠"
|
||||
encoded_string = "".join(tokens)
|
||||
|
||||
@ -65,9 +65,6 @@ with open('original.csv', 'r', encoding='utf-8') as input_file, \
|
||||
# Translate the string
|
||||
translation = translate(row[0])
|
||||
|
||||
#Hope this works for escaping, lol
|
||||
translation = translation.replace('"',r'\"')
|
||||
|
||||
except Exception as e:
|
||||
print(f'{Fore.RESET}An error occurred: {e}')
|
||||
|
||||
@ -87,6 +84,6 @@ with open('original.csv', 'r', encoding='utf-8') as input_file, \
|
||||
|
||||
print(f'{Fore.RED}Original: {Fore.RESET}{row[0]} | {Fore.GREEN}Translation: {Fore.RESET}{translation}{" "*10}\n{Fore.CYAN}Estimated time remaining: {str(time_remaining).split(".")[0]} {Fore.YELLOW}({i}/{length})', end="\r")
|
||||
|
||||
writer.writerow([row[0].replace('"',r'\"'), translation])
|
||||
writer.writerow([row[0], translation])
|
||||
|
||||
print(f"\n\n{Fore.YELLOW}FINISHED")
|
||||
|
Reference in New Issue
Block a user