What's new? | Help | Directory | Sign in
Google
google-api-translate-java
Enables using Google Translate from a Java application
  
  
  
  
    
Join project
Project owners:
  rich.midwinter

Provides a simple, unofficial, Java client API for using Google Translate.

Install

Simply include the google-api-translate-java.jar file in your application's classpath.

Quickstart

This is our "Hello World" example:

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("Salut le monde", Language.FRENCH, Language.ENGLISH);
      System.out.println(translatedText);
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
}

Well done. You're now an expert in using this API! The wiki has a more complete example usage within a desktop application.

Features

Automatically throttles repeated queries to within Google limits.

Uses English as an intermediate language to attempt translations between language pairings that are unsupported directly by Google Translate.

Problems / Suggestions?

Please do report an issue if you find any bugs or have any feature requests.