Translate Text with GCP
  • 01 Nov 2023
  • 2 Minutes to read
  • Dark
    Light

Translate Text with GCP

  • Dark
    Light

Article summary

Step Details
Introduced in Version8.16.0
Last Modified in Version8.16.0
LocationIntegration > Google Cloud > Translation

The Translate Text with GCP step, powered by the Google Cloud Platform Cloud Translation API, translates text from one language to another. It is essential for processes requiring multilingual support, making it possible to cater to a global audience and expand the reach of products and services.

Prerequisites 


Properties

Language Settings

PropertyDescriptionData Type
Target LanguageThe language to which the text will be translated.---
Source LanguageThe language of the original text to be translated from.---

Settings

PropertyDescriptionData Type
JSON CredentialsThe JSON file that was set up in the Google Cloud Settings that contains the credentials required for accessing the Google Cloud Platform Translate API.---
Project IDThe unique identifier of the Google Cloud project.String
RegionThe geographical region associated with the Google Cloud project.String

Inputs

PropertyDescriptionData Type
Text to TranslateThe text that needs to be translated into the target language.String

Outputs

PropertyDescriptionData Type
Translated StringThe translated text in the target language.String
Error MessageA message indicating any errors encountered during the translation process.String


Common Errors

Token Access

This error occurs when the access token has expired and cannot be refreshed. To resolve it, refresh the access token by obtaining a new one using the appropriate authentication credentials. Ensure that the credentials provided in the JSON file are valid and have not expired. You may need to regenerate the JSON credentials and update the configuration with the new credentials.

Error Message:

Status(StatusCode="Internal", Detail="Error starting gRPC call. InvalidOperationException: The access token has expired and could not be refreshed. Errors: refresh error, refresh error, refresh error", DebugException="System.InvalidOperationException: The access token has expired and could not be refreshed. Errors: refresh error, refresh error, refresh error")

JSON Parameters

This error indicates that there was an issue creating the credentials from the JSON parameters, possibly due to an unrecognized credential type. Ensure that the JSON file contains the correct and complete credentials required for accessing the Google Cloud Platform Translate API. Double-check the format of the JSON file and verify that it matches the expected structure for the authentication process.

Exception Message

Exception Stack Trace: DecisionsFramework.Design.Flow.ErrorRunningFlowStep: Error running step Translate Text with GCP 1[TranslateTextStep] in flow [Display Steps]: Error creating credential from JSON or JSON parameters. Unrecognized credential type .
 ---> System.InvalidOperationException: Error creating credential from JSON or JSON parameters. Unrecognized credential type . at Google.Apis.Auth.OAuth2.DefaultCredentialProvider.CreateDefaultCredentialFromParameters(JsonCredentialParameters credentialParameters)
 at Google.Apis.Auth.OAuth2.DefaultCredentialProvider.CreateDefaultCredentialFromJson(String json)
 at Google.Apis.Auth.OAuth2.GoogleCredential.FromJson(String json)
 at Decisions.GoogleCloud.Translate.AbstractGoogleCloudTranslationStep.GetTranslationServiceClient(StepStartData data)
 at Decisions.GoogleCloud.Translate.TranslateTextStep.Run(StepStartData data)
 at DecisionsFramework.Design.Flow.FlowStep.RunStepInternal(String flowTrackingID, String stepTrackingID, KeyValuePairDataStructure[] stepRunDataValues, AbstractFlowTrackingData trackingData)
 at DecisionsFramework.Design.Flow.FlowStep.Start(String flowTrackingID, String stepTrackingID, FlowStateData data, AbstractFlowTrackingData trackingData, RunningStepData currentStepData)
   --- End of inner exception stack trace ---

Permissions Denied

The "PermissionDenied" error suggests that the request lacked the necessary authentication scopes. Check the scopes specified in the JSON file and ensure that they include the required permissions for accessing the Google Cloud Platform Translate API. Make sure that the service account associated with the JSON credentials has the appropriate permissions and roles assigned in the Google Cloud Console. Review the documentation for the Translate API to identify the specific scopes needed and update the JSON file accordingly.

Error Message

Status(StatusCode="PermissionDenied", Detail="Request had insufficient authentication scopes.

Related Information

Articles:
Google Cloud Module
Google Drive Module

Projects:
Google Translate
Google Places API


Was this article helpful?