public class TranslationService extends Object
TranslationProviders can be contributed, each one representing an online service.| Constructor and Description |
|---|
TranslationService() |
| Modifier and Type | Method and Description |
|---|---|
void |
addProvider(TranslationProvider provider) |
boolean |
isEnabled(JCRSiteNode site)
Checks if one provider is enabled for a given site.
|
List<String> |
translate(List<String> texts,
String srcLanguage,
String destLanguage,
boolean isHtml,
JCRSiteNode site,
Locale uiLocale)
Calls the translate method from the first enabled
TranslationProvider with a list of texts to translate. |
String |
translate(String text,
String srcLanguage,
String destLanguage,
boolean isHtml,
JCRSiteNode site,
Locale uiLocale)
Calls the translate method from the first enabled
TranslationProvider with a single text to translate. |
public String translate(String text, String srcLanguage, String destLanguage, boolean isHtml, JCRSiteNode site, Locale uiLocale) throws TranslationException
TranslationProvider with a single text to translate.
If the text is blank, it's just returned without calling the TranslationProvider.text - a text to translatesrcLanguage - the source language codedestLanguage - the destination language codeisHtml - is the text html or plain textsite - the siteuiLocale - TranslationExceptionpublic List<String> translate(List<String> texts, String srcLanguage, String destLanguage, boolean isHtml, JCRSiteNode site, Locale uiLocale) throws TranslationException
TranslationProvider with a list of texts to translate.
If the list contains only one text, the single text method is called.
Blank texts are not passed to the TranslationProvider.texts - a list of texts to translatesrcLanguage - the source language codedestLanguage - the destination language codeisHtml - are the texts html or plain textssite - the siteuiLocale - TranslationExceptionpublic boolean isEnabled(JCRSiteNode site)
site - a sitepublic void addProvider(TranslationProvider provider)
Copyright © 2004–2020 Jahia Solutions Group SA. All rights reserved.