Page 1 of 1

Web - response from the browser

PostPosted: Wed Dec 04, 2013 11:10 am
by Leos
Hi,

With this simple code, I say to google's translator to translate the phrase "Olá meus amigos do Neobook".
Is there any method for automatically translating and passing it to NeoBook?

I appreciate your help

Code: Select all

setvar "[termo]" "Olá meus amigos do Neobook"
SetVar "[languagesin]" "pt|en"

SetVar "[nettradutor]" "http://translate.google.pt/?hl=pt-PT&tab=nT#[languagesIn]|[termo]"

RefreshObject "WebBrowser1tradutor"
BrowserGoTo "WebBrowser1tradutor" "![nettradutor]"



........................................................
Com este simples código, digo ao google translator para me traduzir a frase "Olá meus amigos do Neobook!".
Existe algum método para obter automáticamente a tradução e passá-la para o neobook?
Agradeço a vossa ajuda

Re: Web - response from the browser

PostPosted: Wed Dec 04, 2013 11:45 am
by Gaev
Leos:

You need to call their API service (using InternetGet) for what you want to do ... but it is not free ($20 per 1 million characters) ... reasonably priced, but if are going to include this inside NeoBook Applications that you distribute to users, be careful that they do not (somehow) reverse engineer your code and find out your API Key ... you will be charged for all requests made with the API Key assigned to you.

Re: Web - response from the browser

PostPosted: Wed Dec 04, 2013 11:48 am
by Neosoft Support
If it was a normal web form you could use JavaScript to retrieve the translated text. However, it looks like Google has written their translation page in such a way that prevents this.

You might be able to use Bing's translation service via JavaScript through the browser:

http://web.archive.org/web/20110720142541/http://basharkokash.com/post/2010/04/19/Bing-Translator-for-developers.aspx

Re: Web - response from the browser

PostPosted: Wed Dec 04, 2013 6:49 pm
by mishem
Code: Select all
InternetPost "http://translate.google.com/translate_t?hl=en&ie=UTF8" "hl=en&ie=UTF8&oe=UTF8&text=[Text]&langpair=auto|ru" "[Text]" ""
zmConvertString "Utf8ToAnsi" "[Text]" "[Text]"

SearchStr "TRANSLATED_TEXT" "[Text]" "[Result]" ""
SearchStr "INPUT_TOOL_PATH" "[Text]" "[Result2]" ""

SubStr "[Text]" "[Result]+17" "[Result2]-[Result]-19" "[Text]"


zmConvertString - plug-in zmFunctions
langpair=auto|ru
Will still need to replace special characters html

Re: Web - response from the browser

PostPosted: Sat Dec 07, 2013 7:37 pm
by smokinbanger
I spent some time on this too and after digging into there source code found they intentionally left out the Element Name from the result_box apparently for this very reason; to force users to purchase the translations via the api billing.

Re: Web - response from the browser

PostPosted: Wed Dec 11, 2013 10:01 am
by Leos
Thanks to all who tried to help.
Unfortunately it seems to be a little complicated, unfortunately.
As an example, I present the link to one of the possible applications.

mishem, I could not test your code.
Once I have results, I communicate

Best regards

http://www.neosoftware.com/community/viewtopic.php?f=6&t=20298