diff --git a/Auto Trans/Translator.py b/Auto Trans/Translator.py index 4cfbe3e..b6db771 100644 --- a/Auto Trans/Translator.py +++ b/Auto Trans/Translator.py @@ -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] = "🔠"