- 2.54.0 (latest)
- 2.53.0
- 2.52.0
- 2.51.0
- 2.49.0
- 2.48.0
- 2.47.0
- 2.46.0
- 2.45.0
- 2.44.0
- 2.43.0
- 2.42.0
- 2.41.0
- 2.40.0
- 2.39.0
- 2.37.0
- 2.36.0
- 2.35.0
- 2.34.0
- 2.33.0
- 2.32.0
- 2.31.0
- 2.30.0
- 2.29.0
- 2.28.0
- 2.27.0
- 2.24.0
- 2.23.0
- 2.22.0
- 2.21.0
- 2.20.0
- 2.19.0
- 2.18.0
- 2.17.0
- 2.16.0
- 2.15.0
- 2.14.0
- 2.13.0
- 2.12.0
- 2.11.0
- 2.9.0
- 2.8.0
- 2.7.0
- 2.6.0
- 2.5.0
- 2.4.0
- 2.3.5
- 2.2.0
- 2.1.13
A client to Cloud Translation API
The interfaces provided are listed below, along with usage samples.
TranslationServiceClient
Service Description: Provides natural language translation operations.
Sample for TranslationServiceClient:
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);
}
Classes
BatchDocumentInputConfig
Input configuration for BatchTranslateDocument request.
Protobuf type google.cloud.translation.v3.BatchDocumentInputConfig
BatchDocumentInputConfig.Builder
Input configuration for BatchTranslateDocument request.
Protobuf type google.cloud.translation.v3.BatchDocumentInputConfig
BatchDocumentOutputConfig
Output configuration for BatchTranslateDocument request.
Protobuf type google.cloud.translation.v3.BatchDocumentOutputConfig
BatchDocumentOutputConfig.Builder
Output configuration for BatchTranslateDocument request.
Protobuf type google.cloud.translation.v3.BatchDocumentOutputConfig
BatchTranslateDocumentMetadata
State metadata for the batch translation operation.
Protobuf type google.cloud.translation.v3.BatchTranslateDocumentMetadata
BatchTranslateDocumentMetadata.Builder
State metadata for the batch translation operation.
Protobuf type google.cloud.translation.v3.BatchTranslateDocumentMetadata
BatchTranslateDocumentRequest
The BatchTranslateDocument request.
Protobuf type google.cloud.translation.v3.BatchTranslateDocumentRequest
BatchTranslateDocumentRequest.Builder
The BatchTranslateDocument request.
Protobuf type google.cloud.translation.v3.BatchTranslateDocumentRequest
BatchTranslateDocumentResponse
Stored in the google.longrunning.Operation.response field returned by BatchTranslateDocument if at least one document is translated successfully.
Protobuf type google.cloud.translation.v3.BatchTranslateDocumentResponse
BatchTranslateDocumentResponse.Builder
Stored in the google.longrunning.Operation.response field returned by BatchTranslateDocument if at least one document is translated successfully.
Protobuf type google.cloud.translation.v3.BatchTranslateDocumentResponse
BatchTranslateMetadata
State metadata for the batch translation operation.
Protobuf type google.cloud.translation.v3.BatchTranslateMetadata
BatchTranslateMetadata.Builder
State metadata for the batch translation operation.
Protobuf type google.cloud.translation.v3.BatchTranslateMetadata
BatchTranslateResponse
Stored in the google.longrunning.Operation.response field returned by BatchTranslateText if at least one sentence is translated successfully.
Protobuf type google.cloud.translation.v3.BatchTranslateResponse
BatchTranslateResponse.Builder
Stored in the google.longrunning.Operation.response field returned by BatchTranslateText if at least one sentence is translated successfully.
Protobuf type google.cloud.translation.v3.BatchTranslateResponse
BatchTranslateTextRequest
The batch translation request.
Protobuf type google.cloud.translation.v3.BatchTranslateTextRequest
BatchTranslateTextRequest.Builder
The batch translation request.
Protobuf type google.cloud.translation.v3.BatchTranslateTextRequest
CreateGlossaryMetadata
Stored in the google.longrunning.Operation.metadata field returned by CreateGlossary.
Protobuf type google.cloud.translation.v3.CreateGlossaryMetadata
CreateGlossaryMetadata.Builder
Stored in the google.longrunning.Operation.metadata field returned by CreateGlossary.
Protobuf type google.cloud.translation.v3.CreateGlossaryMetadata
CreateGlossaryRequest
Request message for CreateGlossary.
Protobuf type google.cloud.translation.v3.CreateGlossaryRequest
CreateGlossaryRequest.Builder
Request message for CreateGlossary.
Protobuf type google.cloud.translation.v3.CreateGlossaryRequest
DeleteGlossaryMetadata
Stored in the google.longrunning.Operation.metadata field returned by DeleteGlossary.
Protobuf type google.cloud.translation.v3.DeleteGlossaryMetadata
DeleteGlossaryMetadata.Builder
Stored in the google.longrunning.Operation.metadata field returned by DeleteGlossary.
Protobuf type google.cloud.translation.v3.DeleteGlossaryMetadata
DeleteGlossaryRequest
Request message for DeleteGlossary.
Protobuf type google.cloud.translation.v3.DeleteGlossaryRequest
DeleteGlossaryRequest.Builder
Request message for DeleteGlossary.
Protobuf type google.cloud.translation.v3.DeleteGlossaryRequest
DeleteGlossaryResponse
Stored in the google.longrunning.Operation.response field returned by DeleteGlossary.
Protobuf type google.cloud.translation.v3.DeleteGlossaryResponse
DeleteGlossaryResponse.Builder
Stored in the google.longrunning.Operation.response field returned by DeleteGlossary.
Protobuf type google.cloud.translation.v3.DeleteGlossaryResponse
DetectLanguageRequest
The request message for language detection.
Protobuf type google.cloud.translation.v3.DetectLanguageRequest
DetectLanguageRequest.Builder
The request message for language detection.
Protobuf type google.cloud.translation.v3.DetectLanguageRequest
DetectLanguageResponse
The response message for language detection.
Protobuf type google.cloud.translation.v3.DetectLanguageResponse
DetectLanguageResponse.Builder
The response message for language detection.
Protobuf type google.cloud.translation.v3.DetectLanguageResponse
DetectedLanguage
The response message for language detection.
Protobuf type google.cloud.translation.v3.DetectedLanguage
DetectedLanguage.Builder
The response message for language detection.
Protobuf type google.cloud.translation.v3.DetectedLanguage
DocumentInputConfig
A document translation request input config.
Protobuf type google.cloud.translation.v3.DocumentInputConfig
DocumentInputConfig.Builder
A document translation request input config.
Protobuf type google.cloud.translation.v3.DocumentInputConfig
DocumentOutputConfig
A document translation request output config.
Protobuf type google.cloud.translation.v3.DocumentOutputConfig
DocumentOutputConfig.Builder
A document translation request output config.
Protobuf type google.cloud.translation.v3.DocumentOutputConfig
DocumentTranslation
A translated document message.
Protobuf type google.cloud.translation.v3.DocumentTranslation
DocumentTranslation.Builder
A translated document message.
Protobuf type google.cloud.translation.v3.DocumentTranslation
GcsDestination
The Google Cloud Storage location for the output content.
Protobuf type google.cloud.translation.v3.GcsDestination
GcsDestination.Builder
The Google Cloud Storage location for the output content.
Protobuf type google.cloud.translation.v3.GcsDestination
GcsSource
The Google Cloud Storage location for the input content.
Protobuf type google.cloud.translation.v3.GcsSource
GcsSource.Builder
The Google Cloud Storage location for the input content.
Protobuf type google.cloud.translation.v3.GcsSource
GetGlossaryRequest
Request message for GetGlossary.
Protobuf type google.cloud.translation.v3.GetGlossaryRequest
GetGlossaryRequest.Builder
Request message for GetGlossary.
Protobuf type google.cloud.translation.v3.GetGlossaryRequest
GetSupportedLanguagesRequest
The request message for discovering supported languages.
Protobuf type google.cloud.translation.v3.GetSupportedLanguagesRequest
GetSupportedLanguagesRequest.Builder
The request message for discovering supported languages.
Protobuf type google.cloud.translation.v3.GetSupportedLanguagesRequest
Glossary
Represents a glossary built from user provided data.
Protobuf type google.cloud.translation.v3.Glossary
Glossary.Builder
Represents a glossary built from user provided data.
Protobuf type google.cloud.translation.v3.Glossary
Glossary.LanguageCodePair
Used with unidirectional glossaries.
Protobuf type google.cloud.translation.v3.Glossary.LanguageCodePair
Glossary.LanguageCodePair.Builder
Used with unidirectional glossaries.
Protobuf type google.cloud.translation.v3.Glossary.LanguageCodePair
Glossary.LanguageCodesSet
Used with equivalent term set glossaries.
Protobuf type google.cloud.translation.v3.Glossary.LanguageCodesSet
Glossary.LanguageCodesSet.Builder
Used with equivalent term set glossaries.
Protobuf type google.cloud.translation.v3.Glossary.LanguageCodesSet
GlossaryInputConfig
Input configuration for glossaries.
Protobuf type google.cloud.translation.v3.GlossaryInputConfig
GlossaryInputConfig.Builder
Input configuration for glossaries.
Protobuf type google.cloud.translation.v3.GlossaryInputConfig
GlossaryName
GlossaryName.Builder
Builder for projects/{project}/locations/{location}/glossaries/{glossary}.
InputConfig
Input configuration for BatchTranslateText request.
Protobuf type google.cloud.translation.v3.InputConfig
InputConfig.Builder
Input configuration for BatchTranslateText request.
Protobuf type google.cloud.translation.v3.InputConfig
ListGlossariesRequest
Request message for ListGlossaries.
Protobuf type google.cloud.translation.v3.ListGlossariesRequest
ListGlossariesRequest.Builder
Request message for ListGlossaries.
Protobuf type google.cloud.translation.v3.ListGlossariesRequest
ListGlossariesResponse
Response message for ListGlossaries.
Protobuf type google.cloud.translation.v3.ListGlossariesResponse
ListGlossariesResponse.Builder
Response message for ListGlossaries.
Protobuf type google.cloud.translation.v3.ListGlossariesResponse
LocationName
LocationName.Builder
Builder for projects/{project}/locations/{location}.
OutputConfig
Output configuration for BatchTranslateText request.
Protobuf type google.cloud.translation.v3.OutputConfig
OutputConfig.Builder
Output configuration for BatchTranslateText request.
Protobuf type google.cloud.translation.v3.OutputConfig
SupportedLanguage
A single supported language response corresponds to information related to one supported language.
Protobuf type google.cloud.translation.v3.SupportedLanguage
SupportedLanguage.Builder
A single supported language response corresponds to information related to one supported language.
Protobuf type google.cloud.translation.v3.SupportedLanguage
SupportedLanguages
The response message for discovering supported languages.
Protobuf type google.cloud.translation.v3.SupportedLanguages
SupportedLanguages.Builder
The response message for discovering supported languages.
Protobuf type google.cloud.translation.v3.SupportedLanguages
TranslateDocumentRequest
A document translation request.
Protobuf type google.cloud.translation.v3.TranslateDocumentRequest
TranslateDocumentRequest.Builder
A document translation request.
Protobuf type google.cloud.translation.v3.TranslateDocumentRequest
TranslateDocumentResponse
A translated document response message.
Protobuf type google.cloud.translation.v3.TranslateDocumentResponse
TranslateDocumentResponse.Builder
A translated document response message.
Protobuf type google.cloud.translation.v3.TranslateDocumentResponse
TranslateTextGlossaryConfig
Configures which glossary should be used for a specific target language, and defines options for applying that glossary.
Protobuf type google.cloud.translation.v3.TranslateTextGlossaryConfig
TranslateTextGlossaryConfig.Builder
Configures which glossary should be used for a specific target language, and defines options for applying that glossary.
Protobuf type google.cloud.translation.v3.TranslateTextGlossaryConfig
TranslateTextRequest
The request message for synchronous translation.
Protobuf type google.cloud.translation.v3.TranslateTextRequest
TranslateTextRequest.Builder
The request message for synchronous translation.
Protobuf type google.cloud.translation.v3.TranslateTextRequest
TranslateTextResponse
Protobuf type google.cloud.translation.v3.TranslateTextResponse
TranslateTextResponse.Builder
Protobuf type google.cloud.translation.v3.TranslateTextResponse
Translation
A single translation response.
Protobuf type google.cloud.translation.v3.Translation
Translation.Builder
A single translation response.
Protobuf type google.cloud.translation.v3.Translation
TranslationServiceClient
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:
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().
The surface of this class includes several types of Java methods for each of the API's methods:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns 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:
TranslationServiceSettings translationServiceSettings =
TranslationServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
TranslationServiceClient translationServiceClient =
TranslationServiceClient.create(translationServiceSettings);
To customize the endpoint:
TranslationServiceSettings translationServiceSettings =
TranslationServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
TranslationServiceClient translationServiceClient =
TranslationServiceClient.create(translationServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
TranslationServiceClient.ListGlossariesFixedSizeCollection
TranslationServiceClient.ListGlossariesPage
TranslationServiceClient.ListGlossariesPagedResponse
TranslationServiceGrpc
Provides natural language translation operations.
TranslationServiceGrpc.TranslationServiceBlockingStub
Provides natural language translation operations.
TranslationServiceGrpc.TranslationServiceFutureStub
Provides natural language translation operations.
TranslationServiceGrpc.TranslationServiceImplBase
Provides natural language translation operations.
TranslationServiceGrpc.TranslationServiceStub
Provides natural language translation operations.
TranslationServiceProto
TranslationServiceSettings
Settings class to configure an instance of TranslationServiceClient.
The default instance has everything set to sensible defaults:
- The default service address (translate.googleapis.com) and default port (443) are used.
- Credentials are acquired automatically through Application Default Credentials.
- Retries are configured for idempotent methods but not for non-idempotent methods.
The builder of this class is recursive, so contained classes are themselves builders. When build() is called, the tree of builders is called to create the complete settings object.
For example, to set the total timeout of translateText to 30 seconds:
TranslationServiceSettings.Builder translationServiceSettingsBuilder =
TranslationServiceSettings.newBuilder();
translationServiceSettingsBuilder
.translateTextSettings()
.setRetrySettings(
translationServiceSettingsBuilder
.translateTextSettings()
.getRetrySettings()
.toBuilder()
.setTotalTimeout(Duration.ofSeconds(30))
.build());
TranslationServiceSettings translationServiceSettings =
translationServiceSettingsBuilder.build();
TranslationServiceSettings.Builder
Builder for TranslationServiceSettings.
Interfaces
BatchDocumentInputConfigOrBuilder
BatchDocumentOutputConfigOrBuilder
BatchTranslateDocumentMetadataOrBuilder
BatchTranslateDocumentRequestOrBuilder
BatchTranslateDocumentResponseOrBuilder
BatchTranslateMetadataOrBuilder
BatchTranslateResponseOrBuilder
BatchTranslateTextRequestOrBuilder
CreateGlossaryMetadataOrBuilder
CreateGlossaryRequestOrBuilder
DeleteGlossaryMetadataOrBuilder
DeleteGlossaryRequestOrBuilder
DeleteGlossaryResponseOrBuilder
DetectLanguageRequestOrBuilder
DetectLanguageResponseOrBuilder
DetectedLanguageOrBuilder
DocumentInputConfigOrBuilder
DocumentOutputConfigOrBuilder
DocumentTranslationOrBuilder
GcsDestinationOrBuilder
GcsSourceOrBuilder
GetGlossaryRequestOrBuilder
GetSupportedLanguagesRequestOrBuilder
Glossary.LanguageCodePairOrBuilder
Glossary.LanguageCodesSetOrBuilder
GlossaryInputConfigOrBuilder
GlossaryOrBuilder
InputConfigOrBuilder
ListGlossariesRequestOrBuilder
ListGlossariesResponseOrBuilder
OutputConfigOrBuilder
SupportedLanguageOrBuilder
SupportedLanguagesOrBuilder
TranslateDocumentRequestOrBuilder
TranslateDocumentResponseOrBuilder
TranslateTextGlossaryConfigOrBuilder
TranslateTextRequestOrBuilder
TranslateTextResponseOrBuilder
TranslationOrBuilder
Enums
BatchDocumentInputConfig.SourceCase
BatchDocumentOutputConfig.DestinationCase
BatchTranslateDocumentMetadata.State
State of the job.
Protobuf enum google.cloud.translation.v3.BatchTranslateDocumentMetadata.State
BatchTranslateMetadata.State
State of the job.
Protobuf enum google.cloud.translation.v3.BatchTranslateMetadata.State
CreateGlossaryMetadata.State
Enumerates the possible states that the creation request can be in.
Protobuf enum google.cloud.translation.v3.CreateGlossaryMetadata.State
DeleteGlossaryMetadata.State
Enumerates the possible states that the creation request can be in.
Protobuf enum google.cloud.translation.v3.DeleteGlossaryMetadata.State