Google Translate
  • 17 Oct 2023
  • 2 Minutes to read
  • Dark
    Light

Google Translate

  • Dark
    Light

Article summary

This Accelerator serves as a solution for automating translations. Seamlessly integrating the Cloud Translation API empowers users to manage and maintain multilingual content effortlessly, enhancing the accessibility and user experience of the application or platform. Through its automated translation capabilities, this project significantly reduces the time and effort required for manual translation tasks.

Prerequisites

Google Cloud Setup

  • Enable Cloud Translate API: To enable the seamless functioning of the scheduled job, ensure that the Cloud Translate API is activated for the project within the Google Cloud platform.
  • OAuth Credentials: Establish the OAuth credentials to generate the required OAuth access token and refresh the token successfully within the Google Cloud platform.
  • Domain Registration: The domain associated with the user's Decisions environment must be registered within the Google Cloud environment to ensure smooth authentication and access to the required translation services.
  • Language Support Limitations: The Cloud Translate API may not support all languages. It is essential to consult the Cloud Translation documentation site to determine the list of languages supported by the API, ensuring that the translation of all necessary languages is feasible within the project scope.

Decisions Setup

  • OAuth 2.0 Configuration: Generating OAuth 2.0 authorization credentials is imperative before deploying the scheduled job. This process involves setting up an OAuth provider and obtaining a token specifically for the Google Translate service.
    • The OAuth Token must be named 'GoogleTranslate' as one of the Flows relies on this specific name to locate and utilize the token.
  • Added Language Folders for the desired languages to translate strings to.
Resources
For a comprehensive guide that delves into the aspects outlined above, refer to the following linked article detailing the setup process for a different Google API. While the article specifically covers the Google Drive Module, the information provided covers the setup of Google Cloud and Decisions integration.

What's Included

Below is a list of items included in the Application.

Data Structures

  • JSONDataStructures:
    • GoogleTranslateResponse
    • SupportedLanguagesResponse
  • Simple Flow Structures:
    • Data
    • GoogleTokenReturn
    • GoogleTranslateResponse
    • Language
    • SupportedLanguagesResponse
    • Translation

Flows

Folder

  • Google Translate REST Service
    • Advanced Translate Test Method
    • Get Supported Languages Method
    • Refresh OAuth Token Method
    • Translate Text Method

Truth Table

  • Language to ISO-639 Code

Main Translation Flow [Primary Flow]

This Flow is intended to be set up as a scheduled job, customized to operate as frequently as necessary for the business's specific needs. It is advised to schedule the job to run nightly.

This Flow obtains any untranslated strings for a Language and pushes them to the Cloud Translation API. The resulting translation will be stored in the Language Translation type. The "Google Translated" tag will be added to distinguish it from manual translations provided by the user.

In the .gif provided below, the right-hand side displays a Decisions instance featuring an open Japanese Language Folder, which lacks any available translated strings. On the left-hand side, the Main Translation Flow is manually initiated, and notifications indicate the start and completion of this Flow. As a result, the Language Folder refreshes, now containing the newly available translated strings. To distinguish the strings that have been translated using the Cloud Translation API, the project adds a specific tag, "Google Translated," to the translated strings. This feature aids in identifying which strings have been automatically translated, allowing developers or administrators to differentiate between manually and automatically translated content.


Refresh Google Translate OAuth Token Flow

This Flow will refresh the OAuth token and update the token with the refreshed information. 

This Flow must be set up as a scheduled job and should be configured to run prior to the Main Translation Flow Scheduled Job.


Was this article helpful?