I'm trying to find a way to translate text with an api. Has anyone done this?
Never done this myself, but this Google API seems like something that should be useable from within your prototype: https://cloud.google.com/translate
Thanks Edwin. I was hoping to find a free solution
Ah, I see. Don't know any, I'm afraid. Good luck finding one!
Thanks. I did find this free one, but I'm not familiar with how it would be used / implemented in Framer http://www.transltr.org/Developers
Think you'd likely be using XMLHttpRequest from inside your project. Some more info on using that from CoffeeScript is here (although the actual CS code is really badly formatted): https://coffeescript-cookbook.github.io/chapters/ajax/ajax_request_without_jquery
Thanks for that! I was actually looking into ways to scrape the html of a url from a different domain. That way I could generate a google translate url that includes the text I want to translate and then just parse the html to get the translated text. But I don't have experience doing that kind of programming and didn't want to spend a whole lot of time if it's too involved
From what I understand the XMLHttpRequest method only works within your own domain. Unless there's some way to use a proxy server through framer...
I think XMLHttpRequests can be cross origin (using 'CORS') - all the details should be here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS
Having a bit of trouble -- I'm trying to get the html of this page:
I'm trying to get the "hello world" text that it produces in the 'id="result_box"' div.
Here's my code. It can get a bunch of text back from the target page, but it's different than what I'm seeing when I load the page manually.. I must be missing a step. Any ideas? If I print the xhr.responseText it gives a bunch of stuff from Google Translate, but apparently not the translation query or results