Package com.e1c.langtool.external
Interface IExternalTranslationProvider
- All Known Implementing Classes:
AbstractStorageTranslationProvider,CamelCaseProvider,ComputedStringsProvider,ContextDefExternalTranslationProvider,ContextStorageTranslationProvider,DbViewExternalTranslationProvider,DictionaryStorageTranslationProvider,ExternalTranslationProvider,GoogleTranslateProvider,MicrosoftTranslatorProvider,MockedExternalTranslationProvider,TranslitExternalTranslationProvider,YandexTranslateProvider
public interface IExternalTranslationProvider
Provides translating of strings by external translation services.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe id of extension point that contains reference to this interface. -
Method Summary
Modifier and TypeMethodDescriptionReturns the set of supported language codes by this service.getLanguages(String targetLocale) 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.default Stringdefault booleanisActive()Deprecated.Returns a list of translations by the given query.Translates text from a given language to another given language.Translates text from a given language to another given language.
-
Field Details
-
EXTENSION_POINT_ID
The id of extension point that contains reference to this interface.- See Also:
-
-
Method Details
-
translate
Translates text from a given language to another given language.- Parameters:
text- the string to translatesourceLocale- the code of language to translate fromtargetLocale- the code of language to translate to- Returns:
- the list of possible translations for given text
- Throws:
IllegalArgumentException- if text is nullTranslationServiceException- if errors occur while translating
-
translate
Translates text from a given language to another given language. In contrast totranslate(String, String, String)this method allows to translate a list of strings for one query to translation service.- Parameters:
texts- the list of strings to translate in the same languagesourceLocale- the code of language to translate fromtargetLocale- 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
- Throws:
IllegalArgumentException- if list of texts is null or any element of list is nullTranslationServiceException- if errors occur while translating
-
getLanguageCodes
Returns the set of supported language codes by this service.- Returns:
- the set of supported language codes
- Throws:
TranslationServiceException- if errors occur while getting set of supported language codes
-
getLanguages
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.- Parameters:
targetLocale- the locale to localize names of languages- Returns:
- map with language codes and localized names of languages
-
isActive
Deprecated.Returns true if this provider is active.- Returns:
- true if this provider is active
-
translate
Returns a list of translations by the given query.Default implementation of this method uses
translate(String, String, String)with the following arguments:- text -
ISingleTranslationQuery.getText() - source language -
ITranslationQuery.getSourceLanguage() - target language -
ITranslationQuery.getTargetLanguage()}
- Parameters:
query- the query for translating- Returns:
- a list of translations
- text -
-
getTranslationItemImageName
-