<dependency> <groupId>com.ibm.watson.developer_cloud</groupId> <artifactId>language-translator</artifactId> <version>6.12.0</version> </dependency>
'com.ibm.watson.developer_cloud:language-translator:6.12.0'Select a domain, then identify or select the language of text, and then translate the text from one supported language to another.
Example: Translate 'hello' from English to Spanish using the Language Translator service.
LanguageTranslator service = new LanguageTranslator(); IamOptions iamOptions = new IamOptions.Builder() .apiKey("<iam_api_key>") .build(); service.setIamCredentials(iamOptions); TranslateOptions translateOptions = new TranslateOptions.Builder() .addText("hello") .source(Language.ENGLISH) .target(Language.SPANISH) .build(); TranslationResult translationResult = service.translate(translateOptions).execute(); System.out.println(translationResult);