public class DefaultTranslator extends Object implements Translator
Translator
implementations available through the
service provider mechanism
.Constructor and Description |
---|
DefaultTranslator() |
DefaultTranslator(ServiceLoader loader) |
Modifier and Type | Method and Description |
---|---|
boolean |
isAvailable() |
String |
translate(String text,
String targetLanguage)
Translate, using the first available service-loaded translator
|
String |
translate(String text,
String sourceLanguage,
String targetLanguage)
Translate, using the first available service-loaded translator
|
public DefaultTranslator(ServiceLoader loader)
public DefaultTranslator()
public String translate(String text, String sourceLanguage, String targetLanguage) throws TikaException, IOException
translate
in interface Translator
text
- The text to translate.sourceLanguage
- The input text language (for example, "en").targetLanguage
- The desired language to translate to (for example, "fr").TikaException
- When there is an error translating.IOException
public String translate(String text, String targetLanguage) throws TikaException, IOException
translate
in interface Translator
text
- The text to translate.targetLanguage
- The desired language to translate to (for example, "hi").TikaException
- When there is an error translating.IOException
public boolean isAvailable()
isAvailable
in interface Translator
Copyright © 2007-2015 The Apache Software Foundation. All Rights Reserved.