Class DefaultTranslator
java.lang.Object
org.apache.tika.language.translate.DefaultTranslator
- All Implemented Interfaces:
- Translator
A translator which picks the first available 
Translator
 implementations available through the
 service provider mechanism.- Since:
- Apache Tika 1.6
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionReturns the current translatorReturns all available translatorsbooleanTranslate, using the first available service-loaded translatorTranslate, using the first available service-loaded translator
- 
Constructor Details- 
DefaultTranslator
- 
DefaultTranslatorpublic DefaultTranslator()
 
- 
- 
Method Details- 
translatepublic String translate(String text, String sourceLanguage, String targetLanguage) throws TikaException, IOException Translate, using the first available service-loaded translator- Specified by:
- translatein interface- Translator
- Parameters:
- text- The text to translate.
- sourceLanguage- The input text language (for example, "en").
- targetLanguage- The desired language to translate to (for example, "fr").
- Returns:
- The translation result. If translation is unavailable, returns the same text back.
- Throws:
- TikaException- When there is an error translating.
- IOException
 
- 
translateTranslate, using the first available service-loaded translator- Specified by:
- translatein interface- Translator
- Parameters:
- text- The text to translate.
- targetLanguage- The desired language to translate to (for example, "hi").
- Returns:
- The translation result. If translation is unavailable, returns the same text back.
- Throws:
- TikaException- When there is an error translating.
- IOException
 
- 
getTranslatorsReturns all available translators
- 
getTranslatorReturns the current translator
- 
isAvailablepublic boolean isAvailable()- Specified by:
- isAvailablein interface- Translator
- Returns:
- true if this Translator is probably able to translate right now.
 
 
-