public class YandexTranslator extends Object implements Translator
translator.yandex.properties
file.Constructor and Description |
---|
YandexTranslator() |
Modifier and Type | Method and Description |
---|---|
String |
getApiKey()
Get the API Key in use for client authentication
|
String |
getFormat()
Retrieve the current text format setting.
|
boolean |
isAvailable() |
void |
setApiKey(String apiKey)
Set the API Key for client authentication
|
void |
setFormat(String format)
Set the text format to use (plain/html)
|
String |
translate(String text,
String targetLanguage)
Translate text to the given language
This method attempts to auto-detect the source language of the text.
|
String |
translate(String text,
String sourceLanguage,
String targetLanguage)
Translate text between given languages.
|
public String translate(String text, String sourceLanguage, String targetLanguage) throws TikaException, IOException
Translator
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 getApiKey()
public void setApiKey(String apiKey)
apiKey
- API Keypublic String getFormat()
public void setFormat(String format)
format
- Text format setting, either plain or htmlpublic String translate(String text, String targetLanguage) throws TikaException, IOException
Translator
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–1969 The Apache Software Foundation. All rights reserved.