Commit a9ba66ac authored by Michal Čihař's avatar Michal Čihař

There are no hacks needed for Google translate

It's just matter of giving it encoding we want
parent 4602dd80
......@@ -86,9 +86,6 @@ class MachineTranslation(object):
# Needed for Microsoft
if text.startswith('\xef\xbb\xbf'):
text = text.decode('UTF-8-sig')
else:
# Some services just cut in middle of UTF-8 char...
text = text.decode('utf-8', 'ignore')
# Needed for Google
while ',,' in text:
text = text.replace(',,', ',null,')
......
......@@ -43,6 +43,8 @@ class GoogleTranslation(MachineTranslation):
text=text,
sl='en',
tl=language,
ie='UTF-8',
oe='UTF-8'
)
return [(response[0][0][0], 100, self.name, text)]
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment