com.google.api.javame
Class Translate
java.lang.Object
com.google.api.javame.Translate
public class Translate
- extends java.lang.Object
Makes the Google Translate API available to Java ME applications.
- Author:
- Jinath Sanjitha, Richard Midwinter
Method Summary |
static java.lang.String |
getAutoDetectedLanguage(java.lang.String text)
This static method detected language and return language string code. |
static java.lang.String |
getUnicode(byte[] buf)
Process and Return the Unicode text from the received data |
static java.lang.String |
translate(java.lang.String text,
java.lang.String from,
java.lang.String to)
Translates text from a given language to another given language using Google Translate API |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AUTO_DETECTED_LANGUAGE
public static java.lang.String AUTO_DETECTED_LANGUAGE
Translate
public Translate()
translate
public static java.lang.String translate(java.lang.String text,
java.lang.String from,
java.lang.String to)
throws java.lang.Exception
- Translates text from a given language to another given language using Google Translate API
- 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:
java.io.IOException
java.lang.Exception
getUnicode
public static java.lang.String getUnicode(byte[] buf)
- Process and Return the Unicode text from the received data
- Parameters:
buf
- byte array
- Returns:
- Processed String.
getAutoDetectedLanguage
public static java.lang.String getAutoDetectedLanguage(java.lang.String text)
throws java.lang.Exception
- This static method detected language and return language string code.
Contributet by Kamil MyĆliwiec
- Parameters:
text
- provided to translate
- Returns:
- The Auto detected language Code
- Throws:
java.lang.Exception
- "Error getting the Auto detected language"