Also does it for variable thingys
This commit is contained in:
parent
9464ade313
commit
de88d9fe0f
|
@ -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] = "🔠"
|
||||
|
|
Loading…
Reference in New Issue