google-translate-api
google-translate-api copied to clipboard
Getting an error from Ionic Angular
Hi, Trying to use the module from Ionic over Angular, I'm getting an error as in the link below. Any ideas?
Cheers.
https://cdn-enterprise.discourse.org/ionicframework/uploads/default/original/3X/0/c/0c47de6f934ffce6fdb8b9f738e0a4cd87fe68b0.png
Same issue when trying to import into React app. Works perfectly well if trying in node environment. Is it meant to work in browser at all?
Try my "fork" at https://www.npmjs.com/package/google-translate-api-without-node -- I've been successfully using this in a webpacked browser app without issues, uses jQuery for requests.
Ironically enough though, it started producing an error a little while back, maybe a few months ago. Perhaps I need to sync up with the main repo again?
Edit: I merged upstream and everything works fine now 👍
Thanks deniiislysenko. Tried it and now I get -
XMLHttpRequest cannot load https://translate.google.com/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8100' is therefore not allowed access.
Tried from Chrome as well as from Cordova on IPad.
Any idea?
Same issue here - since translate.google.com does not send CORS header, it won't work from any other domain.
I am using it in a chrome extension and I think there is a way to avoid CORS issues with that. Not sure about your use case.
On Fri, Aug 25, 2017, 11:56 Andrey Gruniov [email protected] wrote:
Same issue here - since translate.google.com does not send CORS header, it won't work from any other domain.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/matheuss/google-translate-api/issues/32#issuecomment-325008657, or mute the thread https://github.com/notifications/unsubscribe-auth/AE4I_5APt-9VJTUaemfeQIp8RCGQnRvvks5sbxj6gaJpZM4O6Xyu .
Not sure. I tried it a while ago with no success. As a quick workaround, I'm going to use this module in a small express app and serve the result to front end.
If you install the CORS Chrome extension, it will work. When deployed to mobile using cordova, it won't.
On Sat, Aug 26, 2017 at 2:43 AM, Andrey Gruniov [email protected] wrote:
Not sure. I tried it a while ago with no success. As a quick workaround, I'm going to use this module in a small express app and serve the result to front end.
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/matheuss/google-translate-api/issues/32#issuecomment-325017959, or mute the thread https://github.com/notifications/unsubscribe-auth/AdIKCyAN8KN6-8qtS0erUjVe1h5t6uA9ks5sbyPFgaJpZM4O6Xyu .
I created a simple server with express using google-translate-api, so make a deploy on heroku, wedeploy, etc and solve the problem with prototype and cors. Here the project: https://github.com/brenopolanski/server-google-translate-api
I want to implement it in my Ionic(v1) app. How can I manage to do that? any sample codes? or is it a normal http request?..