django-rosetta icon indicating copy to clipboard operation
django-rosetta copied to clipboard

Goslate Google Translate service no longer available

Open nealtodd opened this issue 9 years ago • 5 comments

Use of Google Translate for suggestions via the ROSETTA_GOOGLE_TRANSLATE setting may need to be deprecated.

The Goslate package this relies on has been blocked:

Note Google has updated its translation service recently with a ticket mechanism to prevent simple crawler program like goslate from accessing. Though a more sophisticated crawler may still work technically, however it would have crossed the fine line between using the service and breaking the service. goslate will not be updated to break google’s ticket mechanism. Free lunch is over. Thanks for using.

Confirmed this by trying goslate from the shell. It worked for a couple of translations then received a 503:

import goslate
gs = goslate.Goslate()
print(gs.translate('hello world', 'de'))
hallo welt
print(gs.translate('hello world', 'de'))
hallo welt
print(gs.translate('hello world', 'de'))
HTTPError: HTTP Error 503: Service Unavailable

Within Rosetta, after clicking on the select link you're left with ... and a 500 error from the AJAX view.

nealtodd avatar Jan 28 '16 13:01 nealtodd

So, is commercial Google Translate a thing? Could it be used from Rosetta? If not, should we just get rid of the code handling translation via goslate?

mbi avatar Feb 08 '16 21:02 mbi

Google translate does have a commercial v2 API: https://cloud.google.com/translate/

Looking at an example of calling their API it doesn't look like it'd be too much work to refactor views.translate_text to call it directly rather than via goslate and replace ROSETTA_GOOGLE_TRANSLATE with GOOGLE_TRANSLATE_KEY.

Even though it's a paid-for service and the (currently) free Yandex works well, it's probably worth refactoring to support it as it might not be much more work than getting rid of the goslate code!

Although not a high priority I could do a PR for this at some point. In the meantime this issue should be sufficient to highlight that goslate is deprecated without needing to update the sphinx docs.

nealtodd avatar Feb 09 '16 10:02 nealtodd

So is there any change of a refactor? I used this package for a lot of things

dzimbeck avatar Feb 27 '17 07:02 dzimbeck

@dzimbeck Not much to refactor, as long as Google doesn't make their Translate API free again there is not much we can do on our end. As @nealtodd mentioned, the Yandex translate API works quite well.

mbi avatar Feb 27 '17 07:02 mbi

Thanks, yes i realize their API key is very generous at 10 million per month. Will do.

dzimbeck avatar Feb 27 '17 07:02 dzimbeck