Class DeepLTranslateService
- java.lang.Object
-
- org.javlo.service.google.translation.DeepLTranslateService
-
- All Implemented Interfaces:
ITranslator
public class DeepLTranslateService extends Object implements ITranslator
-
-
Field Summary
-
Fields inherited from interface org.javlo.service.google.translation.ITranslator
ERROR_PREFIX
-
-
Constructor Summary
Constructors Constructor Description DeepLTranslateService()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ITranslator
getTranslator()
static void
main(String[] args)
static String
translate(String sourceText, String sourceLang, String targetLang, String apiKey)
Translate the source text from source to target language.String
translate(ContentContext ctx, String text, String sourceLang, String targetLang)
-
-
-
Method Detail
-
translate
public static String translate(String sourceText, String sourceLang, String targetLang, String apiKey) throws Exception
Translate the source text from source to target language.- Parameters:
sourceText
- s source text to be translatedsourceLang
- source language of the texttargetLang
- target language of translated text- Throws:
Exception
-
getTranslator
public static final ITranslator getTranslator()
-
translate
public String translate(ContentContext ctx, String text, String sourceLang, String targetLang)
- Specified by:
translate
in interfaceITranslator
-
-