Google Cloud Translate

A Google API cloud based translation service. This integration was integrated and tested with version 2.0.0 of the Python Client of Google Cloud Translate API.

Use Cases

  • Translate text from spam emails
  • Translate strings found in malware analysis

Detailed Description

In order to use this integration you need the following:
  1. Select or create a Cloud Platform project on GCP
  2. Enable billing for the project
  3. Enable the Google Cloud Translate API
  4. Create a Service Account with access to Google Translate API
  5. Use the Service Account Private Key in JSON format and the GCP project ID to configure a new instance of Google Cloud Translate integration in Demisto

Create a Service Account

  1. Go to: https://console.developers.google.com
  2. Select your project
  3. From the side-menu go to IAM & admin > Service accounts > CREATE SERVICE ACCOUNT
  4. Type an account name and description and click CREATE
  5. From the drop down list Select a role select Cloud Translation API User
  6. Click CONTINUE and then click CREATE KEY
  7. Select JSON and click CREATE . The .json file downloads.

Configure GoogleCloudTranslate on Demisto

  1. Navigate to Settings > Integrations > Servers & Services .
  2. Search for GoogleCloudTranslate.
  3. Click Add instance to create and configure a new integration instance.
    • Name : a textual name for the integration instance.
    • Service Account Private Key file contents (JSON)
    • Project in Google Cloud Translate
    • Trust any certificate (not secure)
    • Use system proxy settings
  4. Click Test to validate the new instance.

Commands

You can execute these commands from the Demisto CLI, as part of an automation, or in a playbook. After you successfully execute a command, a DBot message appears in the War Room with the command details.

  1. Returns the list of supported two-letter ISO language codes: gct-supported-languages
  2. Returns the translated text: gct-translate-text

1. gct-supported-languages


Returns the list of supported two-letter ISO language codes.

Base Command

gct-supported-languages

Input
There are no input arguments for this command.

Context Output
Path Type Description
GoogleCloudTranslate.SupportedLanguages Unknown The list of supported two-letter ISO language codes.

Command Example

!gct-supported-languages

Context Example
{
    "GoogleCloudTranslate": {
        "SupportedLanguages": [
            {
                "language_code": "af",
                "support_source": true,
                "support_target": true
            },
            {
                "language_code": "am",
                "support_source": true,
                "support_target": true
            },
            {
                "language_code": "ar",
                "support_source": true,
                "support_target": true
            },
            ...
        ]
    }
}
Human Readable Output

Languages: af, am, ar, az, be, bg, bn, bs, ca, ceb, co, cs, cy, da, de, el, en, eo, es, et, eu, fa, fi, fr, fy, ga, gd, gl, gu, ha, haw, hi, hmn, hr, ht, hu, hy, id, ig, is, it, iw, ja, jw, ka, kk, km, kn, ko, ku, ky, la, lb, lo, lt, lv, mg, mi, mk, ml, mn, mr, ms, mt, my, ne, nl, no, ny, pa, pl, ps, pt, ro, ru, sd, si, sk, sl, sm, sn, so, sq, sr, st, su, sv, sw, ta, te, tg, th, tl, tr, uk, ur, uz, vi, xh, yi, yo, zh-CN, zh-TW, zu

2. gct-translate-text


Returns the translated text.

Base Command

gct-translate-text text="hello world" target="hr"

Input
Argument Name Description Required
text The text to translate. Required
target The two-letter ISO language code of the target language. Default is "en" (English). Optional
source The two-letter ISO language code of the source language. Default is "autodetect". Optional

Context Output
Path Type Description
GoogleCloudTranslate.TranslateText.ID String The ID of the request.
GoogleCloudTranslate.TranslateText.detected_language_code String The detected two-letter ISO language code of the source language. Null, if no source argument is defined.
GoogleCloudTranslate.TranslateText.source_language_code String The source language as specified in the source argument. Null, if no source argument is defined.
GoogleCloudTranslate.TranslateText.target_language_code String The two letter ISO language code to which the text was translated.
GoogleCloudTranslate.TranslateText.text String The source (original) text that was translated.
GoogleCloudTranslate.TranslateText.translated_text String The translated text.

Command Example

!gct-translate-text text="ciao" target="iw"

Context Example
{
    "GoogleCloudTranslate.TranslateText": {
        "ID": <ID>,
        "detected_language_code": "it",
        "source_language_code": null,
        "target_language_code": "iw",
        "text": "ciao",
        "translated_text": "\u05e9\u05dc\u05d5\u05dd"
    }
}
Human Readable Output

Translation: שלום
Source Language Detected: it

Additional Information

Known Limitations

The following features are not supported yet:
  • AutoML models
  • Glossaries
  • Labels
  • Batch requests
  • Multple target language codes

Troubleshooting