public class DefaultTranslator extends java.lang.Object implements Translator
Translator
implementations available through the
service provider mechanism
.Constructor and Description |
---|
DefaultTranslator() |
DefaultTranslator(ServiceLoader loader) |
Modifier and Type | Method and Description |
---|---|
Translator |
getTranslator()
Returns the current translator
|
java.util.List<Translator> |
getTranslators()
Returns all available translators
|
boolean |
isAvailable() |
java.lang.String |
translate(java.lang.String text,
java.lang.String targetLanguage)
Translate, using the first available service-loaded translator
|
java.lang.String |
translate(java.lang.String text,
java.lang.String sourceLanguage,
java.lang.String targetLanguage)
Translate, using the first available service-loaded translator
|
public DefaultTranslator(ServiceLoader loader)
public DefaultTranslator()
public java.lang.String translate(java.lang.String text, java.lang.String sourceLanguage, java.lang.String targetLanguage) throws TikaException, java.io.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.java.io.IOException
public java.lang.String translate(java.lang.String text, java.lang.String targetLanguage) throws TikaException, java.io.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.java.io.IOException
public java.util.List<Translator> getTranslators()
public Translator getTranslator()
public boolean isAvailable()
isAvailable
in interface Translator
"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"