public final DetectLanguageResponse detectLanguage(
      LocationName parent, String model, String mimeType, String content) {
    DetectLanguageRequest request =
        DetectLanguageRequest.newBuilder()
            .setParent(parent == null ? null : parent.toString())
            .setModel(model)
            .setMimeType(mimeType)
            .setContent(content)
            .build();
    return detectLanguage(request);
  }
Detects the language of text within a request.

<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()) {
  LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
  String model = "model104069929";
  String mimeType = "mimeType-1392120434";
  String content = "content951530617";
  DetectLanguageResponse response =
      translationServiceClient.detectLanguage(parent, model, mimeType, content);
}
}</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}/locations/{location-id}` or
    `projects/{project-number-or-id}`.
    <p>For global calls, use `projects/{project-number-or-id}/locations/global` or
    `projects/{project-number-or-id}`.
    <p>Only models within the same region (has same location-id) can be used. Otherwise an
    INVALID_ARGUMENT (400) error is returned.
@param model Optional. The language detection model to be used.
    <p>Format:
    `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}`
    <p>Only one language detection model is currently supported:
    `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`.
    <p>If not specified, the default model is used.
@param mimeType Optional. The format of the source text, for example, "text/html",
    "text/plain". If left blank, the MIME type defaults to "text/html".
@param content The content of the input stored as a string.
@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