public final TranslateTextResponse translateText(
      String parent, String targetLanguageCode, List<String> contents) {
    TranslateTextRequest request =
        TranslateTextRequest.newBuilder()
            .setParent(parent)
            .setTargetLanguageCode(targetLanguageCode)
            .addAllContents(contents)
            .build();
    return translateText(request);
  }
Translates input text and returns translated text.

<p>Sample code:

<pre>{@code
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
  String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
  String targetLanguageCode = "targetLanguageCode-106414698";
  List<String> contents = new ArrayList<>();
  TranslateTextResponse response =
      translationServiceClient.translateText(parent, targetLanguageCode, contents);
}
}</pre>

@param parent Required. Project or location to make a call. Must refer to a caller's project.
    <p>Format: `projects/{project-number-or-id}` or
    `projects/{project-number-or-id}/locations/{location-id}`.
    <p>For global calls, use `projects/{project-number-or-id}/locations/global` or
    `projects/{project-number-or-id}`.
    <p>Non-global location is required for requests using AutoML models or custom glossaries.
    <p>Models and glossaries must be within the same region (have same location-id), otherwise
    an INVALID_ARGUMENT (400) error is returned.
@param targetLanguageCode Required. The ISO-639 language code to use for translation of the
    input text, set to one of the language codes listed in Language Support.
@param contents Required. The content of the input in string format. We recommend the total
    content be less than 30,000 codepoints. The max length of this field is 1024. Use
    BatchTranslateText for larger text.
@throws com.google.api.gax.rpc.ApiException if the remote call fails
java-translate/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/TranslationServiceClient.java