Also does it for variable thingys

This commit is contained in:
GManon 2022-12-25 23:35:48 -03:00
parent 9464ade313
commit de88d9fe0f
1 changed files with 2 additions and 2 deletions

View File

@ -19,12 +19,12 @@ times = []
def translate(string):
# Split the string by it's tags
tokens = re.findall(r'\b\w+\b|{[^}]*}|[^\w\s]|\s+', string)
tokens = re.findall(r'\b\w+\b|{[^}]*}|\[.*\]|[^\w\s]|\s+', string)
# We encode this bitch up so that google trans doesn't botch the tags
to_restore = []
for idx, token in enumerate(tokens):
if token[0] == "{":
if token[0] == "{" or token[0] == "[":
to_restore.append(token)
# Emojis aren't touched by the translator and retain their position 😎
tokens[idx] = "🔠"