import com.google.api.*; import com.google.api.detect.*; import com.google.api.translate.*; import com.tecnick.htmlutils.htmlentities.*; // Although the binaries and issues for the project are maintained here, I've moved the source code over to github. // https://github.com/richmidwinter/google-api-translate-java import com.google.api.translate.Language; import com.google.api.translate.Translate; void setup() { GoogleAPI.setHttpReferrer("http://roberttwomey.com");//* Enter the URL of your site here */); // Set the Google Translate API key // See: http://code.google.com/apis/language/translate/v2/getting_started.html GoogleAPI.setKey("AIzaSyACUZC3H-f2q615RqwcNlfyYPoTFjQ0jMY"); try { String translatedText = Translate.DEFAULT.execute("Bonjour le monde", Language.FRENCH, Language.ENGLISH); println(translatedText); } catch (Exception ex) { ex.printStackTrace(); } }