public class DefaultTranslator extends Object implements Translator
| Constructor and Description |
|---|
DefaultTranslator(ServiceLoader loader) |
public DefaultTranslator(ServiceLoader loader)
public String translate(String text, String sourceLanguage, String targetLanguage) throws Exception
Translatortranslate in interface Translatortext - The text to translate.sourceLanguage - The input text language (for example, "en").targetLanguage - The desired language to translate to (for example, "fr").Exception - When there is an error with the API call.public String translate(String text, String targetLanguage) throws Exception
Translatortranslate in interface Translatortext - The text to translate.targetLanguage - The desired language to translate to (for example, "hi").Exception - When there is an error with the API call.public boolean isAvailable()
isAvailable in interface TranslatorCopyright © 2007-2015 The Apache Software Foundation. All Rights Reserved.