Class TranslationApiImpl
- java.lang.Object
-
- com.github.vbauer.yta.service.basic.AbstractApi
-
- com.github.vbauer.yta.service.fraction.impl.TranslationApiImpl
-
- All Implemented Interfaces:
TranslationApi
@ThreadSafe public class TranslationApiImpl extends AbstractApi implements TranslationApi
SeeTranslationApi
.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ATTR_FORMAT
static java.lang.String
ATTR_LANG
static java.lang.String
ATTR_TEXT
static java.lang.String
METHOD_DETECT
-
Constructor Summary
Constructors Constructor Description TranslationApiImpl(ApiContext context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Translation
translate(java.lang.String text, Direction direction)
Translates text to the specified language.Translation
translate(java.lang.String text, Direction direction, TextFormat format)
Translates text to the specified language.Translation
translate(java.lang.String text, Language language)
Translates text to the specified language.-
Methods inherited from class com.github.vbauer.yta.service.basic.AbstractApi
callMethod, client, converter
-
-
-
-
Field Detail
-
METHOD_DETECT
public static final java.lang.String METHOD_DETECT
- See Also:
- Constant Field Values
-
ATTR_LANG
public static final java.lang.String ATTR_LANG
- See Also:
- Constant Field Values
-
ATTR_TEXT
public static final java.lang.String ATTR_TEXT
- See Also:
- Constant Field Values
-
ATTR_FORMAT
public static final java.lang.String ATTR_FORMAT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TranslationApiImpl
public TranslationApiImpl(ApiContext context)
-
-
Method Detail
-
translate
@Nonnull public Translation translate(@Nullable java.lang.String text, @Nonnull Language language)
Translates text to the specified language. Source language is detected by text. Text format isTextFormat.PLAIN_TEXT
.- Specified by:
translate
in interfaceTranslationApi
- Parameters:
text
- the text to translatelanguage
- the target language for translation- Returns:
- translated text
-
translate
@Nonnull public Translation translate(@Nullable java.lang.String text, @Nonnull Direction direction)
Translates text to the specified language. Text format isTextFormat.PLAIN_TEXT
.- Specified by:
translate
in interfaceTranslationApi
- Parameters:
text
- the text to translatedirection
- the direction of translation- Returns:
- translated text
-
translate
@Nonnull public Translation translate(@Nullable java.lang.String text, @Nonnull Direction direction, @Nullable TextFormat format)
Translates text to the specified language.- Specified by:
translate
in interfaceTranslationApi
- Parameters:
text
- the text to translatedirection
- the direction of translationformat
- the text format- Returns:
- translated text
-
-