With extreme difficulty is the simple answer.
Google used to expose their Translate API, but they closed that about a year and a half ago.
Bing do a translation API, but I have no idea how good it is:
http://www.microsoft.com/web/post/using-the-free-bing-translation-apis[
^]
Generally, I suspect that any translation you can get for free will be worth what you pay for it...and no more.