Google Translate
The Swimlane Google Translate Connector integrates with Swimlane Turbine to do the translate text from spam emails & strings found in malware analysis.
Prerequisites
This Connector requires a OAuth Client IDs.
For setting up OAuth 2.0 client ID & token - https://support.google.com/cloud/answer/6158849
Capabilities
The Swimlane Google Translate connector has the following capabilities:
- Language
- Translate
Credentials Information
When this document uses the term user account, it refers to a Google Account, or a user account managed by your identity provider and federated with workforce identity federation.
For authentication, credentials are a digital object that provide proof of identity. Passwords, PINs, and biometric data can all be used as credentials, depending on the application requirements. For example, when you log into your user account, you provide your password and satisfy any two-factor authentication requirement as proof that the account in fact belongs to you, and you are not being spoofed by a bad actor.
Tokens are sometimes referred to as credentials, but for this documentation, they are instead referred to as a digital object that proves that the caller provided proper credentials, but they are not credentials themselves.
The type of credential you need to provide depends on what you are authenticating to. The following types of credentials can be created in the Google Cloud console:
OAuth Client IDs
OAuth Client IDs are used to identify an application to Google. This is necessary when you want to access resources owned by your end users, also called three-legged OAuth (3LO). For more information about how to get and use an OAuth Client ID, see Setting up OAuth 2.0.
Authorization
Authorization Requires one of the following OAuth scopes:
https://www.googleapis.com/auth/cloud-translation https://www.googleapis.com/auth/cloud-platform For more information, see the Auth Guide - https://cloud.google.com/docs/authentication/
Notes
Google Translate API Documentation: https://cloud.google.com/translate/docs/reference/rest/v2/translate#TranslateTextResponseList https://cloud.google.com/translate/docs/reference/rest/v2/languages For setting up OAuth 2.0 client ID & token - https://support.google.com/cloud/answer/6158849 For Language Support - https://cloud.google.com/translate/docs/languages
Additional Documentation
Configurations
Google Authentication
Authenticates using Google credentials
Configuration Parameters
Parameter | Description | Type | Required |
|---|---|---|---|
credentials | Base64-encoded contents from Service Account JSON credentials file. See README for setup instructions | string | Optional |
delegate_account | Account to execute integrations under. If not specified, the integration will run as a service account. Using a Service Account will introduce limitations. See Readme | string | Optional |
client_id | The client ID for the OAuth 2.0 application. | string | Required |
client_secret | The client secret for the OAuth 2.0 application. | string | Required |
refresh_token | OAuth 2.0 refresh token used to obtain new access tokens. If using a refresh token, you must also provide a client ID and secret. | string | Required |
Actions
Language
Returns a list of supported languages for translation.
Endpoint
- URL: /language/translate/v2/languages
- Method: GET
Input
Argument Name | Type | Required | Description |
|---|---|---|---|
parameters.target | string | Optional | The target language code for the results. If specified, then the language names are returned in the name field of the response, localized in the target language. If you do not supply a target language, then the name field is omitted from the response and only the language codes are returned. |
parameters.model | string | Optional | The supported languages for a particular translation model. For Cloud Translation - Basic, the value can be nmt to return languages supported by the Neural Machine Translation (NMT) model. |
parameters.key | string | Optional | A valid API key to handle requests for this API. If you are using OAuth 2.0 service account credentials (recommended), do not supply this parameter. |
Input Example
{"parameters":{"target":"en","model":"NMT","key":"8zCDJVS"}}
Output
Parameter | Type | Description |
|---|---|---|
status_code | number | HTTP status code of the response |
data | object | Response data |
data.languages | array | Response data |
data.languages.language | string | Response data |
data.languages.name | string | Response data |
Output Example
{"status_code":200,"response_headers":{},"json_body":{"data":{"languages":[]}}}
Translate
Translates input text, returning translated text.
Endpoint
- URL: /language/translate/v2
- Method: POST
Input
Argument Name | Type | Required | Description |
|---|---|---|---|
parameters.q | string | Required | The input text to translate. Provide an array of strings to translate multiple phrases. The maximum number of strings is 128. |
parameters.target | string | Required | The language to use for translation of the input text, set to one of the language codes listed in Language Support. |
parameters.format | string | Optional | The format of the source text, in either HTML (default) or plain-text. A value of html indicates HTML and a value of text indicates plain-text. |
parameters.source | string | Optional | The language of the source text, set to one of the language codes listed in Language Support. If the source language is not specified, the API will attempt to detect the source language automatically and return it within the response. |
parameters.model | string | Optional | The translation model. Cloud Translation - Basic offers only the nmt Neural Machine Translation (NMT) model. If the model is base, the request is translated by using the NMT model. |
parameters.key | string | Optional | A valid API key to handle requests for this API. If you are using OAuth 2.0 service account credentials (recommended), do not supply this parameter. |
Input Example
{"parameters":{"q":"abc","target":"en","format":"text","source":"en","model":"NMT","key":"8zCDJVS"}}
Output
Parameter | Type | Description |
|---|---|---|
status_code | number | HTTP status code of the response |
data | object | Response data |
data.translations | array | Response data |
data.translations.detectedSourceLanguage | string | Response data |
data.translations.model | string | Response data |
data.translations.translatedText | string | Response data |
Output Example
{"status_code":200,"response_headers":{},"json_body":{"data":{"translations":[]}}}
Response Headers
Header | Description | Example |
|---|---|---|
Content-Type | The media type of the resource | application/json |
Date | The date and time at which the message was originated | Thu, 01 Jan 2024 00:00:00 GMT |