Friday, October 16, 2009

Delphi: Using Google for online translating

Google provides its Translation API that looks very promising and useful. So I was very enthusiastic when we decided to use it in our Localizer project.
Unfortunately I can’t say that API is well documented. And of course there is no tutorial that describes how to use it in Delphi 2009 as we need to do.
I spent some time searching the web and found a few articles concerning this task but not a single of them give me a solution.
All found articles suggest to use the URL to access the translation service. It is not quite correct. First, this URL is used for end-user requests via browser. Its parameters are not documented and can be changed any time. Second, the response is a regular web page with a lot of unnecessary tags, text etc. It is a kind of headache to extract the result from it. And, as well as the URL, the response layout can be (I’d even say it definitely will be) changed in the future.