Encontre este proyecto en Google Code el nos permite usar Google Translate en nuestras aplicaciones Java.
Su uso es de lo mas sencillo:
import com.google.api.translate.Language;
import com.google.api.translate.Translate;
public class Main {
public static void main(String[] args) {
try {
String translatedText = Translate.translate("Hola mundo", Language.SPANISH, Language.ENGLISH);
System.out.println(translatedText);
} catch (Exception ex) {
ex.printStackTrace(); }
}
}
Tags: Enables using Google Translate from a Java application
Thank you very much for your text about this topic
Ayuda, tengo este codigo:
public static void main(String[] args) {
try {
String translatedText = Translate.translate(”Hola mundo”,
Language.SPANISH,Language.ENGLISH);
System.out.println(translatedText);
} catch (Exception ex) {
System.out.print(ex.getMessage());
}
}
y agregado al classpath: “google-api-translate-java-0.92.jar”
y NO me traduce ME sale ERROR que hago (Avisar a mi email: dmcoding hotmail com)
Gracias
David, postea el error que te marca o hazme llegar tu codigo de ser posible
Antes debes llamar al metodo serReferer.
GoogleAPI.serReferer(”http://www.google.com”);