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): ...@@ -86,9 +86,6 @@ class MachineTranslation(object):
# Needed for Microsoft # Needed for Microsoft
if text.startswith('\xef\xbb\xbf'): if text.startswith('\xef\xbb\xbf'):
text = text.decode('UTF-8-sig') 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 # Needed for Google
while ',,' in text: while ',,' in text:
text = text.replace(',,', ',null,') text = text.replace(',,', ',null,')
......
...@@ -43,6 +43,8 @@ class GoogleTranslation(MachineTranslation): ...@@ -43,6 +43,8 @@ class GoogleTranslation(MachineTranslation):
text=text, text=text,
sl='en', sl='en',
tl=language, tl=language,
ie='UTF-8',
oe='UTF-8'
) )
return [(response[0][0][0], 100, self.name, text)] 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