- 01 Nov 2023
- 2 Minutes to read
- Print
- DarkLight
Translate Text with GCP
- Updated on 01 Nov 2023
- 2 Minutes to read
- Print
- DarkLight
Step Details | |
Introduced in Version | 8.16.0 |
Last Modified in Version | 8.16.0 |
Location | Integration > 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
- This step requires the Google Cloud module to be installed before it will be available in the toolbox.
- Existing Google Cloud Project with the Cloud Translation API enabled.
- Configured Google Cloud Settings.
Properties
Language Settings
Property | Description | Data Type |
---|---|---|
Target Language | The language to which the text will be translated. | --- |
Source Language | The language of the original text to be translated from. | --- |
Settings
Property | Description | Data Type |
---|---|---|
JSON Credentials | The 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 ID | The unique identifier of the Google Cloud project. | String |
Region | The geographical region associated with the Google Cloud project. | String |
Inputs
Property | Description | Data Type |
---|---|---|
Text to Translate | The text that needs to be translated into the target language. | String |
Outputs
Property | Description | Data Type |
---|---|---|
Translated String | The translated text in the target language. | String |
Error Message | A 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.
Articles:
Google Cloud Module
Google Drive Module
Projects:
Google Translate
Google Places API