| GitHub Repository | Product Reference | REST Documentation | RPC Documentation |
Service Description: Provides natural language translation operations.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// 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 targetLanguageCode = "targetLanguageCode-106414698";
List<String> contents = new ArrayList<>();
TranslateTextResponse response =
translationServiceClient.translateText(parent, targetLanguageCode, contents);
}
Note: close() needs to be called on the TranslationServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| Method | Description | Method Variants |
|---|---|---|
TranslateText |
Translates input text and returns translated text. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
RomanizeText |
Romanize input text written in non-Latin scripts to Latin text. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DetectLanguage |
Detects the language of text within a request. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetSupportedLanguages |
Returns a list of supported languages for translation. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
TranslateDocument |
Translates documents in synchronous mode. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
BatchTranslateText |
Translates a large volume of text in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location. This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
BatchTranslateDocument |
Translates a large volume of document in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location. This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateGlossary |
Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project doesn't exist. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateGlossary |
Updates a glossary. A LRO is used since the update can be async if the glossary's entry file is updated. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListGlossaries |
Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't exist. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetGlossary |
Gets a glossary. Returns NOT_FOUND, if the glossary doesn't exist. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteGlossary |
Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns NOT_FOUND, if the glossary doesn't exist. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetGlossaryEntry |
Gets a single glossary entry by the given id. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListGlossaryEntries |
List the entries for the glossary. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateGlossaryEntry |
Creates a glossary entry. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateGlossaryEntry |
Updates a glossary entry. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteGlossaryEntry |
Deletes a single entry from the glossary |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateDataset |
Creates a Dataset. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetDataset |
Gets a Dataset. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListDatasets |
Lists datasets. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteDataset |
Deletes a dataset and all of its contents. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateAdaptiveMtDataset |
Creates an Adaptive MT dataset. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteAdaptiveMtDataset |
Deletes an Adaptive MT dataset, including all its entries and associated metadata. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetAdaptiveMtDataset |
Gets the Adaptive MT dataset. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListAdaptiveMtDatasets |
Lists all Adaptive MT datasets for which the caller has read permission. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
AdaptiveMtTranslate |
Translate text using Adaptive MT. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetAdaptiveMtFile |
Gets and AdaptiveMtFile |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteAdaptiveMtFile |
Deletes an AdaptiveMtFile along with its sentences. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ImportAdaptiveMtFile |
Imports an AdaptiveMtFile and adds all of its sentences into the AdaptiveMtDataset. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListAdaptiveMtFiles |
Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListAdaptiveMtSentences |
Lists all AdaptiveMtSentences under a given file/dataset. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ImportData |
Import sentence pairs into translation Dataset. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ExportData |
Exports dataset's data to the provided output location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListExamples |
Lists sentence pairs in the dataset. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateModel |
Creates a Model. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListModels |
Lists models. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetModel |
Gets a model. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteModel |
Deletes a model. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of TranslationServiceSettings to create(). For example:
To customize credentials:
// 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
TranslationServiceSettings translationServiceSettings =
TranslationServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
TranslationServiceClient translationServiceClient =
TranslationServiceClient.create(translationServiceSettings);
To customize the endpoint:
// 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
TranslationServiceSettings translationServiceSettings =
TranslationServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
TranslationServiceClient translationServiceClient =
TranslationServiceClient.create(translationServiceSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// 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
TranslationServiceSettings translationServiceSettings =
TranslationServiceSettings.newHttpJsonBuilder().build();
TranslationServiceClient translationServiceClient =
TranslationServiceClient.create(translationServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Static Methods
create()
public static final TranslationServiceClient create()Constructs an instance of TranslationServiceClient with default settings.
| Returns | |
|---|---|
| Type | Description |
TranslationServiceClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(TranslationServiceSettings settings)
public static final TranslationServiceClient create(TranslationServiceSettings settings)Constructs an instance of TranslationServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
| Parameter | |
|---|---|
| Name | Description |
settings |
TranslationServiceSettings |
| Returns | |
|---|---|
| Type | Description |
TranslationServiceClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(TranslationServiceStub stub)
public static final TranslationServiceClient create(TranslationServiceStub stub)Constructs an instance of TranslationServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(TranslationServiceSettings).
| Parameter | |
|---|---|
| Name | Description |
stub |
TranslationServiceStub |
| Returns | |
|---|---|
| Type | Description |
TranslationServiceClient |
|
Constructors
TranslationServiceClient(TranslationServiceSettings settings)
protected TranslationServiceClient(TranslationServiceSettings settings)Constructs an instance of TranslationServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
| Parameter | |
|---|---|
| Name | Description |
settings |
TranslationServiceSettings |
TranslationServiceClient(TranslationServiceStub stub)
protected TranslationServiceClient(TranslationServiceStub stub)| Parameter | |
|---|---|
| Name | Description |
stub |
TranslationServiceStub |
Methods
adaptiveMtTranslate(@Nullable LocationName parent, List<String> content)
public final AdaptiveMtTranslateResponse adaptiveMtTranslate(@Nullable LocationName parent, List<String> content)Translate text using Adaptive MT.
Sample 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]");
List<String> content = new ArrayList<>();
AdaptiveMtTranslateResponse response =
translationServiceClient.adaptiveMtTranslate(parent, content);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.cloud.translate.v3.LocationNameRequired. Location to make a regional call. Format: |
content |
List<String>Required. The content of the input in string format. |
| Returns | |
|---|---|
| Type | Description |
AdaptiveMtTranslateResponse |
|
adaptiveMtTranslate(AdaptiveMtTranslateRequest request)
public final AdaptiveMtTranslateResponse adaptiveMtTranslate(AdaptiveMtTranslateRequest request)Translate text using Adaptive MT.
Sample 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()) {
AdaptiveMtTranslateRequest request =
AdaptiveMtTranslateRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setDataset(
AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
.addAllContent(new ArrayList<String>())
.setMimeType("mimeType-1392120434")
.setReferenceSentenceConfig(
AdaptiveMtTranslateRequest.ReferenceSentenceConfig.newBuilder().build())
.setGlossaryConfig(AdaptiveMtTranslateRequest.GlossaryConfig.newBuilder().build())
.build();
AdaptiveMtTranslateResponse response = translationServiceClient.adaptiveMtTranslate(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
AdaptiveMtTranslateRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
AdaptiveMtTranslateResponse |
|
adaptiveMtTranslate(String parent, List<String> content)
public final AdaptiveMtTranslateResponse adaptiveMtTranslate(String parent, List<String> content)Translate text using Adaptive MT.
Sample 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();
List<String> content = new ArrayList<>();
AdaptiveMtTranslateResponse response =
translationServiceClient.adaptiveMtTranslate(parent, content);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. Location to make a regional call. Format: |
content |
List<String>Required. The content of the input in string format. |
| Returns | |
|---|---|
| Type | Description |
AdaptiveMtTranslateResponse |
|
adaptiveMtTranslateCallable()
public final UnaryCallable<AdaptiveMtTranslateRequest,AdaptiveMtTranslateResponse> adaptiveMtTranslateCallable()Translate text using Adaptive MT.
Sample 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()) {
AdaptiveMtTranslateRequest request =
AdaptiveMtTranslateRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setDataset(
AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
.addAllContent(new ArrayList<String>())
.setMimeType("mimeType-1392120434")
.setReferenceSentenceConfig(
AdaptiveMtTranslateRequest.ReferenceSentenceConfig.newBuilder().build())
.setGlossaryConfig(AdaptiveMtTranslateRequest.GlossaryConfig.newBuilder().build())
.build();
ApiFuture<AdaptiveMtTranslateResponse> future =
translationServiceClient.adaptiveMtTranslateCallable().futureCall(request);
// Do something.
AdaptiveMtTranslateResponse response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<AdaptiveMtTranslateRequest,AdaptiveMtTranslateResponse> |
|
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)| Parameters | |
|---|---|
| Name | Description |
duration |
long |
unit |
TimeUnit |
| Returns | |
|---|---|
| Type | Description |
boolean |
|
| Exceptions | |
|---|---|
| Type | Description |
InterruptedException |
|
batchTranslateDocumentAsync(@Nullable LocationName parent, String sourceLanguageCode, List<String> targetLanguageCodes, List<BatchDocumentInputConfig> inputConfigs, BatchDocumentOutputConfig outputConfig)
public final OperationFuture<BatchTranslateDocumentResponse,BatchTranslateDocumentMetadata> batchTranslateDocumentAsync(@Nullable LocationName parent, String sourceLanguageCode, List<String> targetLanguageCodes, List<BatchDocumentInputConfig> inputConfigs, BatchDocumentOutputConfig outputConfig)Translates a large volume of document in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location.
This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.
Sample 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 sourceLanguageCode = "sourceLanguageCode1645917472";
List<String> targetLanguageCodes = new ArrayList<>();
List<BatchDocumentInputConfig> inputConfigs = new ArrayList<>();
BatchDocumentOutputConfig outputConfig = BatchDocumentOutputConfig.newBuilder().build();
BatchTranslateDocumentResponse response =
translationServiceClient
.batchTranslateDocumentAsync(
parent, sourceLanguageCode, targetLanguageCodes, inputConfigs, outputConfig)
.get();
}
| Parameters | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.cloud.translate.v3.LocationNameRequired. Location to make a regional call. Format: The Only AutoML Translation models or glossaries within the same region (have the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) error is returned. |
sourceLanguageCode |
StringRequired. The ISO-639 language code of the input document if known, for example, "en-US" or "sr-Latn". Supported language codes are listed in Language Support. |
targetLanguageCodes |
List<String>Required. The ISO-639 language code to use for translation of the input document. Specify up to 10 language codes here. Supported language codes are listed in Language Support. |
inputConfigs |
List<BatchDocumentInputConfig>Required. Input configurations. The total number of files matched should be <= 100. The total content size to translate should be <= 100M Unicode codepoints. The files must use UTF-8 encoding. |
outputConfig |
BatchDocumentOutputConfigRequired. Output configuration. If 2 input configs match to the same file (that is, same input path), we don't generate output for duplicate inputs. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<BatchTranslateDocumentResponse,BatchTranslateDocumentMetadata> |
|
batchTranslateDocumentAsync(BatchTranslateDocumentRequest request)
public final OperationFuture<BatchTranslateDocumentResponse,BatchTranslateDocumentMetadata> batchTranslateDocumentAsync(BatchTranslateDocumentRequest request)Translates a large volume of document in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location.
This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.
Sample 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()) {
BatchTranslateDocumentRequest request =
BatchTranslateDocumentRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setSourceLanguageCode("sourceLanguageCode1645917472")
.addAllTargetLanguageCodes(new ArrayList<String>())
.addAllInputConfigs(new ArrayList<BatchDocumentInputConfig>())
.setOutputConfig(BatchDocumentOutputConfig.newBuilder().build())
.putAllModels(new HashMap<String, String>())
.putAllGlossaries(new HashMap<String, TranslateTextGlossaryConfig>())
.putAllFormatConversions(new HashMap<String, String>())
.setCustomizedAttribution("customizedAttribution557650238")
.setEnableShadowRemovalNativePdf(true)
.setEnableRotationCorrection(true)
.build();
BatchTranslateDocumentResponse response =
translationServiceClient.batchTranslateDocumentAsync(request).get();
}
| Parameter | |
|---|---|
| Name | Description |
request |
BatchTranslateDocumentRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<BatchTranslateDocumentResponse,BatchTranslateDocumentMetadata> |
|
batchTranslateDocumentAsync(String parent, String sourceLanguageCode, List<String> targetLanguageCodes, List<BatchDocumentInputConfig> inputConfigs, BatchDocumentOutputConfig outputConfig)
public final OperationFuture<BatchTranslateDocumentResponse,BatchTranslateDocumentMetadata> batchTranslateDocumentAsync(String parent, String sourceLanguageCode, List<String> targetLanguageCodes, List<BatchDocumentInputConfig> inputConfigs, BatchDocumentOutputConfig outputConfig)Translates a large volume of document in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location.
This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.
Sample 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 sourceLanguageCode = "sourceLanguageCode1645917472";
List<String> targetLanguageCodes = new ArrayList<>();
List<BatchDocumentInputConfig> inputConfigs = new ArrayList<>();
BatchDocumentOutputConfig outputConfig = BatchDocumentOutputConfig.newBuilder().build();
BatchTranslateDocumentResponse response =
translationServiceClient
.batchTranslateDocumentAsync(
parent, sourceLanguageCode, targetLanguageCodes, inputConfigs, outputConfig)
.get();
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. Location to make a regional call. Format: The Only AutoML Translation models or glossaries within the same region (have the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) error is returned. |
sourceLanguageCode |
StringRequired. The ISO-639 language code of the input document if known, for example, "en-US" or "sr-Latn". Supported language codes are listed in Language Support. |
targetLanguageCodes |
List<String>Required. The ISO-639 language code to use for translation of the input document. Specify up to 10 language codes here. Supported language codes are listed in Language Support. |
inputConfigs |
List<BatchDocumentInputConfig>Required. Input configurations. The total number of files matched should be <= 100. The total content size to translate should be <= 100M Unicode codepoints. The files must use UTF-8 encoding. |
outputConfig |
BatchDocumentOutputConfigRequired. Output configuration. If 2 input configs match to the same file (that is, same input path), we don't generate output for duplicate inputs. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<BatchTranslateDocumentResponse,BatchTranslateDocumentMetadata> |
|
batchTranslateDocumentCallable()
public final UnaryCallable<BatchTranslateDocumentRequest,Operation> batchTranslateDocumentCallable()Translates a large volume of document in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location.
This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.
Sample 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()) {
BatchTranslateDocumentRequest request =
BatchTranslateDocumentRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setSourceLanguageCode("sourceLanguageCode1645917472")
.addAllTargetLanguageCodes(new ArrayList<String>())
.addAllInputConfigs(new ArrayList<BatchDocumentInputConfig>())
.setOutputConfig(BatchDocumentOutputConfig.newBuilder().build())
.putAllModels(new HashMap<String, String>())
.putAllGlossaries(new HashMap<String, TranslateTextGlossaryConfig>())
.putAllFormatConversions(new HashMap<String, String>())
.setCustomizedAttribution("customizedAttribution557650238")
.setEnableShadowRemovalNativePdf(true)
.setEnableRotationCorrection(true)
.build();
ApiFuture<Operation> future =
translationServiceClient.batchTranslateDocumentCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<BatchTranslateDocumentRequest,Operation> |
|
batchTranslateDocumentOperationCallable()
public final OperationCallable<BatchTranslateDocumentRequest,BatchTranslateDocumentResponse,BatchTranslateDocumentMetadata> batchTranslateDocumentOperationCallable()Translates a large volume of document in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location.
This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.
Sample 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()) {
BatchTranslateDocumentRequest request =
BatchTranslateDocumentRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setSourceLanguageCode("sourceLanguageCode1645917472")
.addAllTargetLanguageCodes(new ArrayList<String>())
.addAllInputConfigs(new ArrayList<BatchDocumentInputConfig>())
.setOutputConfig(BatchDocumentOutputConfig.newBuilder().build())
.putAllModels(new HashMap<String, String>())
.putAllGlossaries(new HashMap<String, TranslateTextGlossaryConfig>())
.putAllFormatConversions(new HashMap<String, String>())
.setCustomizedAttribution("customizedAttribution557650238")
.setEnableShadowRemovalNativePdf(true)
.setEnableRotationCorrection(true)
.build();
OperationFuture<BatchTranslateDocumentResponse, BatchTranslateDocumentMetadata> future =
translationServiceClient.batchTranslateDocumentOperationCallable().futureCall(request);
// Do something.
BatchTranslateDocumentResponse response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<BatchTranslateDocumentRequest,BatchTranslateDocumentResponse,BatchTranslateDocumentMetadata> |
|
batchTranslateTextAsync(BatchTranslateTextRequest request)
public final OperationFuture<BatchTranslateResponse,BatchTranslateMetadata> batchTranslateTextAsync(BatchTranslateTextRequest request)Translates a large volume of text in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location.
This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.
Sample 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()) {
BatchTranslateTextRequest request =
BatchTranslateTextRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setSourceLanguageCode("sourceLanguageCode1645917472")
.addAllTargetLanguageCodes(new ArrayList<String>())
.putAllModels(new HashMap<String, String>())
.addAllInputConfigs(new ArrayList<InputConfig>())
.setOutputConfig(OutputConfig.newBuilder().build())
.putAllGlossaries(new HashMap<String, TranslateTextGlossaryConfig>())
.putAllLabels(new HashMap<String, String>())
.build();
BatchTranslateResponse response =
translationServiceClient.batchTranslateTextAsync(request).get();
}
| Parameter | |
|---|---|
| Name | Description |
request |
BatchTranslateTextRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<BatchTranslateResponse,BatchTranslateMetadata> |
|
batchTranslateTextCallable()
public final UnaryCallable<BatchTranslateTextRequest,Operation> batchTranslateTextCallable()Translates a large volume of text in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location.
This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.
Sample 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()) {
BatchTranslateTextRequest request =
BatchTranslateTextRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setSourceLanguageCode("sourceLanguageCode1645917472")
.addAllTargetLanguageCodes(new ArrayList<String>())
.putAllModels(new HashMap<String, String>())
.addAllInputConfigs(new ArrayList<InputConfig>())
.setOutputConfig(OutputConfig.newBuilder().build())
.putAllGlossaries(new HashMap<String, TranslateTextGlossaryConfig>())
.putAllLabels(new HashMap<String, String>())
.build();
ApiFuture<Operation> future =
translationServiceClient.batchTranslateTextCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<BatchTranslateTextRequest,Operation> |
|
batchTranslateTextOperationCallable()
public final OperationCallable<BatchTranslateTextRequest,BatchTranslateResponse,BatchTranslateMetadata> batchTranslateTextOperationCallable()Translates a large volume of text in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location.
This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.
Sample 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()) {
BatchTranslateTextRequest request =
BatchTranslateTextRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setSourceLanguageCode("sourceLanguageCode1645917472")
.addAllTargetLanguageCodes(new ArrayList<String>())
.putAllModels(new HashMap<String, String>())
.addAllInputConfigs(new ArrayList<InputConfig>())
.setOutputConfig(OutputConfig.newBuilder().build())
.putAllGlossaries(new HashMap<String, TranslateTextGlossaryConfig>())
.putAllLabels(new HashMap<String, String>())
.build();
OperationFuture<BatchTranslateResponse, BatchTranslateMetadata> future =
translationServiceClient.batchTranslateTextOperationCallable().futureCall(request);
// Do something.
BatchTranslateResponse response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<BatchTranslateTextRequest,BatchTranslateResponse,BatchTranslateMetadata> |
|
close()
public final void close()createAdaptiveMtDataset(@Nullable LocationName parent, AdaptiveMtDataset adaptiveMtDataset)
public final AdaptiveMtDataset createAdaptiveMtDataset(@Nullable LocationName parent, AdaptiveMtDataset adaptiveMtDataset)Creates an Adaptive MT dataset.
Sample 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]");
AdaptiveMtDataset adaptiveMtDataset = AdaptiveMtDataset.newBuilder().build();
AdaptiveMtDataset response =
translationServiceClient.createAdaptiveMtDataset(parent, adaptiveMtDataset);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.cloud.translate.v3.LocationNameRequired. Name of the parent project. In form of
|
adaptiveMtDataset |
AdaptiveMtDatasetRequired. The AdaptiveMtDataset to be created. |
| Returns | |
|---|---|
| Type | Description |
AdaptiveMtDataset |
|
createAdaptiveMtDataset(CreateAdaptiveMtDatasetRequest request)
public final AdaptiveMtDataset createAdaptiveMtDataset(CreateAdaptiveMtDatasetRequest request)Creates an Adaptive MT dataset.
Sample 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()) {
CreateAdaptiveMtDatasetRequest request =
CreateAdaptiveMtDatasetRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setAdaptiveMtDataset(AdaptiveMtDataset.newBuilder().build())
.build();
AdaptiveMtDataset response = translationServiceClient.createAdaptiveMtDataset(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
CreateAdaptiveMtDatasetRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
AdaptiveMtDataset |
|
createAdaptiveMtDataset(String parent, AdaptiveMtDataset adaptiveMtDataset)
public final AdaptiveMtDataset createAdaptiveMtDataset(String parent, AdaptiveMtDataset adaptiveMtDataset)Creates an Adaptive MT dataset.
Sample 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();
AdaptiveMtDataset adaptiveMtDataset = AdaptiveMtDataset.newBuilder().build();
AdaptiveMtDataset response =
translationServiceClient.createAdaptiveMtDataset(parent, adaptiveMtDataset);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. Name of the parent project. In form of
|
adaptiveMtDataset |
AdaptiveMtDatasetRequired. The AdaptiveMtDataset to be created. |
| Returns | |
|---|---|
| Type | Description |
AdaptiveMtDataset |
|
createAdaptiveMtDatasetCallable()
public final UnaryCallable<CreateAdaptiveMtDatasetRequest,AdaptiveMtDataset> createAdaptiveMtDatasetCallable()Creates an Adaptive MT dataset.
Sample 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()) {
CreateAdaptiveMtDatasetRequest request =
CreateAdaptiveMtDatasetRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setAdaptiveMtDataset(AdaptiveMtDataset.newBuilder().build())
.build();
ApiFuture<AdaptiveMtDataset> future =
translationServiceClient.createAdaptiveMtDatasetCallable().futureCall(request);
// Do something.
AdaptiveMtDataset response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<CreateAdaptiveMtDatasetRequest,AdaptiveMtDataset> |
|
createDatasetAsync(@Nullable LocationName parent, Dataset dataset)
public final OperationFuture<Dataset,CreateDatasetMetadata> createDatasetAsync(@Nullable LocationName parent, Dataset dataset)Creates a Dataset.
Sample 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]");
Dataset dataset = Dataset.newBuilder().build();
Dataset response = translationServiceClient.createDatasetAsync(parent, dataset).get();
}
| Parameters | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.cloud.translate.v3.LocationNameRequired. The project name. |
dataset |
DatasetRequired. The Dataset to create. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Dataset,CreateDatasetMetadata> |
|
createDatasetAsync(CreateDatasetRequest request)
public final OperationFuture<Dataset,CreateDatasetMetadata> createDatasetAsync(CreateDatasetRequest request)Creates a Dataset.
Sample 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()) {
CreateDatasetRequest request =
CreateDatasetRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setDataset(Dataset.newBuilder().build())
.build();
Dataset response = translationServiceClient.createDatasetAsync(request).get();
}
| Parameter | |
|---|---|
| Name | Description |
request |
CreateDatasetRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Dataset,CreateDatasetMetadata> |
|
createDatasetAsync(String parent, Dataset dataset)
public final OperationFuture<Dataset,CreateDatasetMetadata> createDatasetAsync(String parent, Dataset dataset)Creates a Dataset.
Sample 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();
Dataset dataset = Dataset.newBuilder().build();
Dataset response = translationServiceClient.createDatasetAsync(parent, dataset).get();
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. The project name. |
dataset |
DatasetRequired. The Dataset to create. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Dataset,CreateDatasetMetadata> |
|
createDatasetCallable()
public final UnaryCallable<CreateDatasetRequest,Operation> createDatasetCallable()Creates a Dataset.
Sample 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()) {
CreateDatasetRequest request =
CreateDatasetRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setDataset(Dataset.newBuilder().build())
.build();
ApiFuture<Operation> future =
translationServiceClient.createDatasetCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<CreateDatasetRequest,Operation> |
|
createDatasetOperationCallable()
public final OperationCallable<CreateDatasetRequest,Dataset,CreateDatasetMetadata> createDatasetOperationCallable()Creates a Dataset.
Sample 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()) {
CreateDatasetRequest request =
CreateDatasetRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setDataset(Dataset.newBuilder().build())
.build();
OperationFuture<Dataset, CreateDatasetMetadata> future =
translationServiceClient.createDatasetOperationCallable().futureCall(request);
// Do something.
Dataset response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<CreateDatasetRequest,Dataset,CreateDatasetMetadata> |
|
createGlossaryAsync(@Nullable LocationName parent, Glossary glossary)
public final OperationFuture<Glossary,CreateGlossaryMetadata> createGlossaryAsync(@Nullable LocationName parent, Glossary glossary)Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project doesn't exist.
Sample 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]");
Glossary glossary = Glossary.newBuilder().build();
Glossary response = translationServiceClient.createGlossaryAsync(parent, glossary).get();
}
| Parameters | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.cloud.translate.v3.LocationNameRequired. The project name. |
glossary |
GlossaryRequired. The glossary to create. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Glossary,CreateGlossaryMetadata> |
|
createGlossaryAsync(CreateGlossaryRequest request)
public final OperationFuture<Glossary,CreateGlossaryMetadata> createGlossaryAsync(CreateGlossaryRequest request)Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project doesn't exist.
Sample 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()) {
CreateGlossaryRequest request =
CreateGlossaryRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setGlossary(Glossary.newBuilder().build())
.build();
Glossary response = translationServiceClient.createGlossaryAsync(request).get();
}
| Parameter | |
|---|---|
| Name | Description |
request |
CreateGlossaryRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Glossary,CreateGlossaryMetadata> |
|
createGlossaryAsync(String parent, Glossary glossary)
public final OperationFuture<Glossary,CreateGlossaryMetadata> createGlossaryAsync(String parent, Glossary glossary)Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project doesn't exist.
Sample 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();
Glossary glossary = Glossary.newBuilder().build();
Glossary response = translationServiceClient.createGlossaryAsync(parent, glossary).get();
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. The project name. |
glossary |
GlossaryRequired. The glossary to create. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Glossary,CreateGlossaryMetadata> |
|
createGlossaryCallable()
public final UnaryCallable<CreateGlossaryRequest,Operation> createGlossaryCallable()Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project doesn't exist.
Sample 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()) {
CreateGlossaryRequest request =
CreateGlossaryRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setGlossary(Glossary.newBuilder().build())
.build();
ApiFuture<Operation> future =
translationServiceClient.createGlossaryCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<CreateGlossaryRequest,Operation> |
|
createGlossaryEntry(@Nullable GlossaryName parent, GlossaryEntry glossaryEntry)
public final GlossaryEntry createGlossaryEntry(@Nullable GlossaryName parent, GlossaryEntry glossaryEntry)Creates a glossary entry.
Sample 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()) {
GlossaryName parent = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
GlossaryEntry glossaryEntry = GlossaryEntry.newBuilder().build();
GlossaryEntry response = translationServiceClient.createGlossaryEntry(parent, glossaryEntry);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.cloud.translate.v3.GlossaryNameRequired. The resource name of the glossary to create the entry under. |
glossaryEntry |
GlossaryEntryRequired. The glossary entry to create |
| Returns | |
|---|---|
| Type | Description |
GlossaryEntry |
|
createGlossaryEntry(CreateGlossaryEntryRequest request)
public final GlossaryEntry createGlossaryEntry(CreateGlossaryEntryRequest request)Creates a glossary entry.
Sample 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()) {
CreateGlossaryEntryRequest request =
CreateGlossaryEntryRequest.newBuilder()
.setParent(GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]").toString())
.setGlossaryEntry(GlossaryEntry.newBuilder().build())
.build();
GlossaryEntry response = translationServiceClient.createGlossaryEntry(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
CreateGlossaryEntryRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
GlossaryEntry |
|
createGlossaryEntry(String parent, GlossaryEntry glossaryEntry)
public final GlossaryEntry createGlossaryEntry(String parent, GlossaryEntry glossaryEntry)Creates a glossary entry.
Sample 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 = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]").toString();
GlossaryEntry glossaryEntry = GlossaryEntry.newBuilder().build();
GlossaryEntry response = translationServiceClient.createGlossaryEntry(parent, glossaryEntry);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. The resource name of the glossary to create the entry under. |
glossaryEntry |
GlossaryEntryRequired. The glossary entry to create |
| Returns | |
|---|---|
| Type | Description |
GlossaryEntry |
|
createGlossaryEntryCallable()
public final UnaryCallable<CreateGlossaryEntryRequest,GlossaryEntry> createGlossaryEntryCallable()Creates a glossary entry.
Sample 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()) {
CreateGlossaryEntryRequest request =
CreateGlossaryEntryRequest.newBuilder()
.setParent(GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]").toString())
.setGlossaryEntry(GlossaryEntry.newBuilder().build())
.build();
ApiFuture<GlossaryEntry> future =
translationServiceClient.createGlossaryEntryCallable().futureCall(request);
// Do something.
GlossaryEntry response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<CreateGlossaryEntryRequest,GlossaryEntry> |
|
createGlossaryOperationCallable()
public final OperationCallable<CreateGlossaryRequest,Glossary,CreateGlossaryMetadata> createGlossaryOperationCallable()Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project doesn't exist.
Sample 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()) {
CreateGlossaryRequest request =
CreateGlossaryRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setGlossary(Glossary.newBuilder().build())
.build();
OperationFuture<Glossary, CreateGlossaryMetadata> future =
translationServiceClient.createGlossaryOperationCallable().futureCall(request);
// Do something.
Glossary response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<CreateGlossaryRequest,Glossary,CreateGlossaryMetadata> |
|
createModelAsync(@Nullable LocationName parent, Model model)
public final OperationFuture<Model,CreateModelMetadata> createModelAsync(@Nullable LocationName parent, Model model)Creates a Model.
Sample 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]");
Model model = Model.newBuilder().build();
Model response = translationServiceClient.createModelAsync(parent, model).get();
}
| Parameters | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.cloud.translate.v3.LocationNameRequired. The project name, in form of |
model |
ModelRequired. The Model to create. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Model,CreateModelMetadata> |
|
createModelAsync(CreateModelRequest request)
public final OperationFuture<Model,CreateModelMetadata> createModelAsync(CreateModelRequest request)Creates a Model.
Sample 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()) {
CreateModelRequest request =
CreateModelRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setModel(Model.newBuilder().build())
.build();
Model response = translationServiceClient.createModelAsync(request).get();
}
| Parameter | |
|---|---|
| Name | Description |
request |
CreateModelRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Model,CreateModelMetadata> |
|
createModelAsync(String parent, Model model)
public final OperationFuture<Model,CreateModelMetadata> createModelAsync(String parent, Model model)Creates a Model.
Sample 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();
Model model = Model.newBuilder().build();
Model response = translationServiceClient.createModelAsync(parent, model).get();
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. The project name, in form of |
model |
ModelRequired. The Model to create. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Model,CreateModelMetadata> |
|
createModelCallable()
public final UnaryCallable<CreateModelRequest,Operation> createModelCallable()Creates a Model.
Sample 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()) {
CreateModelRequest request =
CreateModelRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setModel(Model.newBuilder().build())
.build();
ApiFuture<Operation> future =
translationServiceClient.createModelCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<CreateModelRequest,Operation> |
|
createModelOperationCallable()
public final OperationCallable<CreateModelRequest,Model,CreateModelMetadata> createModelOperationCallable()Creates a Model.
Sample 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()) {
CreateModelRequest request =
CreateModelRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setModel(Model.newBuilder().build())
.build();
OperationFuture<Model, CreateModelMetadata> future =
translationServiceClient.createModelOperationCallable().futureCall(request);
// Do something.
Model response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<CreateModelRequest,Model,CreateModelMetadata> |
|
deleteAdaptiveMtDataset(@Nullable AdaptiveMtDatasetName name)
public final void deleteAdaptiveMtDataset(@Nullable AdaptiveMtDatasetName name)Deletes an Adaptive MT dataset, including all its entries and associated metadata.
Sample 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()) {
AdaptiveMtDatasetName name = AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]");
translationServiceClient.deleteAdaptiveMtDataset(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
@org.jspecify.annotations.Nullable com.google.cloud.translate.v3.AdaptiveMtDatasetNameRequired. Name of the dataset. In the form of
|
deleteAdaptiveMtDataset(DeleteAdaptiveMtDatasetRequest request)
public final void deleteAdaptiveMtDataset(DeleteAdaptiveMtDatasetRequest request)Deletes an Adaptive MT dataset, including all its entries and associated metadata.
Sample 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()) {
DeleteAdaptiveMtDatasetRequest request =
DeleteAdaptiveMtDatasetRequest.newBuilder()
.setName(AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
.build();
translationServiceClient.deleteAdaptiveMtDataset(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
DeleteAdaptiveMtDatasetRequestThe request object containing all of the parameters for the API call. |
deleteAdaptiveMtDataset(String name)
public final void deleteAdaptiveMtDataset(String name)Deletes an Adaptive MT dataset, including all its entries and associated metadata.
Sample 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 name = AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString();
translationServiceClient.deleteAdaptiveMtDataset(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
StringRequired. Name of the dataset. In the form of
|
deleteAdaptiveMtDatasetCallable()
public final UnaryCallable<DeleteAdaptiveMtDatasetRequest,Empty> deleteAdaptiveMtDatasetCallable()Deletes an Adaptive MT dataset, including all its entries and associated metadata.
Sample 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()) {
DeleteAdaptiveMtDatasetRequest request =
DeleteAdaptiveMtDatasetRequest.newBuilder()
.setName(AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
.build();
ApiFuture<Empty> future =
translationServiceClient.deleteAdaptiveMtDatasetCallable().futureCall(request);
// Do something.
future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<DeleteAdaptiveMtDatasetRequest,Empty> |
|
deleteAdaptiveMtFile(@Nullable AdaptiveMtFileName name)
public final void deleteAdaptiveMtFile(@Nullable AdaptiveMtFileName name)Deletes an AdaptiveMtFile along with its sentences.
Sample 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()) {
AdaptiveMtFileName name =
AdaptiveMtFileName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[FILE]");
translationServiceClient.deleteAdaptiveMtFile(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
@org.jspecify.annotations.Nullable com.google.cloud.translate.v3.AdaptiveMtFileNameRequired. The resource name of the file to delete, in form of
|
deleteAdaptiveMtFile(DeleteAdaptiveMtFileRequest request)
public final void deleteAdaptiveMtFile(DeleteAdaptiveMtFileRequest request)Deletes an AdaptiveMtFile along with its sentences.
Sample 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()) {
DeleteAdaptiveMtFileRequest request =
DeleteAdaptiveMtFileRequest.newBuilder()
.setName(
AdaptiveMtFileName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[FILE]")
.toString())
.build();
translationServiceClient.deleteAdaptiveMtFile(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
DeleteAdaptiveMtFileRequestThe request object containing all of the parameters for the API call. |
deleteAdaptiveMtFile(String name)
public final void deleteAdaptiveMtFile(String name)Deletes an AdaptiveMtFile along with its sentences.
Sample 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 name =
AdaptiveMtFileName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[FILE]").toString();
translationServiceClient.deleteAdaptiveMtFile(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
StringRequired. The resource name of the file to delete, in form of
|
deleteAdaptiveMtFileCallable()
public final UnaryCallable<DeleteAdaptiveMtFileRequest,Empty> deleteAdaptiveMtFileCallable()Deletes an AdaptiveMtFile along with its sentences.
Sample 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()) {
DeleteAdaptiveMtFileRequest request =
DeleteAdaptiveMtFileRequest.newBuilder()
.setName(
AdaptiveMtFileName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[FILE]")
.toString())
.build();
ApiFuture<Empty> future =
translationServiceClient.deleteAdaptiveMtFileCallable().futureCall(request);
// Do something.
future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<DeleteAdaptiveMtFileRequest,Empty> |
|
deleteDatasetAsync(@Nullable DatasetName name)
public final OperationFuture<Empty,DeleteDatasetMetadata> deleteDatasetAsync(@Nullable DatasetName name)Deletes a dataset and all of its contents.
Sample 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()) {
DatasetName name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]");
translationServiceClient.deleteDatasetAsync(name).get();
}
| Parameter | |
|---|---|
| Name | Description |
name |
@org.jspecify.annotations.Nullable com.google.cloud.translate.v3.DatasetNameRequired. The name of the dataset to delete. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Empty,DeleteDatasetMetadata> |
|
deleteDatasetAsync(DeleteDatasetRequest request)
public final OperationFuture<Empty,DeleteDatasetMetadata> deleteDatasetAsync(DeleteDatasetRequest request)Deletes a dataset and all of its contents.
Sample 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()) {
DeleteDatasetRequest request =
DeleteDatasetRequest.newBuilder()
.setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
.build();
translationServiceClient.deleteDatasetAsync(request).get();
}
| Parameter | |
|---|---|
| Name | Description |
request |
DeleteDatasetRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Empty,DeleteDatasetMetadata> |
|
deleteDatasetAsync(String name)
public final OperationFuture<Empty,DeleteDatasetMetadata> deleteDatasetAsync(String name)Deletes a dataset and all of its contents.
Sample 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 name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString();
translationServiceClient.deleteDatasetAsync(name).get();
}
| Parameter | |
|---|---|
| Name | Description |
name |
StringRequired. The name of the dataset to delete. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Empty,DeleteDatasetMetadata> |
|
deleteDatasetCallable()
public final UnaryCallable<DeleteDatasetRequest,Operation> deleteDatasetCallable()Deletes a dataset and all of its contents.
Sample 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()) {
DeleteDatasetRequest request =
DeleteDatasetRequest.newBuilder()
.setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
.build();
ApiFuture<Operation> future =
translationServiceClient.deleteDatasetCallable().futureCall(request);
// Do something.
future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<DeleteDatasetRequest,Operation> |
|
deleteDatasetOperationCallable()
public final OperationCallable<DeleteDatasetRequest,Empty,DeleteDatasetMetadata> deleteDatasetOperationCallable()Deletes a dataset and all of its contents.
Sample 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()) {
DeleteDatasetRequest request =
DeleteDatasetRequest.newBuilder()
.setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
.build();
OperationFuture<Empty, DeleteDatasetMetadata> future =
translationServiceClient.deleteDatasetOperationCallable().futureCall(request);
// Do something.
future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<DeleteDatasetRequest,Empty,DeleteDatasetMetadata> |
|
deleteGlossaryAsync(@Nullable GlossaryName name)
public final OperationFuture<DeleteGlossaryResponse,DeleteGlossaryMetadata> deleteGlossaryAsync(@Nullable GlossaryName name)Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns NOT_FOUND, if the glossary doesn't exist.
Sample 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()) {
GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
DeleteGlossaryResponse response = translationServiceClient.deleteGlossaryAsync(name).get();
}
| Parameter | |
|---|---|
| Name | Description |
name |
@org.jspecify.annotations.Nullable com.google.cloud.translate.v3.GlossaryNameRequired. The name of the glossary to delete. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<DeleteGlossaryResponse,DeleteGlossaryMetadata> |
|
deleteGlossaryAsync(DeleteGlossaryRequest request)
public final OperationFuture<DeleteGlossaryResponse,DeleteGlossaryMetadata> deleteGlossaryAsync(DeleteGlossaryRequest request)Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns NOT_FOUND, if the glossary doesn't exist.
Sample 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()) {
DeleteGlossaryRequest request =
DeleteGlossaryRequest.newBuilder()
.setName(GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]").toString())
.build();
DeleteGlossaryResponse response = translationServiceClient.deleteGlossaryAsync(request).get();
}
| Parameter | |
|---|---|
| Name | Description |
request |
DeleteGlossaryRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<DeleteGlossaryResponse,DeleteGlossaryMetadata> |
|
deleteGlossaryAsync(String name)
public final OperationFuture<DeleteGlossaryResponse,DeleteGlossaryMetadata> deleteGlossaryAsync(String name)Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns NOT_FOUND, if the glossary doesn't exist.
Sample 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 name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]").toString();
DeleteGlossaryResponse response = translationServiceClient.deleteGlossaryAsync(name).get();
}
| Parameter | |
|---|---|
| Name | Description |
name |
StringRequired. The name of the glossary to delete. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<DeleteGlossaryResponse,DeleteGlossaryMetadata> |
|
deleteGlossaryCallable()
public final UnaryCallable<DeleteGlossaryRequest,Operation> deleteGlossaryCallable()Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns NOT_FOUND, if the glossary doesn't exist.
Sample 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()) {
DeleteGlossaryRequest request =
DeleteGlossaryRequest.newBuilder()
.setName(GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]").toString())
.build();
ApiFuture<Operation> future =
translationServiceClient.deleteGlossaryCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<DeleteGlossaryRequest,Operation> |
|
deleteGlossaryEntry(@Nullable GlossaryEntryName name)
public final void deleteGlossaryEntry(@Nullable GlossaryEntryName name)Deletes a single entry from the glossary
Sample 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()) {
GlossaryEntryName name =
GlossaryEntryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]", "[GLOSSARY_ENTRY]");
translationServiceClient.deleteGlossaryEntry(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
@org.jspecify.annotations.Nullable com.google.cloud.translate.v3.GlossaryEntryNameRequired. The resource name of the glossary entry to delete |
deleteGlossaryEntry(DeleteGlossaryEntryRequest request)
public final void deleteGlossaryEntry(DeleteGlossaryEntryRequest request)Deletes a single entry from the glossary
Sample 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()) {
DeleteGlossaryEntryRequest request =
DeleteGlossaryEntryRequest.newBuilder()
.setName(
GlossaryEntryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]", "[GLOSSARY_ENTRY]")
.toString())
.build();
translationServiceClient.deleteGlossaryEntry(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
DeleteGlossaryEntryRequestThe request object containing all of the parameters for the API call. |
deleteGlossaryEntry(String name)
public final void deleteGlossaryEntry(String name)Deletes a single entry from the glossary
Sample 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 name =
GlossaryEntryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]", "[GLOSSARY_ENTRY]")
.toString();
translationServiceClient.deleteGlossaryEntry(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
StringRequired. The resource name of the glossary entry to delete |
deleteGlossaryEntryCallable()
public final UnaryCallable<DeleteGlossaryEntryRequest,Empty> deleteGlossaryEntryCallable()Deletes a single entry from the glossary
Sample 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()) {
DeleteGlossaryEntryRequest request =
DeleteGlossaryEntryRequest.newBuilder()
.setName(
GlossaryEntryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]", "[GLOSSARY_ENTRY]")
.toString())
.build();
ApiFuture<Empty> future =
translationServiceClient.deleteGlossaryEntryCallable().futureCall(request);
// Do something.
future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<DeleteGlossaryEntryRequest,Empty> |
|
deleteGlossaryOperationCallable()
public final OperationCallable<DeleteGlossaryRequest,DeleteGlossaryResponse,DeleteGlossaryMetadata> deleteGlossaryOperationCallable()Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns NOT_FOUND, if the glossary doesn't exist.
Sample 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()) {
DeleteGlossaryRequest request =
DeleteGlossaryRequest.newBuilder()
.setName(GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]").toString())
.build();
OperationFuture<DeleteGlossaryResponse, DeleteGlossaryMetadata> future =
translationServiceClient.deleteGlossaryOperationCallable().futureCall(request);
// Do something.
DeleteGlossaryResponse response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<DeleteGlossaryRequest,DeleteGlossaryResponse,DeleteGlossaryMetadata> |
|
deleteModelAsync(@Nullable ModelName name)
public final OperationFuture<Empty,DeleteModelMetadata> deleteModelAsync(@Nullable ModelName name)Deletes a model.
Sample 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()) {
ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
translationServiceClient.deleteModelAsync(name).get();
}
| Parameter | |
|---|---|
| Name | Description |
name |
@org.jspecify.annotations.Nullable com.google.cloud.translate.v3.ModelNameRequired. The name of the model to delete. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Empty,DeleteModelMetadata> |
|
deleteModelAsync(DeleteModelRequest request)
public final OperationFuture<Empty,DeleteModelMetadata> deleteModelAsync(DeleteModelRequest request)Deletes a model.
Sample 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()) {
DeleteModelRequest request =
DeleteModelRequest.newBuilder()
.setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
.build();
translationServiceClient.deleteModelAsync(request).get();
}
| Parameter | |
|---|---|
| Name | Description |
request |
DeleteModelRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Empty,DeleteModelMetadata> |
|
deleteModelAsync(String name)
public final OperationFuture<Empty,DeleteModelMetadata> deleteModelAsync(String name)Deletes a model.
Sample 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 name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString();
translationServiceClient.deleteModelAsync(name).get();
}
| Parameter | |
|---|---|
| Name | Description |
name |
StringRequired. The name of the model to delete. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Empty,DeleteModelMetadata> |
|
deleteModelCallable()
public final UnaryCallable<DeleteModelRequest,Operation> deleteModelCallable()Deletes a model.
Sample 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()) {
DeleteModelRequest request =
DeleteModelRequest.newBuilder()
.setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
.build();
ApiFuture<Operation> future =
translationServiceClient.deleteModelCallable().futureCall(request);
// Do something.
future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<DeleteModelRequest,Operation> |
|
deleteModelOperationCallable()
public final OperationCallable<DeleteModelRequest,Empty,DeleteModelMetadata> deleteModelOperationCallable()Deletes a model.
Sample 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()) {
DeleteModelRequest request =
DeleteModelRequest.newBuilder()
.setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
.build();
OperationFuture<Empty, DeleteModelMetadata> future =
translationServiceClient.deleteModelOperationCallable().futureCall(request);
// Do something.
future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<DeleteModelRequest,Empty,DeleteModelMetadata> |
|
detectLanguage(@Nullable LocationName parent, String model, String mimeType, String content)
public final DetectLanguageResponse detectLanguage(@Nullable LocationName parent, String model, String mimeType, String content)Detects the language of text within a request.
Sample 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);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.cloud.translate.v3.LocationNameRequired. Project or location to make a call. Must refer to a caller's project. Format: For global calls, use Only models within the same region (has same location-id) can be used. Otherwise an INVALID_ARGUMENT (400) error is returned. |
model |
StringOptional. The language detection model to be used. Format:
Only one language detection model is currently supported:
If not specified, the default model is used. |
mimeType |
StringOptional. The format of the source text, for example, "text/html", "text/plain". If left blank, the MIME type defaults to "text/html". |
content |
StringThe content of the input stored as a string. |
| Returns | |
|---|---|
| Type | Description |
DetectLanguageResponse |
|
detectLanguage(DetectLanguageRequest request)
public final DetectLanguageResponse detectLanguage(DetectLanguageRequest request)Detects the language of text within a request.
Sample 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()) {
DetectLanguageRequest request =
DetectLanguageRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setModel("model104069929")
.setMimeType("mimeType-1392120434")
.putAllLabels(new HashMap<String, String>())
.build();
DetectLanguageResponse response = translationServiceClient.detectLanguage(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
DetectLanguageRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
DetectLanguageResponse |
|
detectLanguage(String parent, String model, String mimeType, String content)
public final DetectLanguageResponse detectLanguage(String parent, String model, String mimeType, String content)Detects the language of text within a request.
Sample 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 model = "model104069929";
String mimeType = "mimeType-1392120434";
String content = "content951530617";
DetectLanguageResponse response =
translationServiceClient.detectLanguage(parent, model, mimeType, content);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. Project or location to make a call. Must refer to a caller's project. Format: For global calls, use Only models within the same region (has same location-id) can be used. Otherwise an INVALID_ARGUMENT (400) error is returned. |
model |
StringOptional. The language detection model to be used. Format:
Only one language detection model is currently supported:
If not specified, the default model is used. |
mimeType |
StringOptional. The format of the source text, for example, "text/html", "text/plain". If left blank, the MIME type defaults to "text/html". |
content |
StringThe content of the input stored as a string. |
| Returns | |
|---|---|
| Type | Description |
DetectLanguageResponse |
|
detectLanguageCallable()
public final UnaryCallable<DetectLanguageRequest,DetectLanguageResponse> detectLanguageCallable()Detects the language of text within a request.
Sample 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()) {
DetectLanguageRequest request =
DetectLanguageRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setModel("model104069929")
.setMimeType("mimeType-1392120434")
.putAllLabels(new HashMap<String, String>())
.build();
ApiFuture<DetectLanguageResponse> future =
translationServiceClient.detectLanguageCallable().futureCall(request);
// Do something.
DetectLanguageResponse response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<DetectLanguageRequest,DetectLanguageResponse> |
|
exportDataAsync(ExportDataRequest request)
public final OperationFuture<Empty,ExportDataMetadata> exportDataAsync(ExportDataRequest request)Exports dataset's data to the provided output location.
Sample 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()) {
ExportDataRequest request =
ExportDataRequest.newBuilder()
.setDataset("dataset1443214456")
.setOutputConfig(DatasetOutputConfig.newBuilder().build())
.build();
translationServiceClient.exportDataAsync(request).get();
}
| Parameter | |
|---|---|
| Name | Description |
request |
ExportDataRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Empty,ExportDataMetadata> |
|
exportDataAsync(String dataset, DatasetOutputConfig outputConfig)
public final OperationFuture<Empty,ExportDataMetadata> exportDataAsync(String dataset, DatasetOutputConfig outputConfig)Exports dataset's data to the provided output location.
Sample 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 dataset = "dataset1443214456";
DatasetOutputConfig outputConfig = DatasetOutputConfig.newBuilder().build();
translationServiceClient.exportDataAsync(dataset, outputConfig).get();
}
| Parameters | |
|---|---|
| Name | Description |
dataset |
StringRequired. Name of the dataset. In form of
|
outputConfig |
DatasetOutputConfigRequired. The config for the output content. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Empty,ExportDataMetadata> |
|
exportDataCallable()
public final UnaryCallable<ExportDataRequest,Operation> exportDataCallable()Exports dataset's data to the provided output location.
Sample 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()) {
ExportDataRequest request =
ExportDataRequest.newBuilder()
.setDataset("dataset1443214456")
.setOutputConfig(DatasetOutputConfig.newBuilder().build())
.build();
ApiFuture<Operation> future =
translationServiceClient.exportDataCallable().futureCall(request);
// Do something.
future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ExportDataRequest,Operation> |
|
exportDataOperationCallable()
public final OperationCallable<ExportDataRequest,Empty,ExportDataMetadata> exportDataOperationCallable()Exports dataset's data to the provided output location.
Sample 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()) {
ExportDataRequest request =
ExportDataRequest.newBuilder()
.setDataset("dataset1443214456")
.setOutputConfig(DatasetOutputConfig.newBuilder().build())
.build();
OperationFuture<Empty, ExportDataMetadata> future =
translationServiceClient.exportDataOperationCallable().futureCall(request);
// Do something.
future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<ExportDataRequest,Empty,ExportDataMetadata> |
|
getAdaptiveMtDataset(@Nullable AdaptiveMtDatasetName name)
public final AdaptiveMtDataset getAdaptiveMtDataset(@Nullable AdaptiveMtDatasetName name)Gets the Adaptive MT dataset.
Sample 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()) {
AdaptiveMtDatasetName name = AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]");
AdaptiveMtDataset response = translationServiceClient.getAdaptiveMtDataset(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
@org.jspecify.annotations.Nullable com.google.cloud.translate.v3.AdaptiveMtDatasetNameRequired. Name of the dataset. In the form of
|
| Returns | |
|---|---|
| Type | Description |
AdaptiveMtDataset |
|
getAdaptiveMtDataset(GetAdaptiveMtDatasetRequest request)
public final AdaptiveMtDataset getAdaptiveMtDataset(GetAdaptiveMtDatasetRequest request)Gets the Adaptive MT dataset.
Sample 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()) {
GetAdaptiveMtDatasetRequest request =
GetAdaptiveMtDatasetRequest.newBuilder()
.setName(AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
.build();
AdaptiveMtDataset response = translationServiceClient.getAdaptiveMtDataset(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
GetAdaptiveMtDatasetRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
AdaptiveMtDataset |
|
getAdaptiveMtDataset(String name)
public final AdaptiveMtDataset getAdaptiveMtDataset(String name)Gets the Adaptive MT dataset.
Sample 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 name = AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString();
AdaptiveMtDataset response = translationServiceClient.getAdaptiveMtDataset(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
StringRequired. Name of the dataset. In the form of
|
| Returns | |
|---|---|
| Type | Description |
AdaptiveMtDataset |
|
getAdaptiveMtDatasetCallable()
public final UnaryCallable<GetAdaptiveMtDatasetRequest,AdaptiveMtDataset> getAdaptiveMtDatasetCallable()Gets the Adaptive MT dataset.
Sample 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()) {
GetAdaptiveMtDatasetRequest request =
GetAdaptiveMtDatasetRequest.newBuilder()
.setName(AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
.build();
ApiFuture<AdaptiveMtDataset> future =
translationServiceClient.getAdaptiveMtDatasetCallable().futureCall(request);
// Do something.
AdaptiveMtDataset response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<GetAdaptiveMtDatasetRequest,AdaptiveMtDataset> |
|
getAdaptiveMtFile(@Nullable AdaptiveMtFileName name)
public final AdaptiveMtFile getAdaptiveMtFile(@Nullable AdaptiveMtFileName name)Gets and AdaptiveMtFile
Sample 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()) {
AdaptiveMtFileName name =
AdaptiveMtFileName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[FILE]");
AdaptiveMtFile response = translationServiceClient.getAdaptiveMtFile(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
@org.jspecify.annotations.Nullable com.google.cloud.translate.v3.AdaptiveMtFileNameRequired. The resource name of the file, in form of
|
| Returns | |
|---|---|
| Type | Description |
AdaptiveMtFile |
|
getAdaptiveMtFile(GetAdaptiveMtFileRequest request)
public final AdaptiveMtFile getAdaptiveMtFile(GetAdaptiveMtFileRequest request)Gets and AdaptiveMtFile
Sample 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()) {
GetAdaptiveMtFileRequest request =
GetAdaptiveMtFileRequest.newBuilder()
.setName(
AdaptiveMtFileName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[FILE]")
.toString())
.build();
AdaptiveMtFile response = translationServiceClient.getAdaptiveMtFile(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
GetAdaptiveMtFileRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
AdaptiveMtFile |
|
getAdaptiveMtFile(String name)
public final AdaptiveMtFile getAdaptiveMtFile(String name)Gets and AdaptiveMtFile
Sample 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 name =
AdaptiveMtFileName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[FILE]").toString();
AdaptiveMtFile response = translationServiceClient.getAdaptiveMtFile(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
StringRequired. The resource name of the file, in form of
|
| Returns | |
|---|---|
| Type | Description |
AdaptiveMtFile |
|
getAdaptiveMtFileCallable()
public final UnaryCallable<GetAdaptiveMtFileRequest,AdaptiveMtFile> getAdaptiveMtFileCallable()Gets and AdaptiveMtFile
Sample 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()) {
GetAdaptiveMtFileRequest request =
GetAdaptiveMtFileRequest.newBuilder()
.setName(
AdaptiveMtFileName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[FILE]")
.toString())
.build();
ApiFuture<AdaptiveMtFile> future =
translationServiceClient.getAdaptiveMtFileCallable().futureCall(request);
// Do something.
AdaptiveMtFile response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<GetAdaptiveMtFileRequest,AdaptiveMtFile> |
|
getDataset(@Nullable DatasetName name)
public final Dataset getDataset(@Nullable DatasetName name)Gets a Dataset.
Sample 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()) {
DatasetName name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]");
Dataset response = translationServiceClient.getDataset(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
@org.jspecify.annotations.Nullable com.google.cloud.translate.v3.DatasetNameRequired. The resource name of the dataset to retrieve. |
| Returns | |
|---|---|
| Type | Description |
Dataset |
|
getDataset(GetDatasetRequest request)
public final Dataset getDataset(GetDatasetRequest request)Gets a Dataset.
Sample 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()) {
GetDatasetRequest request =
GetDatasetRequest.newBuilder()
.setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
.build();
Dataset response = translationServiceClient.getDataset(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
GetDatasetRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
Dataset |
|
getDataset(String name)
public final Dataset getDataset(String name)Gets a Dataset.
Sample 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 name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString();
Dataset response = translationServiceClient.getDataset(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
StringRequired. The resource name of the dataset to retrieve. |
| Returns | |
|---|---|
| Type | Description |
Dataset |
|
getDatasetCallable()
public final UnaryCallable<GetDatasetRequest,Dataset> getDatasetCallable()Gets a Dataset.
Sample 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()) {
GetDatasetRequest request =
GetDatasetRequest.newBuilder()
.setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
.build();
ApiFuture<Dataset> future = translationServiceClient.getDatasetCallable().futureCall(request);
// Do something.
Dataset response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<GetDatasetRequest,Dataset> |
|
getGlossary(@Nullable GlossaryName name)
public final Glossary getGlossary(@Nullable GlossaryName name)Gets a glossary. Returns NOT_FOUND, if the glossary doesn't exist.
Sample 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()) {
GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
Glossary response = translationServiceClient.getGlossary(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
@org.jspecify.annotations.Nullable com.google.cloud.translate.v3.GlossaryNameRequired. The name of the glossary to retrieve. |
| Returns | |
|---|---|
| Type | Description |
Glossary |
|
getGlossary(GetGlossaryRequest request)
public final Glossary getGlossary(GetGlossaryRequest request)Gets a glossary. Returns NOT_FOUND, if the glossary doesn't exist.
Sample 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()) {
GetGlossaryRequest request =
GetGlossaryRequest.newBuilder()
.setName(GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]").toString())
.build();
Glossary response = translationServiceClient.getGlossary(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
GetGlossaryRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
Glossary |
|
getGlossary(String name)
public final Glossary getGlossary(String name)Gets a glossary. Returns NOT_FOUND, if the glossary doesn't exist.
Sample 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 name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]").toString();
Glossary response = translationServiceClient.getGlossary(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
StringRequired. The name of the glossary to retrieve. |
| Returns | |
|---|---|
| Type | Description |
Glossary |
|
getGlossaryCallable()
public final UnaryCallable<GetGlossaryRequest,Glossary> getGlossaryCallable()Gets a glossary. Returns NOT_FOUND, if the glossary doesn't exist.
Sample 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()) {
GetGlossaryRequest request =
GetGlossaryRequest.newBuilder()
.setName(GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]").toString())
.build();
ApiFuture<Glossary> future =
translationServiceClient.getGlossaryCallable().futureCall(request);
// Do something.
Glossary response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<GetGlossaryRequest,Glossary> |
|
getGlossaryEntry(@Nullable GlossaryEntryName name)
public final GlossaryEntry getGlossaryEntry(@Nullable GlossaryEntryName name)Gets a single glossary entry by the given id.
Sample 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()) {
GlossaryEntryName name =
GlossaryEntryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]", "[GLOSSARY_ENTRY]");
GlossaryEntry response = translationServiceClient.getGlossaryEntry(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
@org.jspecify.annotations.Nullable com.google.cloud.translate.v3.GlossaryEntryNameRequired. The resource name of the glossary entry to get |
| Returns | |
|---|---|
| Type | Description |
GlossaryEntry |
|
getGlossaryEntry(GetGlossaryEntryRequest request)
public final GlossaryEntry getGlossaryEntry(GetGlossaryEntryRequest request)Gets a single glossary entry by the given id.
Sample 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()) {
GetGlossaryEntryRequest request =
GetGlossaryEntryRequest.newBuilder()
.setName(
GlossaryEntryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]", "[GLOSSARY_ENTRY]")
.toString())
.build();
GlossaryEntry response = translationServiceClient.getGlossaryEntry(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
GetGlossaryEntryRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
GlossaryEntry |
|
getGlossaryEntry(String name)
public final GlossaryEntry getGlossaryEntry(String name)Gets a single glossary entry by the given id.
Sample 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 name =
GlossaryEntryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]", "[GLOSSARY_ENTRY]")
.toString();
GlossaryEntry response = translationServiceClient.getGlossaryEntry(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
StringRequired. The resource name of the glossary entry to get |
| Returns | |
|---|---|
| Type | Description |
GlossaryEntry |
|
getGlossaryEntryCallable()
public final UnaryCallable<GetGlossaryEntryRequest,GlossaryEntry> getGlossaryEntryCallable()Gets a single glossary entry by the given id.
Sample 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()) {
GetGlossaryEntryRequest request =
GetGlossaryEntryRequest.newBuilder()
.setName(
GlossaryEntryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]", "[GLOSSARY_ENTRY]")
.toString())
.build();
ApiFuture<GlossaryEntry> future =
translationServiceClient.getGlossaryEntryCallable().futureCall(request);
// Do something.
GlossaryEntry response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<GetGlossaryEntryRequest,GlossaryEntry> |
|
getHttpJsonOperationsClient()
public final OperationsClient getHttpJsonOperationsClient()Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
| Returns | |
|---|---|
| Type | Description |
OperationsClient |
|
getModel(@Nullable ModelName name)
public final Model getModel(@Nullable ModelName name)Gets a model.
Sample 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()) {
ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
Model response = translationServiceClient.getModel(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
@org.jspecify.annotations.Nullable com.google.cloud.translate.v3.ModelNameRequired. The resource name of the model to retrieve. |
| Returns | |
|---|---|
| Type | Description |
Model |
|
getModel(GetModelRequest request)
public final Model getModel(GetModelRequest request)Gets a model.
Sample 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()) {
GetModelRequest request =
GetModelRequest.newBuilder()
.setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
.build();
Model response = translationServiceClient.getModel(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
GetModelRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
Model |
|
getModel(String name)
public final Model getModel(String name)Gets a model.
Sample 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 name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString();
Model response = translationServiceClient.getModel(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
StringRequired. The resource name of the model to retrieve. |
| Returns | |
|---|---|
| Type | Description |
Model |
|
getModelCallable()
public final UnaryCallable<GetModelRequest,Model> getModelCallable()Gets a model.
Sample 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()) {
GetModelRequest request =
GetModelRequest.newBuilder()
.setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
.build();
ApiFuture<Model> future = translationServiceClient.getModelCallable().futureCall(request);
// Do something.
Model response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<GetModelRequest,Model> |
|
getOperationsClient()
public final OperationsClient getOperationsClient()Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
| Returns | |
|---|---|
| Type | Description |
OperationsClient |
|
getSettings()
public final @Nullable TranslationServiceSettings getSettings()| Returns | |
|---|---|
| Type | Description |
@org.jspecify.annotations.Nullable com.google.cloud.translate.v3.TranslationServiceSettings |
|
getStub()
public TranslationServiceStub getStub()| Returns | |
|---|---|
| Type | Description |
TranslationServiceStub |
|
getSupportedLanguages(@Nullable LocationName parent, String model, String displayLanguageCode)
public final SupportedLanguages getSupportedLanguages(@Nullable LocationName parent, String model, String displayLanguageCode)Returns a list of supported languages for translation.
Sample 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 displayLanguageCode = "displayLanguageCode-1457478841";
SupportedLanguages response =
translationServiceClient.getSupportedLanguages(parent, model, displayLanguageCode);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.cloud.translate.v3.LocationNameRequired. Project or location to make a call. Must refer to a caller's project. Format: For global calls, use Non-global location is required for AutoML models. Only models within the same region (have same location-id) can be used, otherwise an INVALID_ARGUMENT (400) error is returned. |
model |
StringOptional. Get supported languages of this model. The format depends on model type: - AutoML Translation models:
- General (built-in) models:
Returns languages supported by the specified model. If missing, we get supported languages of Google general NMT model. |
displayLanguageCode |
StringOptional. The language to use to return localized, human readable names of supported languages. If missing, then display names are not returned in a response. |
| Returns | |
|---|---|
| Type | Description |
SupportedLanguages |
|
getSupportedLanguages(GetSupportedLanguagesRequest request)
public final SupportedLanguages getSupportedLanguages(GetSupportedLanguagesRequest request)Returns a list of supported languages for translation.
Sample 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()) {
GetSupportedLanguagesRequest request =
GetSupportedLanguagesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setDisplayLanguageCode("displayLanguageCode-1457478841")
.setModel("model104069929")
.build();
SupportedLanguages response = translationServiceClient.getSupportedLanguages(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
GetSupportedLanguagesRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
SupportedLanguages |
|
getSupportedLanguages(String parent, String model, String displayLanguageCode)
public final SupportedLanguages getSupportedLanguages(String parent, String model, String displayLanguageCode)Returns a list of supported languages for translation.
Sample 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 model = "model104069929";
String displayLanguageCode = "displayLanguageCode-1457478841";
SupportedLanguages response =
translationServiceClient.getSupportedLanguages(parent, model, displayLanguageCode);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. Project or location to make a call. Must refer to a caller's project. Format: For global calls, use Non-global location is required for AutoML models. Only models within the same region (have same location-id) can be used, otherwise an INVALID_ARGUMENT (400) error is returned. |
model |
StringOptional. Get supported languages of this model. The format depends on model type: - AutoML Translation models:
- General (built-in) models:
Returns languages supported by the specified model. If missing, we get supported languages of Google general NMT model. |
displayLanguageCode |
StringOptional. The language to use to return localized, human readable names of supported languages. If missing, then display names are not returned in a response. |
| Returns | |
|---|---|
| Type | Description |
SupportedLanguages |
|
getSupportedLanguagesCallable()
public final UnaryCallable<GetSupportedLanguagesRequest,SupportedLanguages> getSupportedLanguagesCallable()Returns a list of supported languages for translation.
Sample 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()) {
GetSupportedLanguagesRequest request =
GetSupportedLanguagesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setDisplayLanguageCode("displayLanguageCode-1457478841")
.setModel("model104069929")
.build();
ApiFuture<SupportedLanguages> future =
translationServiceClient.getSupportedLanguagesCallable().futureCall(request);
// Do something.
SupportedLanguages response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<GetSupportedLanguagesRequest,SupportedLanguages> |
|
importAdaptiveMtFile(@Nullable AdaptiveMtDatasetName parent)
public final ImportAdaptiveMtFileResponse importAdaptiveMtFile(@Nullable AdaptiveMtDatasetName parent)Imports an AdaptiveMtFile and adds all of its sentences into the AdaptiveMtDataset.
Sample 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()) {
AdaptiveMtDatasetName parent =
AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]");
ImportAdaptiveMtFileResponse response = translationServiceClient.importAdaptiveMtFile(parent);
}
| Parameter | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.cloud.translate.v3.AdaptiveMtDatasetNameRequired. The resource name of the file, in form of
|
| Returns | |
|---|---|
| Type | Description |
ImportAdaptiveMtFileResponse |
|
importAdaptiveMtFile(ImportAdaptiveMtFileRequest request)
public final ImportAdaptiveMtFileResponse importAdaptiveMtFile(ImportAdaptiveMtFileRequest request)Imports an AdaptiveMtFile and adds all of its sentences into the AdaptiveMtDataset.
Sample 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()) {
ImportAdaptiveMtFileRequest request =
ImportAdaptiveMtFileRequest.newBuilder()
.setParent(
AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
.build();
ImportAdaptiveMtFileResponse response =
translationServiceClient.importAdaptiveMtFile(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
ImportAdaptiveMtFileRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
ImportAdaptiveMtFileResponse |
|
importAdaptiveMtFile(String parent)
public final ImportAdaptiveMtFileResponse importAdaptiveMtFile(String parent)Imports an AdaptiveMtFile and adds all of its sentences into the AdaptiveMtDataset.
Sample 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 = AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString();
ImportAdaptiveMtFileResponse response = translationServiceClient.importAdaptiveMtFile(parent);
}
| Parameter | |
|---|---|
| Name | Description |
parent |
StringRequired. The resource name of the file, in form of
|
| Returns | |
|---|---|
| Type | Description |
ImportAdaptiveMtFileResponse |
|
importAdaptiveMtFileCallable()
public final UnaryCallable<ImportAdaptiveMtFileRequest,ImportAdaptiveMtFileResponse> importAdaptiveMtFileCallable()Imports an AdaptiveMtFile and adds all of its sentences into the AdaptiveMtDataset.
Sample 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()) {
ImportAdaptiveMtFileRequest request =
ImportAdaptiveMtFileRequest.newBuilder()
.setParent(
AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
.build();
ApiFuture<ImportAdaptiveMtFileResponse> future =
translationServiceClient.importAdaptiveMtFileCallable().futureCall(request);
// Do something.
ImportAdaptiveMtFileResponse response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ImportAdaptiveMtFileRequest,ImportAdaptiveMtFileResponse> |
|
importDataAsync(ImportDataRequest request)
public final OperationFuture<Empty,ImportDataMetadata> importDataAsync(ImportDataRequest request)Import sentence pairs into translation Dataset.
Sample 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()) {
ImportDataRequest request =
ImportDataRequest.newBuilder()
.setDataset("dataset1443214456")
.setInputConfig(DatasetInputConfig.newBuilder().build())
.build();
translationServiceClient.importDataAsync(request).get();
}
| Parameter | |
|---|---|
| Name | Description |
request |
ImportDataRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Empty,ImportDataMetadata> |
|
importDataAsync(String dataset, DatasetInputConfig inputConfig)
public final OperationFuture<Empty,ImportDataMetadata> importDataAsync(String dataset, DatasetInputConfig inputConfig)Import sentence pairs into translation Dataset.
Sample 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 dataset = "dataset1443214456";
DatasetInputConfig inputConfig = DatasetInputConfig.newBuilder().build();
translationServiceClient.importDataAsync(dataset, inputConfig).get();
}
| Parameters | |
|---|---|
| Name | Description |
dataset |
StringRequired. Name of the dataset. In form of
|
inputConfig |
DatasetInputConfigRequired. The config for the input content. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Empty,ImportDataMetadata> |
|
importDataCallable()
public final UnaryCallable<ImportDataRequest,Operation> importDataCallable()Import sentence pairs into translation Dataset.
Sample 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()) {
ImportDataRequest request =
ImportDataRequest.newBuilder()
.setDataset("dataset1443214456")
.setInputConfig(DatasetInputConfig.newBuilder().build())
.build();
ApiFuture<Operation> future =
translationServiceClient.importDataCallable().futureCall(request);
// Do something.
future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ImportDataRequest,Operation> |
|
importDataOperationCallable()
public final OperationCallable<ImportDataRequest,Empty,ImportDataMetadata> importDataOperationCallable()Import sentence pairs into translation Dataset.
Sample 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()) {
ImportDataRequest request =
ImportDataRequest.newBuilder()
.setDataset("dataset1443214456")
.setInputConfig(DatasetInputConfig.newBuilder().build())
.build();
OperationFuture<Empty, ImportDataMetadata> future =
translationServiceClient.importDataOperationCallable().futureCall(request);
// Do something.
future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<ImportDataRequest,Empty,ImportDataMetadata> |
|
isShutdown()
public boolean isShutdown()| Returns | |
|---|---|
| Type | Description |
boolean |
|
isTerminated()
public boolean isTerminated()| Returns | |
|---|---|
| Type | Description |
boolean |
|
listAdaptiveMtDatasets(@Nullable LocationName parent)
public final TranslationServiceClient.ListAdaptiveMtDatasetsPagedResponse listAdaptiveMtDatasets(@Nullable LocationName parent)Lists all Adaptive MT datasets for which the caller has read permission.
Sample 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]");
for (AdaptiveMtDataset element :
translationServiceClient.listAdaptiveMtDatasets(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.cloud.translate.v3.LocationNameRequired. The resource name of the project from which to list the Adaptive MT
datasets. |
| Returns | |
|---|---|
| Type | Description |
TranslationServiceClient.ListAdaptiveMtDatasetsPagedResponse |
|
listAdaptiveMtDatasets(ListAdaptiveMtDatasetsRequest request)
public final TranslationServiceClient.ListAdaptiveMtDatasetsPagedResponse listAdaptiveMtDatasets(ListAdaptiveMtDatasetsRequest request)Lists all Adaptive MT datasets for which the caller has read permission.
Sample 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()) {
ListAdaptiveMtDatasetsRequest request =
ListAdaptiveMtDatasetsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
for (AdaptiveMtDataset element :
translationServiceClient.listAdaptiveMtDatasets(request).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
request |
ListAdaptiveMtDatasetsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
TranslationServiceClient.ListAdaptiveMtDatasetsPagedResponse |
|
listAdaptiveMtDatasets(String parent)
public final TranslationServiceClient.ListAdaptiveMtDatasetsPagedResponse listAdaptiveMtDatasets(String parent)Lists all Adaptive MT datasets for which the caller has read permission.
Sample 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();
for (AdaptiveMtDataset element :
translationServiceClient.listAdaptiveMtDatasets(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
StringRequired. The resource name of the project from which to list the Adaptive MT
datasets. |
| Returns | |
|---|---|
| Type | Description |
TranslationServiceClient.ListAdaptiveMtDatasetsPagedResponse |
|
listAdaptiveMtDatasetsCallable()
public final UnaryCallable<ListAdaptiveMtDatasetsRequest,ListAdaptiveMtDatasetsResponse> listAdaptiveMtDatasetsCallable()Lists all Adaptive MT datasets for which the caller has read permission.
Sample 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()) {
ListAdaptiveMtDatasetsRequest request =
ListAdaptiveMtDatasetsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
while (true) {
ListAdaptiveMtDatasetsResponse response =
translationServiceClient.listAdaptiveMtDatasetsCallable().call(request);
for (AdaptiveMtDataset element : response.getAdaptiveMtDatasetsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListAdaptiveMtDatasetsRequest,ListAdaptiveMtDatasetsResponse> |
|
listAdaptiveMtDatasetsPagedCallable()
public final UnaryCallable<ListAdaptiveMtDatasetsRequest,TranslationServiceClient.ListAdaptiveMtDatasetsPagedResponse> listAdaptiveMtDatasetsPagedCallable()Lists all Adaptive MT datasets for which the caller has read permission.
Sample 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()) {
ListAdaptiveMtDatasetsRequest request =
ListAdaptiveMtDatasetsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
ApiFuture<AdaptiveMtDataset> future =
translationServiceClient.listAdaptiveMtDatasetsPagedCallable().futureCall(request);
// Do something.
for (AdaptiveMtDataset element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListAdaptiveMtDatasetsRequest,ListAdaptiveMtDatasetsPagedResponse> |
|
listAdaptiveMtFiles(@Nullable AdaptiveMtDatasetName parent)
public final TranslationServiceClient.ListAdaptiveMtFilesPagedResponse listAdaptiveMtFiles(@Nullable AdaptiveMtDatasetName parent)Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset.
Sample 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()) {
AdaptiveMtDatasetName parent =
AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]");
for (AdaptiveMtFile element :
translationServiceClient.listAdaptiveMtFiles(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.cloud.translate.v3.AdaptiveMtDatasetNameRequired. The resource name of the project from which to list the Adaptive MT
files. |
| Returns | |
|---|---|
| Type | Description |
TranslationServiceClient.ListAdaptiveMtFilesPagedResponse |
|
listAdaptiveMtFiles(ListAdaptiveMtFilesRequest request)
public final TranslationServiceClient.ListAdaptiveMtFilesPagedResponse listAdaptiveMtFiles(ListAdaptiveMtFilesRequest request)Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset.
Sample 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()) {
ListAdaptiveMtFilesRequest request =
ListAdaptiveMtFilesRequest.newBuilder()
.setParent(
AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (AdaptiveMtFile element :
translationServiceClient.listAdaptiveMtFiles(request).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
request |
ListAdaptiveMtFilesRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
TranslationServiceClient.ListAdaptiveMtFilesPagedResponse |
|
listAdaptiveMtFiles(String parent)
public final TranslationServiceClient.ListAdaptiveMtFilesPagedResponse listAdaptiveMtFiles(String parent)Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset.
Sample 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 = AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString();
for (AdaptiveMtFile element :
translationServiceClient.listAdaptiveMtFiles(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
StringRequired. The resource name of the project from which to list the Adaptive MT
files. |
| Returns | |
|---|---|
| Type | Description |
TranslationServiceClient.ListAdaptiveMtFilesPagedResponse |
|
listAdaptiveMtFilesCallable()
public final UnaryCallable<ListAdaptiveMtFilesRequest,ListAdaptiveMtFilesResponse> listAdaptiveMtFilesCallable()Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset.
Sample 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()) {
ListAdaptiveMtFilesRequest request =
ListAdaptiveMtFilesRequest.newBuilder()
.setParent(
AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListAdaptiveMtFilesResponse response =
translationServiceClient.listAdaptiveMtFilesCallable().call(request);
for (AdaptiveMtFile element : response.getAdaptiveMtFilesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListAdaptiveMtFilesRequest,ListAdaptiveMtFilesResponse> |
|
listAdaptiveMtFilesPagedCallable()
public final UnaryCallable<ListAdaptiveMtFilesRequest,TranslationServiceClient.ListAdaptiveMtFilesPagedResponse> listAdaptiveMtFilesPagedCallable()Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset.
Sample 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()) {
ListAdaptiveMtFilesRequest request =
ListAdaptiveMtFilesRequest.newBuilder()
.setParent(
AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<AdaptiveMtFile> future =
translationServiceClient.listAdaptiveMtFilesPagedCallable().futureCall(request);
// Do something.
for (AdaptiveMtFile element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListAdaptiveMtFilesRequest,ListAdaptiveMtFilesPagedResponse> |
|
listAdaptiveMtSentences(@Nullable AdaptiveMtFileName parent)
public final TranslationServiceClient.ListAdaptiveMtSentencesPagedResponse listAdaptiveMtSentences(@Nullable AdaptiveMtFileName parent)Lists all AdaptiveMtSentences under a given file/dataset.
Sample 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()) {
AdaptiveMtFileName parent =
AdaptiveMtFileName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[FILE]");
for (AdaptiveMtSentence element :
translationServiceClient.listAdaptiveMtSentences(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.cloud.translate.v3.AdaptiveMtFileNameRequired. The resource name of the project from which to list the Adaptive MT
files. The following format lists all sentences under a file.
|
| Returns | |
|---|---|
| Type | Description |
TranslationServiceClient.ListAdaptiveMtSentencesPagedResponse |
|
listAdaptiveMtSentences(ListAdaptiveMtSentencesRequest request)
public final TranslationServiceClient.ListAdaptiveMtSentencesPagedResponse listAdaptiveMtSentences(ListAdaptiveMtSentencesRequest request)Lists all AdaptiveMtSentences under a given file/dataset.
Sample 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()) {
ListAdaptiveMtSentencesRequest request =
ListAdaptiveMtSentencesRequest.newBuilder()
.setParent(
AdaptiveMtFileName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[FILE]")
.toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (AdaptiveMtSentence element :
translationServiceClient.listAdaptiveMtSentences(request).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
request |
ListAdaptiveMtSentencesRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
TranslationServiceClient.ListAdaptiveMtSentencesPagedResponse |
|
listAdaptiveMtSentences(String parent)
public final TranslationServiceClient.ListAdaptiveMtSentencesPagedResponse listAdaptiveMtSentences(String parent)Lists all AdaptiveMtSentences under a given file/dataset.
Sample 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 =
AdaptiveMtFileName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[FILE]").toString();
for (AdaptiveMtSentence element :
translationServiceClient.listAdaptiveMtSentences(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
StringRequired. The resource name of the project from which to list the Adaptive MT
files. The following format lists all sentences under a file.
|
| Returns | |
|---|---|
| Type | Description |
TranslationServiceClient.ListAdaptiveMtSentencesPagedResponse |
|
listAdaptiveMtSentencesCallable()
public final UnaryCallable<ListAdaptiveMtSentencesRequest,ListAdaptiveMtSentencesResponse> listAdaptiveMtSentencesCallable()Lists all AdaptiveMtSentences under a given file/dataset.
Sample 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()) {
ListAdaptiveMtSentencesRequest request =
ListAdaptiveMtSentencesRequest.newBuilder()
.setParent(
AdaptiveMtFileName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[FILE]")
.toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListAdaptiveMtSentencesResponse response =
translationServiceClient.listAdaptiveMtSentencesCallable().call(request);
for (AdaptiveMtSentence element : response.getAdaptiveMtSentencesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListAdaptiveMtSentencesRequest,ListAdaptiveMtSentencesResponse> |
|
listAdaptiveMtSentencesPagedCallable()
public final UnaryCallable<ListAdaptiveMtSentencesRequest,TranslationServiceClient.ListAdaptiveMtSentencesPagedResponse> listAdaptiveMtSentencesPagedCallable()Lists all AdaptiveMtSentences under a given file/dataset.
Sample 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()) {
ListAdaptiveMtSentencesRequest request =
ListAdaptiveMtSentencesRequest.newBuilder()
.setParent(
AdaptiveMtFileName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[FILE]")
.toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<AdaptiveMtSentence> future =
translationServiceClient.listAdaptiveMtSentencesPagedCallable().futureCall(request);
// Do something.
for (AdaptiveMtSentence element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListAdaptiveMtSentencesRequest,ListAdaptiveMtSentencesPagedResponse> |
|
listDatasets(@Nullable LocationName parent)
public final TranslationServiceClient.ListDatasetsPagedResponse listDatasets(@Nullable LocationName parent)Lists datasets.
Sample 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]");
for (Dataset element : translationServiceClient.listDatasets(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.cloud.translate.v3.LocationNameRequired. Name of the parent project. In form of
|
| Returns | |
|---|---|
| Type | Description |
TranslationServiceClient.ListDatasetsPagedResponse |
|
listDatasets(ListDatasetsRequest request)
public final TranslationServiceClient.ListDatasetsPagedResponse listDatasets(ListDatasetsRequest request)Lists datasets.
Sample 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()) {
ListDatasetsRequest request =
ListDatasetsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Dataset element : translationServiceClient.listDatasets(request).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
request |
ListDatasetsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
TranslationServiceClient.ListDatasetsPagedResponse |
|
listDatasets(String parent)
public final TranslationServiceClient.ListDatasetsPagedResponse listDatasets(String parent)Lists datasets.
Sample 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();
for (Dataset element : translationServiceClient.listDatasets(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
StringRequired. Name of the parent project. In form of
|
| Returns | |
|---|---|
| Type | Description |
TranslationServiceClient.ListDatasetsPagedResponse |
|
listDatasetsCallable()
public final UnaryCallable<ListDatasetsRequest,ListDatasetsResponse> listDatasetsCallable()Lists datasets.
Sample 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()) {
ListDatasetsRequest request =
ListDatasetsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListDatasetsResponse response =
translationServiceClient.listDatasetsCallable().call(request);
for (Dataset element : response.getDatasetsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListDatasetsRequest,ListDatasetsResponse> |
|
listDatasetsPagedCallable()
public final UnaryCallable<ListDatasetsRequest,TranslationServiceClient.ListDatasetsPagedResponse> listDatasetsPagedCallable()Lists datasets.
Sample 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()) {
ListDatasetsRequest request =
ListDatasetsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Dataset> future =
translationServiceClient.listDatasetsPagedCallable().futureCall(request);
// Do something.
for (Dataset element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListDatasetsRequest,ListDatasetsPagedResponse> |
|
listExamples(@Nullable DatasetName parent)
public final TranslationServiceClient.ListExamplesPagedResponse listExamples(@Nullable DatasetName parent)Lists sentence pairs in the dataset.
Sample 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()) {
DatasetName parent = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]");
for (Example element : translationServiceClient.listExamples(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.cloud.translate.v3.DatasetNameRequired. Name of the parent dataset. In form of
|
| Returns | |
|---|---|
| Type | Description |
TranslationServiceClient.ListExamplesPagedResponse |
|
listExamples(ListExamplesRequest request)
public final TranslationServiceClient.ListExamplesPagedResponse listExamples(ListExamplesRequest request)Lists sentence pairs in the dataset.
Sample 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()) {
ListExamplesRequest request =
ListExamplesRequest.newBuilder()
.setParent(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Example element : translationServiceClient.listExamples(request).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
request |
ListExamplesRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
TranslationServiceClient.ListExamplesPagedResponse |
|
listExamples(String parent)
public final TranslationServiceClient.ListExamplesPagedResponse listExamples(String parent)Lists sentence pairs in the dataset.
Sample 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 = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString();
for (Example element : translationServiceClient.listExamples(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
StringRequired. Name of the parent dataset. In form of
|
| Returns | |
|---|---|
| Type | Description |
TranslationServiceClient.ListExamplesPagedResponse |
|
listExamplesCallable()
public final UnaryCallable<ListExamplesRequest,ListExamplesResponse> listExamplesCallable()Lists sentence pairs in the dataset.
Sample 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()) {
ListExamplesRequest request =
ListExamplesRequest.newBuilder()
.setParent(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListExamplesResponse response =
translationServiceClient.listExamplesCallable().call(request);
for (Example element : response.getExamplesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListExamplesRequest,ListExamplesResponse> |
|
listExamplesPagedCallable()
public final UnaryCallable<ListExamplesRequest,TranslationServiceClient.ListExamplesPagedResponse> listExamplesPagedCallable()Lists sentence pairs in the dataset.
Sample 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()) {
ListExamplesRequest request =
ListExamplesRequest.newBuilder()
.setParent(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Example> future =
translationServiceClient.listExamplesPagedCallable().futureCall(request);
// Do something.
for (Example element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListExamplesRequest,ListExamplesPagedResponse> |
|
listGlossaries(@Nullable LocationName parent)
public final TranslationServiceClient.ListGlossariesPagedResponse listGlossaries(@Nullable LocationName parent)Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't exist.
Sample 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]");
for (Glossary element : translationServiceClient.listGlossaries(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.cloud.translate.v3.LocationNameRequired. The name of the project from which to list all of the glossaries. |
| Returns | |
|---|---|
| Type | Description |
TranslationServiceClient.ListGlossariesPagedResponse |
|
listGlossaries(ListGlossariesRequest request)
public final TranslationServiceClient.ListGlossariesPagedResponse listGlossaries(ListGlossariesRequest request)Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't exist.
Sample 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()) {
ListGlossariesRequest request =
ListGlossariesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
for (Glossary element : translationServiceClient.listGlossaries(request).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
request |
ListGlossariesRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
TranslationServiceClient.ListGlossariesPagedResponse |
|
listGlossaries(String parent)
public final TranslationServiceClient.ListGlossariesPagedResponse listGlossaries(String parent)Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't exist.
Sample 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();
for (Glossary element : translationServiceClient.listGlossaries(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
StringRequired. The name of the project from which to list all of the glossaries. |
| Returns | |
|---|---|
| Type | Description |
TranslationServiceClient.ListGlossariesPagedResponse |
|
listGlossariesCallable()
public final UnaryCallable<ListGlossariesRequest,ListGlossariesResponse> listGlossariesCallable()Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't exist.
Sample 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()) {
ListGlossariesRequest request =
ListGlossariesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
while (true) {
ListGlossariesResponse response =
translationServiceClient.listGlossariesCallable().call(request);
for (Glossary element : response.getGlossariesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListGlossariesRequest,ListGlossariesResponse> |
|
listGlossariesPagedCallable()
public final UnaryCallable<ListGlossariesRequest,TranslationServiceClient.ListGlossariesPagedResponse> listGlossariesPagedCallable()Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't exist.
Sample 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()) {
ListGlossariesRequest request =
ListGlossariesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
ApiFuture<Glossary> future =
translationServiceClient.listGlossariesPagedCallable().futureCall(request);
// Do something.
for (Glossary element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListGlossariesRequest,ListGlossariesPagedResponse> |
|
listGlossaryEntries(@Nullable GlossaryName parent)
public final TranslationServiceClient.ListGlossaryEntriesPagedResponse listGlossaryEntries(@Nullable GlossaryName parent)List the entries for the glossary.
Sample 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()) {
GlossaryName parent = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
for (GlossaryEntry element :
translationServiceClient.listGlossaryEntries(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.cloud.translate.v3.GlossaryNameRequired. The parent glossary resource name for listing the glossary's entries. |
| Returns | |
|---|---|
| Type | Description |
TranslationServiceClient.ListGlossaryEntriesPagedResponse |
|
listGlossaryEntries(ListGlossaryEntriesRequest request)
public final TranslationServiceClient.ListGlossaryEntriesPagedResponse listGlossaryEntries(ListGlossaryEntriesRequest request)List the entries for the glossary.
Sample 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()) {
ListGlossaryEntriesRequest request =
ListGlossaryEntriesRequest.newBuilder()
.setParent(GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (GlossaryEntry element :
translationServiceClient.listGlossaryEntries(request).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
request |
ListGlossaryEntriesRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
TranslationServiceClient.ListGlossaryEntriesPagedResponse |
|
listGlossaryEntries(String parent)
public final TranslationServiceClient.ListGlossaryEntriesPagedResponse listGlossaryEntries(String parent)List the entries for the glossary.
Sample 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 = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]").toString();
for (GlossaryEntry element :
translationServiceClient.listGlossaryEntries(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
StringRequired. The parent glossary resource name for listing the glossary's entries. |
| Returns | |
|---|---|
| Type | Description |
TranslationServiceClient.ListGlossaryEntriesPagedResponse |
|
listGlossaryEntriesCallable()
public final UnaryCallable<ListGlossaryEntriesRequest,ListGlossaryEntriesResponse> listGlossaryEntriesCallable()List the entries for the glossary.
Sample 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()) {
ListGlossaryEntriesRequest request =
ListGlossaryEntriesRequest.newBuilder()
.setParent(GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListGlossaryEntriesResponse response =
translationServiceClient.listGlossaryEntriesCallable().call(request);
for (GlossaryEntry element : response.getGlossaryEntriesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListGlossaryEntriesRequest,ListGlossaryEntriesResponse> |
|
listGlossaryEntriesPagedCallable()
public final UnaryCallable<ListGlossaryEntriesRequest,TranslationServiceClient.ListGlossaryEntriesPagedResponse> listGlossaryEntriesPagedCallable()List the entries for the glossary.
Sample 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()) {
ListGlossaryEntriesRequest request =
ListGlossaryEntriesRequest.newBuilder()
.setParent(GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<GlossaryEntry> future =
translationServiceClient.listGlossaryEntriesPagedCallable().futureCall(request);
// Do something.
for (GlossaryEntry element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListGlossaryEntriesRequest,ListGlossaryEntriesPagedResponse> |
|
listModels(@Nullable LocationName parent)
public final TranslationServiceClient.ListModelsPagedResponse listModels(@Nullable LocationName parent)Lists models.
Sample 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]");
for (Model element : translationServiceClient.listModels(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.cloud.translate.v3.LocationNameRequired. Name of the parent project. In form of
|
| Returns | |
|---|---|
| Type | Description |
TranslationServiceClient.ListModelsPagedResponse |
|
listModels(ListModelsRequest request)
public final TranslationServiceClient.ListModelsPagedResponse listModels(ListModelsRequest request)Lists models.
Sample 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()) {
ListModelsRequest request =
ListModelsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Model element : translationServiceClient.listModels(request).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
request |
ListModelsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
TranslationServiceClient.ListModelsPagedResponse |
|
listModels(String parent)
public final TranslationServiceClient.ListModelsPagedResponse listModels(String parent)Lists models.
Sample 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();
for (Model element : translationServiceClient.listModels(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
StringRequired. Name of the parent project. In form of
|
| Returns | |
|---|---|
| Type | Description |
TranslationServiceClient.ListModelsPagedResponse |
|
listModelsCallable()
public final UnaryCallable<ListModelsRequest,ListModelsResponse> listModelsCallable()Lists models.
Sample 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()) {
ListModelsRequest request =
ListModelsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListModelsResponse response = translationServiceClient.listModelsCallable().call(request);
for (Model element : response.getModelsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListModelsRequest,ListModelsResponse> |
|
listModelsPagedCallable()
public final UnaryCallable<ListModelsRequest,TranslationServiceClient.ListModelsPagedResponse> listModelsPagedCallable()Lists models.
Sample 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()) {
ListModelsRequest request =
ListModelsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Model> future =
translationServiceClient.listModelsPagedCallable().futureCall(request);
// Do something.
for (Model element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListModelsRequest,ListModelsPagedResponse> |
|
romanizeText(@Nullable LocationName parent, List<String> contents)
public final RomanizeTextResponse romanizeText(@Nullable LocationName parent, List<String> contents)Romanize input text written in non-Latin scripts to Latin text.
Sample 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]");
List<String> contents = new ArrayList<>();
RomanizeTextResponse response = translationServiceClient.romanizeText(parent, contents);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.cloud.translate.v3.LocationNameRequired. Project or location to make a call. Must refer to a caller's project. Format: For global calls, use |
contents |
List<String>Required. The content of the input in string format. |
| Returns | |
|---|---|
| Type | Description |
RomanizeTextResponse |
|
romanizeText(RomanizeTextRequest request)
public final RomanizeTextResponse romanizeText(RomanizeTextRequest request)Romanize input text written in non-Latin scripts to Latin text.
Sample 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()) {
RomanizeTextRequest request =
RomanizeTextRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.addAllContents(new ArrayList<String>())
.setSourceLanguageCode("sourceLanguageCode1645917472")
.build();
RomanizeTextResponse response = translationServiceClient.romanizeText(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
RomanizeTextRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
RomanizeTextResponse |
|
romanizeText(String parent, List<String> contents)
public final RomanizeTextResponse romanizeText(String parent, List<String> contents)Romanize input text written in non-Latin scripts to Latin text.
Sample 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();
List<String> contents = new ArrayList<>();
RomanizeTextResponse response = translationServiceClient.romanizeText(parent, contents);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. Project or location to make a call. Must refer to a caller's project. Format: For global calls, use |
contents |
List<String>Required. The content of the input in string format. |
| Returns | |
|---|---|
| Type | Description |
RomanizeTextResponse |
|
romanizeTextCallable()
public final UnaryCallable<RomanizeTextRequest,RomanizeTextResponse> romanizeTextCallable()Romanize input text written in non-Latin scripts to Latin text.
Sample 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()) {
RomanizeTextRequest request =
RomanizeTextRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.addAllContents(new ArrayList<String>())
.setSourceLanguageCode("sourceLanguageCode1645917472")
.build();
ApiFuture<RomanizeTextResponse> future =
translationServiceClient.romanizeTextCallable().futureCall(request);
// Do something.
RomanizeTextResponse response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<RomanizeTextRequest,RomanizeTextResponse> |
|
shutdown()
public void shutdown()shutdownNow()
public void shutdownNow()translateDocument(TranslateDocumentRequest request)
public final TranslateDocumentResponse translateDocument(TranslateDocumentRequest request)Translates documents in synchronous mode.
Sample 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()) {
TranslateDocumentRequest request =
TranslateDocumentRequest.newBuilder()
.setParent("parent-995424086")
.setSourceLanguageCode("sourceLanguageCode1645917472")
.setTargetLanguageCode("targetLanguageCode-106414698")
.setDocumentInputConfig(DocumentInputConfig.newBuilder().build())
.setDocumentOutputConfig(DocumentOutputConfig.newBuilder().build())
.setModel("model104069929")
.setGlossaryConfig(TranslateTextGlossaryConfig.newBuilder().build())
.putAllLabels(new HashMap<String, String>())
.setCustomizedAttribution("customizedAttribution557650238")
.setIsTranslateNativePdfOnly(true)
.setEnableShadowRemovalNativePdf(true)
.setEnableRotationCorrection(true)
.build();
TranslateDocumentResponse response = translationServiceClient.translateDocument(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
TranslateDocumentRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
TranslateDocumentResponse |
|
translateDocumentCallable()
public final UnaryCallable<TranslateDocumentRequest,TranslateDocumentResponse> translateDocumentCallable()Translates documents in synchronous mode.
Sample 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()) {
TranslateDocumentRequest request =
TranslateDocumentRequest.newBuilder()
.setParent("parent-995424086")
.setSourceLanguageCode("sourceLanguageCode1645917472")
.setTargetLanguageCode("targetLanguageCode-106414698")
.setDocumentInputConfig(DocumentInputConfig.newBuilder().build())
.setDocumentOutputConfig(DocumentOutputConfig.newBuilder().build())
.setModel("model104069929")
.setGlossaryConfig(TranslateTextGlossaryConfig.newBuilder().build())
.putAllLabels(new HashMap<String, String>())
.setCustomizedAttribution("customizedAttribution557650238")
.setIsTranslateNativePdfOnly(true)
.setEnableShadowRemovalNativePdf(true)
.setEnableRotationCorrection(true)
.build();
ApiFuture<TranslateDocumentResponse> future =
translationServiceClient.translateDocumentCallable().futureCall(request);
// Do something.
TranslateDocumentResponse response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<TranslateDocumentRequest,TranslateDocumentResponse> |
|
translateText(@Nullable LocationName parent, String model, String mimeType, String sourceLanguageCode, String targetLanguageCode, List<String> contents)
public final TranslateTextResponse translateText(@Nullable LocationName parent, String model, String mimeType, String sourceLanguageCode, String targetLanguageCode, List<String> contents)Translates input text and returns translated text.
Sample 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 sourceLanguageCode = "sourceLanguageCode1645917472";
String targetLanguageCode = "targetLanguageCode-106414698";
List<String> contents = new ArrayList<>();
TranslateTextResponse response =
translationServiceClient.translateText(
parent, model, mimeType, sourceLanguageCode, targetLanguageCode, contents);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.cloud.translate.v3.LocationNameRequired. Project or location to make a call. Must refer to a caller's project. Format: For global calls, use Non-global location is required for requests using AutoML models or custom glossaries. Models and glossaries must be within the same region (have same location-id), otherwise an INVALID_ARGUMENT (400) error is returned. |
model |
StringOptional. The The format depends on model type: - AutoML Translation models:
- General (built-in) models:
- Translation LLM models:
For global (non-regionalized) requests, use If not provided, the default Google model (NMT) will be used |
mimeType |
StringOptional. The format of the source text, for example, "text/html", "text/plain". If left blank, the MIME type defaults to "text/html". |
sourceLanguageCode |
StringOptional. The ISO-639 language code of the input text if known, for example, "en-US" or "sr-Latn". Supported language codes are listed in Language Support. If the source language isn't specified, the API attempts to identify the source language automatically and returns the source language within the response. |
targetLanguageCode |
StringRequired. The ISO-639 language code to use for translation of the input text, set to one of the language codes listed in Language Support. |
contents |
List<String>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. |
| Returns | |
|---|---|
| Type | Description |
TranslateTextResponse |
|
translateText(@Nullable LocationName parent, String targetLanguageCode, List<String> contents)
public final TranslateTextResponse translateText(@Nullable LocationName parent, String targetLanguageCode, List<String> contents)Translates input text and returns translated text.
Sample 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 targetLanguageCode = "targetLanguageCode-106414698";
List<String> contents = new ArrayList<>();
TranslateTextResponse response =
translationServiceClient.translateText(parent, targetLanguageCode, contents);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.cloud.translate.v3.LocationNameRequired. Project or location to make a call. Must refer to a caller's project. Format: For global calls, use Non-global location is required for requests using AutoML models or custom glossaries. Models and glossaries must be within the same region (have same location-id), otherwise an INVALID_ARGUMENT (400) error is returned. |
targetLanguageCode |
StringRequired. The ISO-639 language code to use for translation of the input text, set to one of the language codes listed in Language Support. |
contents |
List<String>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. |
| Returns | |
|---|---|
| Type | Description |
TranslateTextResponse |
|
translateText(TranslateTextRequest request)
public final TranslateTextResponse translateText(TranslateTextRequest request)Translates input text and returns translated text.
Sample 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()) {
TranslateTextRequest request =
TranslateTextRequest.newBuilder()
.addAllContents(new ArrayList<String>())
.setMimeType("mimeType-1392120434")
.setSourceLanguageCode("sourceLanguageCode1645917472")
.setTargetLanguageCode("targetLanguageCode-106414698")
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setModel("model104069929")
.setGlossaryConfig(TranslateTextGlossaryConfig.newBuilder().build())
.setTransliterationConfig(TransliterationConfig.newBuilder().build())
.putAllLabels(new HashMap<String, String>())
.build();
TranslateTextResponse response = translationServiceClient.translateText(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
TranslateTextRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
TranslateTextResponse |
|
translateText(String parent, String model, String mimeType, String sourceLanguageCode, String targetLanguageCode, List<String> contents)
public final TranslateTextResponse translateText(String parent, String model, String mimeType, String sourceLanguageCode, String targetLanguageCode, List<String> contents)Translates input text and returns translated text.
Sample 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 model = "model104069929";
String mimeType = "mimeType-1392120434";
String sourceLanguageCode = "sourceLanguageCode1645917472";
String targetLanguageCode = "targetLanguageCode-106414698";
List<String> contents = new ArrayList<>();
TranslateTextResponse response =
translationServiceClient.translateText(
parent, model, mimeType, sourceLanguageCode, targetLanguageCode, contents);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. Project or location to make a call. Must refer to a caller's project. Format: For global calls, use Non-global location is required for requests using AutoML models or custom glossaries. Models and glossaries must be within the same region (have same location-id), otherwise an INVALID_ARGUMENT (400) error is returned. |
model |
StringOptional. The The format depends on model type: - AutoML Translation models:
- General (built-in) models:
- Translation LLM models:
For global (non-regionalized) requests, use If not provided, the default Google model (NMT) will be used |
mimeType |
StringOptional. The format of the source text, for example, "text/html", "text/plain". If left blank, the MIME type defaults to "text/html". |
sourceLanguageCode |
StringOptional. The ISO-639 language code of the input text if known, for example, "en-US" or "sr-Latn". Supported language codes are listed in Language Support. If the source language isn't specified, the API attempts to identify the source language automatically and returns the source language within the response. |
targetLanguageCode |
StringRequired. The ISO-639 language code to use for translation of the input text, set to one of the language codes listed in Language Support. |
contents |
List<String>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. |
| Returns | |
|---|---|
| Type | Description |
TranslateTextResponse |
|
translateText(String parent, String targetLanguageCode, List<String> contents)
public final TranslateTextResponse translateText(String parent, String targetLanguageCode, List<String> contents)Translates input text and returns translated text.
Sample 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);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. Project or location to make a call. Must refer to a caller's project. Format: For global calls, use Non-global location is required for requests using AutoML models or custom glossaries. Models and glossaries must be within the same region (have same location-id), otherwise an INVALID_ARGUMENT (400) error is returned. |
targetLanguageCode |
StringRequired. The ISO-639 language code to use for translation of the input text, set to one of the language codes listed in Language Support. |
contents |
List<String>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. |
| Returns | |
|---|---|
| Type | Description |
TranslateTextResponse |
|
translateTextCallable()
public final UnaryCallable<TranslateTextRequest,TranslateTextResponse> translateTextCallable()Translates input text and returns translated text.
Sample 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()) {
TranslateTextRequest request =
TranslateTextRequest.newBuilder()
.addAllContents(new ArrayList<String>())
.setMimeType("mimeType-1392120434")
.setSourceLanguageCode("sourceLanguageCode1645917472")
.setTargetLanguageCode("targetLanguageCode-106414698")
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setModel("model104069929")
.setGlossaryConfig(TranslateTextGlossaryConfig.newBuilder().build())
.setTransliterationConfig(TransliterationConfig.newBuilder().build())
.putAllLabels(new HashMap<String, String>())
.build();
ApiFuture<TranslateTextResponse> future =
translationServiceClient.translateTextCallable().futureCall(request);
// Do something.
TranslateTextResponse response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<TranslateTextRequest,TranslateTextResponse> |
|
updateGlossaryAsync(Glossary glossary, FieldMask updateMask)
public final OperationFuture<Glossary,UpdateGlossaryMetadata> updateGlossaryAsync(Glossary glossary, FieldMask updateMask)Updates a glossary. A LRO is used since the update can be async if the glossary's entry file is updated.
Sample 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()) {
Glossary glossary = Glossary.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Glossary response = translationServiceClient.updateGlossaryAsync(glossary, updateMask).get();
}
| Parameters | |
|---|---|
| Name | Description |
glossary |
GlossaryRequired. The glossary entry to update. |
updateMask |
FieldMaskThe list of fields to be updated. Currently only |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Glossary,UpdateGlossaryMetadata> |
|
updateGlossaryAsync(UpdateGlossaryRequest request)
public final OperationFuture<Glossary,UpdateGlossaryMetadata> updateGlossaryAsync(UpdateGlossaryRequest request)Updates a glossary. A LRO is used since the update can be async if the glossary's entry file is updated.
Sample 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()) {
UpdateGlossaryRequest request =
UpdateGlossaryRequest.newBuilder()
.setGlossary(Glossary.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Glossary response = translationServiceClient.updateGlossaryAsync(request).get();
}
| Parameter | |
|---|---|
| Name | Description |
request |
UpdateGlossaryRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Glossary,UpdateGlossaryMetadata> |
|
updateGlossaryCallable()
public final UnaryCallable<UpdateGlossaryRequest,Operation> updateGlossaryCallable()Updates a glossary. A LRO is used since the update can be async if the glossary's entry file is updated.
Sample 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()) {
UpdateGlossaryRequest request =
UpdateGlossaryRequest.newBuilder()
.setGlossary(Glossary.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Operation> future =
translationServiceClient.updateGlossaryCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<UpdateGlossaryRequest,Operation> |
|
updateGlossaryEntry(GlossaryEntry glossaryEntry)
public final GlossaryEntry updateGlossaryEntry(GlossaryEntry glossaryEntry)Updates a glossary entry.
Sample 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()) {
GlossaryEntry glossaryEntry = GlossaryEntry.newBuilder().build();
GlossaryEntry response = translationServiceClient.updateGlossaryEntry(glossaryEntry);
}
| Parameter | |
|---|---|
| Name | Description |
glossaryEntry |
GlossaryEntryRequired. The glossary entry to update. |
| Returns | |
|---|---|
| Type | Description |
GlossaryEntry |
|
updateGlossaryEntry(UpdateGlossaryEntryRequest request)
public final GlossaryEntry updateGlossaryEntry(UpdateGlossaryEntryRequest request)Updates a glossary entry.
Sample 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()) {
UpdateGlossaryEntryRequest request =
UpdateGlossaryEntryRequest.newBuilder()
.setGlossaryEntry(GlossaryEntry.newBuilder().build())
.build();
GlossaryEntry response = translationServiceClient.updateGlossaryEntry(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
UpdateGlossaryEntryRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
GlossaryEntry |
|
updateGlossaryEntryCallable()
public final UnaryCallable<UpdateGlossaryEntryRequest,GlossaryEntry> updateGlossaryEntryCallable()Updates a glossary entry.
Sample 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()) {
UpdateGlossaryEntryRequest request =
UpdateGlossaryEntryRequest.newBuilder()
.setGlossaryEntry(GlossaryEntry.newBuilder().build())
.build();
ApiFuture<GlossaryEntry> future =
translationServiceClient.updateGlossaryEntryCallable().futureCall(request);
// Do something.
GlossaryEntry response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<UpdateGlossaryEntryRequest,GlossaryEntry> |
|
updateGlossaryOperationCallable()
public final OperationCallable<UpdateGlossaryRequest,Glossary,UpdateGlossaryMetadata> updateGlossaryOperationCallable()Updates a glossary. A LRO is used since the update can be async if the glossary's entry file is updated.
Sample 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()) {
UpdateGlossaryRequest request =
UpdateGlossaryRequest.newBuilder()
.setGlossary(Glossary.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
OperationFuture<Glossary, UpdateGlossaryMetadata> future =
translationServiceClient.updateGlossaryOperationCallable().futureCall(request);
// Do something.
Glossary response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<UpdateGlossaryRequest,Glossary,UpdateGlossaryMetadata> |
|