OiWorld / MindTheWord

An extension for Google Chrome that helps people learn new languages while they browse the web.
43 stars 47 forks source link

Google translate #128

Closed ankit-m closed 8 years ago

ankit-m commented 8 years ago

This PR adds support for Google Translate API.

Notes

  1. Google does not allow more than 100 characters per second translations. This sometimes might lead to no translations being fetched. This error is caught and logged on the console.
  2. Google allows 128 strings to translated in one call. This forces us to make multiple API calls for one page (i.e. if the number of words is greater than 128). Even if a single API call fails, no translations will be shown.
ceilican commented 8 years ago

I noticed that no changes to the options page were committed. I am wondering where the user will insert the Google API key... Could you tell me? Could you show me a screenshot of the options page?

ceilican commented 8 years ago
  1. Google allows 128 strings to translated in one call. This forces us to make multiple API calls for one page (i.e. if the number of words is greater than 128). Even if a single API call fails, no translations will be shown.

Wouldn't it make more sense to show the translations corresponding to the successful API calls?

rohankatyal29 commented 8 years ago

@Ceilican: There is already support for the user to save the key

screen shot 2016-06-08 at 8 58 30 am
ceilican commented 8 years ago

Thanks!

ankit-m commented 8 years ago

Thanks @rohankatyal29 !

@Ceilican It is because Promise.all() function. It is fast fail function and throws as soon as any one promise fails. I will still try and retrieve the partial results.