public class AmazonTranslateClient extends AmazonWebServiceClient implements AmazonTranslate
Provides translation between one source language and another of the same set of languages.
Modifier and Type | Field and Description |
---|---|
protected List<com.amazonaws.transform.JsonErrorUnmarshaller> |
jsonErrorUnmarshallers
List of exception unmarshallers for all Amazon Translate exceptions.
|
client, clientConfiguration, endpoint, endpointPrefix, LOGGING_AWS_REQUEST_METRIC, requestHandler2s, timeOffset
Constructor and Description |
---|
AmazonTranslateClient()
Deprecated.
|
AmazonTranslateClient(AWSCredentials awsCredentials)
Constructs a new client to invoke service methods on AmazonTranslate
using the specified AWS account credentials.
|
AmazonTranslateClient(AWSCredentials awsCredentials,
ClientConfiguration clientConfiguration)
Constructs a new client to invoke service methods on AmazonTranslate
using the specified AWS account credentials and client configuration
options.
|
AmazonTranslateClient(AWSCredentialsProvider awsCredentialsProvider)
Constructs a new client to invoke service methods on AmazonTranslate
using the specified AWS account credentials provider.
|
AmazonTranslateClient(AWSCredentialsProvider awsCredentialsProvider,
ClientConfiguration clientConfiguration)
Constructs a new client to invoke service methods on AmazonTranslate
using the specified AWS account credentials provider and client
configuration options.
|
AmazonTranslateClient(AWSCredentialsProvider awsCredentialsProvider,
ClientConfiguration clientConfiguration,
HttpClient httpClient)
Constructs a new client to invoke service methods on AmazonTranslate
using the specified AWS account credentials provider, client
configuration options and request metric collector.
|
AmazonTranslateClient(AWSCredentialsProvider awsCredentialsProvider,
ClientConfiguration clientConfiguration,
RequestMetricCollector requestMetricCollector)
Deprecated.
|
AmazonTranslateClient(ClientConfiguration clientConfiguration)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
deleteTerminology(DeleteTerminologyRequest deleteTerminologyRequest)
A synchronous action that deletes a custom terminology.
|
ResponseMetadata |
getCachedResponseMetadata(AmazonWebServiceRequest request)
Deprecated.
ResponseMetadata cache can hold up to 50 requests and
responses in memory and will cause memory issue. This method
now always returns null.
|
GetTerminologyResult |
getTerminology(GetTerminologyRequest getTerminologyRequest)
Retrieves a custom terminology.
|
ImportTerminologyResult |
importTerminology(ImportTerminologyRequest importTerminologyRequest)
Creates or updates a custom terminology, depending on whether or not one
already exists for the given terminology name.
|
ListTerminologiesResult |
listTerminologies(ListTerminologiesRequest listTerminologiesRequest)
Provides a list of custom terminologies associated with your account.
|
TranslateTextResult |
translateText(TranslateTextRequest translateTextRequest)
Translates input text from the source language to the target language.
|
addRequestHandler, addRequestHandler, configSigner, configSigner, createExecutionContext, createExecutionContext, createExecutionContext, endClientExecution, endClientExecution, findRequestMetricCollector, getEndpoint, getEndpointPrefix, getRegions, getRequestMetricsCollector, getServiceAbbreviation, getServiceName, getServiceNameIntern, getSigner, getSignerByURI, getSignerRegionOverride, getTimeOffset, isProfilingEnabled, isRequestMetricsEnabled, removeRequestHandler, removeRequestHandler, requestMetricCollector, setConfiguration, setEndpoint, setEndpoint, setRegion, setServiceNameIntern, setSignerRegionOverride, setTimeOffset, shutdown, withTimeOffset
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
setEndpoint, setRegion, shutdown
protected List<com.amazonaws.transform.JsonErrorUnmarshaller> jsonErrorUnmarshallers
@Deprecated public AmazonTranslateClient()
All service calls made using this new client object are blocking, and will not return until the service call completes.
DefaultAWSCredentialsProviderChain
@Deprecated public AmazonTranslateClient(ClientConfiguration clientConfiguration)
All service calls made using this new client object are blocking, and will not return until the service call completes.
clientConfiguration
- The client configuration options controlling
how this client connects to AmazonTranslate (ex: proxy
settings, retry counts, etc.).DefaultAWSCredentialsProviderChain
public AmazonTranslateClient(AWSCredentials awsCredentials)
The client requests are authenticated using the AWSCredentials
provided in this constructor. Static AWSCredentials can be passed for
quick testing. However, it is strongly recommended to use Amazon Cognito
vended temporary credentials for use in production. This can be achieved
by using AWSMobileClient
. Please see
https://aws-amplify.github.io/docs/android/authentication for
instructions on how to enable AWSMobileClient
.
AWSMobileClient.getInstance().initialize(getApplicationContext(), new Callback<UserStateDetails>() { @Override public void onResult(final UserStateDetails details) { AmazonTranslateClient client = new AmazonTranslateClient(AWSMobileClient.getInstance()); } @Override public void onError(final Exception e) { e.printStackTrace(); } });
All service calls made using this new client object are blocking, and will not return until the service call completes.
awsCredentials
- The AWS credentials (access key ID and secret key)
to use when authenticating with AWS services.public AmazonTranslateClient(AWSCredentials awsCredentials, ClientConfiguration clientConfiguration)
The client requests are authenticated using the AWSCredentials
provided in this constructor. Static AWSCredentials can be passed for
quick testing. However, it is strongly recommended to use Amazon Cognito
vended temporary credentials for use in production. This can be achieved
by using AWSMobileClient
. Please see
https://aws-amplify.github.io/docs/android/authentication for
instructions on how to enable AWSMobileClient
.
AWSMobileClient.getInstance().initialize(getApplicationContext(), new Callback<UserStateDetails>() { @Override public void onResult(final UserStateDetails details) { AmazonTranslateClient client = new AmazonTranslateClient(AWSMobileClient.getInstance()); } @Override public void onError(final Exception e) { e.printStackTrace(); } });
All service calls made using this new client object are blocking, and will not return until the service call completes.
awsCredentials
- The AWS credentials (access key ID and secret key)
to use when authenticating with AWS services.clientConfiguration
- The client configuration options controlling
how this client connects to AmazonTranslate (ex: proxy
settings, retry counts, etc.).public AmazonTranslateClient(AWSCredentialsProvider awsCredentialsProvider)
The client requests are authenticated using the AWSCredentials
provided by the AWSCredentialsProvider
. Static AWSCredentials can
be passed for quick testing. However, it is strongly recommended to use
Amazon Cognito vended temporary credentials for use in production. This
can be achieved by using AWSMobileClient
. Please see
https://aws-amplify.github.io/docs/android/authentication for
instructions on how to enable AWSMobileClient
.
AWSMobileClient.getInstance().initialize(getApplicationContext(), new Callback<UserStateDetails>() { @Override public void onResult(final UserStateDetails details) { AmazonTranslateClient client = new AmazonTranslateClient(AWSMobileClient.getInstance()); } @Override public void onError(final Exception e) { e.printStackTrace(); } });
All service calls made using this new client object are blocking, and will not return until the service call completes.
awsCredentialsProvider
- The AWS credentials provider which will
provide credentials to authenticate requests with AWS
services.public AmazonTranslateClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration)
The client requests are authenticated using the AWSCredentials
provided by the AWSCredentialsProvider
. Static AWSCredentials can
be passed for quick testing. However, it is strongly recommended to use
Amazon Cognito vended temporary credentials for use in production. This
can be achieved by using AWSMobileClient
. Please see
https://aws-amplify.github.io/docs/android/authentication for
instructions on how to enable AWSMobileClient
.
AWSMobileClient.getInstance().initialize(getApplicationContext(), new Callback<UserStateDetails>() { @Override public void onResult(final UserStateDetails details) { AmazonTranslateClient client = new AmazonTranslateClient(AWSMobileClient.getInstance()); } @Override public void onError(final Exception e) { e.printStackTrace(); } });
All service calls made using this new client object are blocking, and will not return until the service call completes.
awsCredentialsProvider
- The AWS credentials provider which will
provide credentials to authenticate requests with AWS
services.clientConfiguration
- The client configuration options controlling
how this client connects to AmazonTranslate (ex: proxy
settings, retry counts, etc.).@Deprecated public AmazonTranslateClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration, RequestMetricCollector requestMetricCollector)
All service calls made using this new client object are blocking, and will not return until the service call completes.
awsCredentialsProvider
- The AWS credentials provider which will
provide credentials to authenticate requests with AWS
services.clientConfiguration
- The client configuration options controlling
how this client connects to AmazonTranslate (ex: proxy
settings, retry counts, etc.).requestMetricCollector
- optional request metric collectorpublic AmazonTranslateClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration, HttpClient httpClient)
The client requests are authenticated using the AWSCredentials
provided by the AWSCredentialsProvider
. Static AWSCredentials can
be passed for quick testing. However, it is strongly recommended to use
Amazon Cognito vended temporary credentials for use in production. This
can be achieved by using AWSMobileClient
. Please see
https://aws-amplify.github.io/docs/android/authentication for
instructions on how to enable AWSMobileClient
.
AWSMobileClient.getInstance().initialize(getApplicationContext(), new Callback<UserStateDetails>() { @Override public void onResult(final UserStateDetails details) { AmazonTranslateClient client = new AmazonTranslateClient(AWSMobileClient.getInstance()); } @Override public void onError(final Exception e) { e.printStackTrace(); } });
All service calls made using this new client object are blocking, and will not return until the service call completes.
awsCredentialsProvider
- The AWS credentials provider which will
provide credentials to authenticate requests with AWS
services.clientConfiguration
- The client configuration options controlling
how this client connects to AmazonTranslate (ex: proxy
settings, retry counts, etc.).httpClient
- A http clientpublic void deleteTerminology(DeleteTerminologyRequest deleteTerminologyRequest) throws AmazonServiceException, AmazonClientException
A synchronous action that deletes a custom terminology.
deleteTerminology
in interface AmazonTranslate
deleteTerminologyRequest
- ResourceNotFoundException
TooManyRequestsException
InternalServerException
AmazonClientException
- If any internal errors are encountered
inside the client while attempting to make the request or
handle the response. For example if a network connection is
not available.AmazonServiceException
- If an error response is returned by Amazon
Translate indicating either a problem with the data in the
request, or a server side issue.public GetTerminologyResult getTerminology(GetTerminologyRequest getTerminologyRequest) throws AmazonServiceException, AmazonClientException
Retrieves a custom terminology.
getTerminology
in interface AmazonTranslate
getTerminologyRequest
- ResourceNotFoundException
InvalidParameterValueException
TooManyRequestsException
InternalServerException
AmazonClientException
- If any internal errors are encountered
inside the client while attempting to make the request or
handle the response. For example if a network connection is
not available.AmazonServiceException
- If an error response is returned by Amazon
Translate indicating either a problem with the data in the
request, or a server side issue.public ImportTerminologyResult importTerminology(ImportTerminologyRequest importTerminologyRequest) throws AmazonServiceException, AmazonClientException
Creates or updates a custom terminology, depending on whether or not one already exists for the given terminology name. Importing a terminology with the same name as an existing one will merge the terminologies based on the chosen merge strategy. Currently, the only supported merge strategy is OVERWRITE, and so the imported terminology will overwrite an existing terminology of the same name.
If you import a terminology that overwrites an existing one, the new terminology take up to 10 minutes to fully propagate and be available for use in a translation due to cache policies with the DataPlane service that performs the translations.
importTerminology
in interface AmazonTranslate
importTerminologyRequest
- InvalidParameterValueException
LimitExceededException
TooManyRequestsException
InternalServerException
AmazonClientException
- If any internal errors are encountered
inside the client while attempting to make the request or
handle the response. For example if a network connection is
not available.AmazonServiceException
- If an error response is returned by Amazon
Translate indicating either a problem with the data in the
request, or a server side issue.public ListTerminologiesResult listTerminologies(ListTerminologiesRequest listTerminologiesRequest) throws AmazonServiceException, AmazonClientException
Provides a list of custom terminologies associated with your account.
listTerminologies
in interface AmazonTranslate
listTerminologiesRequest
- InvalidParameterValueException
TooManyRequestsException
InternalServerException
AmazonClientException
- If any internal errors are encountered
inside the client while attempting to make the request or
handle the response. For example if a network connection is
not available.AmazonServiceException
- If an error response is returned by Amazon
Translate indicating either a problem with the data in the
request, or a server side issue.public TranslateTextResult translateText(TranslateTextRequest translateTextRequest) throws AmazonServiceException, AmazonClientException
Translates input text from the source language to the target language. It is not necessary to use English (en) as either the source or the target language but not all language combinations are supported by Amazon Translate. For more information, see Supported Language Pairs.
Arabic (ar)
Chinese (Simplified) (zh)
Chinese (Traditional) (zh-TW)
Czech (cs)
Danish (da)
Dutch (nl)
English (en)
Finnish (fi)
French (fr)
German (de)
Hebrew (he)
Indonesian (id)
Italian (it)
Japanese (ja)
Korean (ko)
Polish (pl)
Portuguese (pt)
Russian (ru)
Spanish (es)
Swedish (sv)
Turkish (tr)
To have Amazon Translate determine the source language of your text, you
can specify auto
in the SourceLanguageCode
field. If you specify auto
, Amazon Translate will call
Amazon Comprehend to determine the source language.
translateText
in interface AmazonTranslate
translateTextRequest
- InvalidRequestException
TextSizeLimitExceededException
TooManyRequestsException
UnsupportedLanguagePairException
DetectedLanguageLowConfidenceException
ResourceNotFoundException
InternalServerException
ServiceUnavailableException
AmazonClientException
- If any internal errors are encountered
inside the client while attempting to make the request or
handle the response. For example if a network connection is
not available.AmazonServiceException
- If an error response is returned by Amazon
Translate indicating either a problem with the data in the
request, or a server side issue.@Deprecated public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest request)
Response metadata is only cached for a limited period of time, so if you need to access this extra diagnostic information for an executed request, you should use this method to retrieve it as soon as possible after executing the request.
getCachedResponseMetadata
in interface AmazonTranslate
request
- The originally executed requestCopyright © 2019. All rights reserved.