Documentation ¶
Overview ¶
Package translate provides the client and types for making API requests to Amazon Translate.
Provides translation between English and one of six languages, or between one of the six languages and English.
See https://docs.aws.amazon.com/goto/WebAPI/translate-2017-07-01 for more information on this service.
See translate package documentation for more information. https://docs.aws.amazon.com/sdk-for-go/api/service/translate/
Using the Client ¶
To Amazon Translate with the SDK use the New function to create a new service client. With that client you can make API requests to the service. These clients are safe to use concurrently.
See the SDK's documentation for more information on how to use the SDK. https://docs.aws.amazon.com/sdk-for-go/api/
See aws.Config documentation for more information on configuring SDK clients. https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config
See the Amazon Translate client Translate for more information on creating client for this service. https://docs.aws.amazon.com/sdk-for-go/api/service/translate/#New
Index ¶
- Constants
- type TextInput
- type TextOutput
- func (s TextOutput) GoString() string
- func (s TextOutput) SDKResponseMetadata() aws.Response
- func (s *TextOutput) SetSourceLanguageCode(v string) *TextOutput
- func (s *TextOutput) SetTargetLanguageCode(v string) *TextOutput
- func (s *TextOutput) SetTranslatedText(v string) *TextOutput
- func (s TextOutput) String() string
- type TextRequest
- type Translate
Constants ¶
const ( // ErrCodeInternalServerException for service response error code // "InternalServerException". // // An internal server error occurred. Retry your request. ErrCodeInternalServerException = "InternalServerException" // ErrCodeInvalidRequestException for service response error code // "InvalidRequestException". // // The request is invalid. ErrCodeInvalidRequestException = "InvalidRequestException" // "ServiceUnavailableException". // // Amazon Translate is unavailable. Retry your request later. ErrCodeServiceUnavailableException = "ServiceUnavailableException" // ErrCodeTextSizeLimitExceededException for service response error code // "TextSizeLimitExceededException". // // The size of the input text exceeds the length constraint for the Text field. // Try again with a shorter text. ErrCodeTextSizeLimitExceededException = "TextSizeLimitExceededException" // ErrCodeTooManyRequestsException for service response error code // "TooManyRequestsException". // // The number of requests exceeds the limit. Resubmit your request later. ErrCodeTooManyRequestsException = "TooManyRequestsException" // ErrCodeUnsupportedLanguagePairException for service response error code // "UnsupportedLanguagePairException". // // Amazon Translate cannot translate input text in the source language into // this target language. For more information, see how-to-error-msg. ErrCodeUnsupportedLanguagePairException = "UnsupportedLanguagePairException" )
const ( ServiceName = "translate" // Service endpoint prefix API calls made to. EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata. )
Service information constants
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TextInput ¶
type TextInput struct { // One of the supported language codes for the source text. If the TargetLanguageCode // is not "en", the SourceLanguageCode must be "en". // // SourceLanguageCode is a required field SourceLanguageCode *string `min:"2" type:"string" required:"true"` // One of the supported language codes for the target text. If the SourceLanguageCode // is not "en", the TargetLanguageCode must be "en". // // TargetLanguageCode is a required field TargetLanguageCode *string `min:"2" type:"string" required:"true"` // The text to translate. // // Text is a required field Text *string `min:"1" type:"string" required:"true"` // contains filtered or unexported fields }
Please also see https://docs.aws.amazon.com/goto/WebAPI/translate-2017-07-01/TextRequest
func (*TextInput) SetSourceLanguageCode ¶
SetSourceLanguageCode sets the SourceLanguageCode field's value.
func (*TextInput) SetTargetLanguageCode ¶
SetTargetLanguageCode sets the TargetLanguageCode field's value.
type TextOutput ¶
type TextOutput struct { // The language code for the language of the input text. // // SourceLanguageCode is a required field SourceLanguageCode *string `min:"2" type:"string" required:"true"` // The language code for the language of the translated text. // // TargetLanguageCode is a required field TargetLanguageCode *string `min:"2" type:"string" required:"true"` // The text translated into the target language. // // TranslatedText is a required field TranslatedText *string `min:"1" type:"string" required:"true"` // contains filtered or unexported fields }
Please also see https://docs.aws.amazon.com/goto/WebAPI/translate-2017-07-01/TextResponse
func (TextOutput) GoString ¶
func (s TextOutput) GoString() string
GoString returns the string representation
func (TextOutput) SDKResponseMetadata ¶
func (s TextOutput) SDKResponseMetadata() aws.Response
SDKResponseMetdata return sthe response metadata for the API.
func (*TextOutput) SetSourceLanguageCode ¶
func (s *TextOutput) SetSourceLanguageCode(v string) *TextOutput
SetSourceLanguageCode sets the SourceLanguageCode field's value.
func (*TextOutput) SetTargetLanguageCode ¶
func (s *TextOutput) SetTargetLanguageCode(v string) *TextOutput
SetTargetLanguageCode sets the TargetLanguageCode field's value.
func (*TextOutput) SetTranslatedText ¶
func (s *TextOutput) SetTranslatedText(v string) *TextOutput
SetTranslatedText sets the TranslatedText field's value.
func (TextOutput) String ¶
func (s TextOutput) String() string
String returns the string representation
type TextRequest ¶
TextRequest is a API request type for the Text API operation.
func (TextRequest) Send ¶
func (r TextRequest) Send() (*TextOutput, error)
Send marshals and sends the Text API request.
type Translate ¶
Translate provides the API operation methods for making requests to Amazon Translate. See this package's package overview docs for details on the service.
Translate methods are safe to use concurrently. It is not safe to modify mutate any of the struct's properties though.
func New ¶
New creates a new instance of the Translate client with a config. If additional configuration is needed for the client instance use the optional aws.Config parameter to add your extra config.
Example:
// Create a Translate client from just a config. svc := translate.New(myConfig) // Create a Translate client with additional configuration svc := translate.New(myConfig, aws.NewConfig().WithRegion("us-west-2"))
func (*Translate) TextRequest ¶
func (c *Translate) TextRequest(input *TextInput) TextRequest
TextRequest returns a request value for making API operation for Amazon Translate.
Translates input text from the source language to the target language. You can translate between English (en) and one of the following languages, or between one of the following languages and English.
Arabic (ar)
Chinese (Simplified) (zh)
French (fr)
German (de)
Portuguese (pt)
Spanish (es)
// Example sending a request using the TextRequest method. req := client.TextRequest(params) resp, err := req.Send() if err == nil { fmt.Println(resp) }
Please also see https://docs.aws.amazon.com/goto/WebAPI/translate-2017-07-01/Text
Directories ¶
Path | Synopsis |
---|---|
Package translateiface provides an interface to enable mocking the Amazon Translate service client for testing your code.
|
Package translateiface provides an interface to enable mocking the Amazon Translate service client for testing your code. |