Package rocks.xmpp.extensions.langtrans
Class LanguageTranslationManager
- java.lang.Object
-
- rocks.xmpp.core.session.Manager
-
- rocks.xmpp.extensions.langtrans.LanguageTranslationManager
-
public final class LanguageTranslationManager extends Manager
Manages XMPP language translation protocol.It lets you discover language translation providers and ask them to translate a text.
- See Also:
- XEP-0171: Language Translation
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AsyncResult<List<LanguageSupport.Item>>
discoverLanguageSupport(Jid translationProvider)
Discovers language support for a translation provider.AsyncResult<List<Item>>
discoverTranslationProviders()
Discovers the language provider on the connected server.AsyncResult<List<LanguageTranslation.Translation>>
translate(Jid translationProvider, String text, Locale sourceLanguage, Locale... destinationLanguage)
Translates a text by sending a query to a translation provider.-
Methods inherited from class rocks.xmpp.core.session.Manager
isEnabled, setEnabled
-
-
-
-
Method Detail
-
discoverTranslationProviders
public AsyncResult<List<Item>> discoverTranslationProviders()
Discovers the language provider on the connected server.- Returns:
- The async result containing the list of translation providers.
- See Also:
- 4.2 Discovering Translation Providers
-
discoverLanguageSupport
public AsyncResult<List<LanguageSupport.Item>> discoverLanguageSupport(Jid translationProvider)
Discovers language support for a translation provider.- Parameters:
translationProvider
- The translation provider.- Returns:
- The list of supported languages with details.
- See Also:
- 4.2.3 Discovering Language Support
-
translate
public AsyncResult<List<LanguageTranslation.Translation>> translate(Jid translationProvider, String text, Locale sourceLanguage, Locale... destinationLanguage)
Translates a text by sending a query to a translation provider.- Parameters:
translationProvider
- The translation provider.text
- The text to be translated.sourceLanguage
- The source language.destinationLanguage
- The destination language.- Returns:
- The translations.
- See Also:
- 4.3 Requesting a Translation from a Service
-
-