views:

104

answers:

2

We're using google translate to translate some shorter texts dynamically on our site. The current implementation looks pretty much like this example in google code playground.

Now we need to translate slightly longer texts, which are too long for GET-method. From google documentation it seems to be possible to use POST for sending the translation string.

Can anybody explain how to get it to use POST as there is no form that's submitted and the data sent to google contains only text and source/target languages?

Thanks in advance.

A: 

To answer my own question: It seems it's impossible to get the JS translator call to use POST. The workaround would be to send(ajax) the translation-string to our server, make the server connect to Google, get the translation, send(ajax) it back to client and update it.

The other evident option is to clip to text to small enough chunks to fit GET...

Marcus
A: 

As it says in the documentation, it is not possible with JavaScript. But what you can do is create a webservice in between Google and you in a server side language. And then use JavaScript to run parameter to the.

alt text

(http://bildr.no/view/551563)

sv88erik
This seems to be the only way to do it for now.. :|. I think Google requires in the terms of use that the translation is triggered from user interaction, which pretty much rules out other options. Anyway, thanks for the help.
Marcus
Just nice to be able to help, remember to set the question as answered.
sv88erik