com.google.api.translate
Class Translate

java.lang.Object
  extended by com.google.api.GoogleAPI
      extended by com.google.api.translate.Translate

public final class Translate
extends GoogleAPI

Makes the Google Translate API available to Java applications.

Author:
Richard Midwinter, Mike Nereson, Emeric Vernat, Juan B Cabral, Kramar Tomas

Field Summary
 
Fields inherited from class com.google.api.GoogleAPI
ENCODING, referrer
 
Constructor Summary
Translate()
           
 
Method Summary
static String[] execute(String[] text, Language[] from, Language[] to)
          Translates text from a given Language to another given Language using Google Translate.
static String[] execute(String[] text, Language from, Language to)
          Translates an array of text Strings from a given Language to another given Language using Google Translate.
static String execute(String text, Language from, Language to)
          Translates text from a given Language to another given Language using Google Translate.
static String[] execute(String text, Language from, Language[] to)
          Translates a String from a given Language to an Array of Languages using Google Translate.
static String translate(String text, Language from, Language to)
          Deprecated. Replaced by execute().
 
Methods inherited from class com.google.api.GoogleAPI
retrieveJSON, retrieveJSON, setHttpReferrer, validateReferrer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Translate

public Translate()
Method Detail

execute

public static String execute(String text,
                             Language from,
                             Language to)
                      throws Exception
Translates text from a given Language to another given Language using Google Translate.

Parameters:
text - The String to translate.
from - The language code to translate from.
to - The language code to translate to.
Returns:
The translated String.
Throws:
Exception - on error.

execute

public static String[] execute(String[] text,
                               Language from,
                               Language to)
                        throws Exception
Translates an array of text Strings from a given Language to another given Language using Google Translate.

Parameters:
text - The array of Strings to translate.
from - The language code to translate from.
to - The language code to translate to.
Returns:
The translated array of String results.
Throws:
Exception - on error.

execute

public static String[] execute(String text,
                               Language from,
                               Language[] to)
                        throws Exception
Translates a String from a given Language to an Array of Languages using Google Translate.

Parameters:
text - The String to translate.
from - The language code to translate from.
to - The array of Languages to translate to.
Returns:
The translated array of String results.
Throws:
Exception - on error.

execute

public static String[] execute(String[] text,
                               Language[] from,
                               Language[] to)
                        throws Exception
Translates text from a given Language to another given Language using Google Translate.

Parameters:
text - The array of Strings to translate.
from - The array of Language codes to translate from.
to - The array of Language codes to translate to.
Returns:
The translated array of String results.
Throws:
Exception - on error.

translate

@Deprecated
public static String translate(String text,
                                          Language from,
                                          Language to)
                        throws Exception
Deprecated. Replaced by execute().

Throws:
Exception


Copyright © 2011. All Rights Reserved.