Package com.e1c.langtool.yandex
Class YandexTranslateProvider
java.lang.Object
com.e1c.langtool.yandex.YandexTranslateProvider
- All Implemented Interfaces:
IExternalTranslationProvider
The provider for accessing to Yandex.Translate service.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic class -
Field Summary
FieldsFields inherited from interface com.e1c.langtool.external.IExternalTranslationProvider
EXTENSION_POINT_ID -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected HttpClientprotected YandexQueryBuilderIt necessary for mock objectprotected YandexQueryBuilderIt necessary for mock objectReturns the set of supported language codes by this service.getLanguages(String target) Returns a map of supported language codes and localized names of languages using the given target language or null if service doesn't support the given language.booleanisActive()Returns true if this provider is active.Translates text from a given language to another given language.Translates text from a given language to another given language.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.e1c.langtool.external.IExternalTranslationProvider
translate
-
Field Details
-
PROVIDER_ID
- See Also:
-
client
-
-
Constructor Details
-
YandexTranslateProvider
public YandexTranslateProvider()
-
-
Method Details
-
getTranslationItemImageName
- Specified by:
getTranslationItemImageNamein interfaceIExternalTranslationProvider
-
translate
Description copied from interface:IExternalTranslationProviderTranslates text from a given language to another given language.- Specified by:
translatein interfaceIExternalTranslationProvider- Parameters:
text- the string to translatesource- the code of language to translate fromtarget- the code of language to translate to- Returns:
- the list of possible translations for given text
-
translate
Description copied from interface:IExternalTranslationProviderTranslates text from a given language to another given language. In contrast toIExternalTranslationProvider.translate(String, String, String)this method allows to translate a list of strings for one query to translation service.- Specified by:
translatein interfaceIExternalTranslationProvider- Parameters:
texts- the list of strings to translate in the same languagesource- the code of language to translate fromtarget- the code language to translate to- Returns:
- the map where keys are elements of the given list with strings and values are possible translations for every key in the map
-
getLanguageCodes
Returns the set of supported language codes by this service.- Specified by:
getLanguageCodesin interfaceIExternalTranslationProvider- Returns:
- the unmodifiable list of supported languages
- See Also:
-
getLanguages
Description copied from interface:IExternalTranslationProviderReturns a map of supported language codes and localized names of languages using the given target language or null if service doesn't support the given language.- Specified by:
getLanguagesin interfaceIExternalTranslationProvider- Parameters:
target- the locale to localize names of languages- Returns:
- map with language codes and localized names of languages
-
isActive
public boolean isActive()Description copied from interface:IExternalTranslationProviderReturns true if this provider is active.- Specified by:
isActivein interfaceIExternalTranslationProvider- Returns:
- true if this provider is active
-
createTranslationQuery
It necessary for mock object -
createGettingSupportedLanguagesQuery
It necessary for mock object -
createClient
-