use of com.amazonaws.services.translate.model.TranslateTextResult in project aws-doc-sdk-examples by awsdocs.
the class App method main.
public static void main(String[] args) {
// Create credentials using a provider chain. For more information, see
// https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/credentials.html
AWSCredentialsProvider awsCreds = DefaultAWSCredentialsProviderChain.getInstance();
AWSTranslate translate = AmazonTranslateClient.standard().withCredentials(new AWSStaticCredentialsProvider(awsCreds)).withRegion(REGION).build();
TranslateTextRequest request = new TranslateTextRequest().withText("Hello, world").withSourceLanguageCode("en").withTargetLanguageCode("es");
TranslateTextResult result = translate.translateText(request);
System.out.println(result.getTranslatedText());
}
Aggregations