Google Translate Integration Guide
Overview
The Google Translate integration allows your NINA workflows to connect with Google Cloud Translation API for automated text translation services. This integration enables you to translate text between different languages, detect source languages automatically, and access Google's comprehensive language support directly from your workflows.
Status
At present, our integration comprehensively supports key translation functionalities, including:
- Text Translation: Translate text from one language to another
- Language Detection: Automatically detect the source language of text
- Language Selection: Choose target and source languages from a comprehensive list
- Dynamic Language Retrieval: Access real-time list of supported languages from Google Translate
The integration provides a streamlined approach to multilingual content processing within your automation workflows.
Credential Configuration
Before using the Google Translate integration in your workflows, you need to configure credentials for authentication. The NINA platform supports three authentication methods for Google Translate:
Authentication Methods
1. API Key Authentication
The simplest method is to use a Google Translate API key:
| Field | Description | Example |
|---|---|---|
| API Key | Google Translate API key for authentication | AIzaSyC4E1Pz... |
| Auth Type | Authentication type | apiKey |
How to get your API Key:
- Go to the Google Cloud Console
- Create a new project or select an existing one
- Enable the Cloud Translation API for your project
- Navigate to "APIs & Services" > "Credentials"
- Click "Create Credentials" and select "API Key"
- Copy the generated API key
- (Optional) Restrict the API key to specific APIs and IP addresses for security
2. OAuth2 Authentication
For more advanced scenarios or when you need enhanced security:
| Field | Description | Example |
|---|---|---|
| Client ID | OAuth2 client ID | 1234567890-abc123def456.apps.googleusercontent.com |
| Client Secret | OAuth2 client secret | GOCSPX-abc123def456ghi789jkl |
| Scope | OAuth2 scope for Google Cloud Translation | https://www.googleapis.com/auth/cloud-translation |
| Auth URL | Authorization URL | https://accounts.google.com/o/oauth2/v2/auth |
| Access Token URL | Access Token URL | https://oauth2.googleapis.com/token |
| Auth Type | Authentication type | oauth2 |
How to set up OAuth2:
- Go to the Google Cloud Console
- Navigate to "APIs & Services" > "Credentials"
- Click "Create Credentials" and select "OAuth 2.0 Client IDs"
- Configure the OAuth consent screen if prompted
- Choose "Web application" as the application type
- Add authorized redirect URIs:
- For POC environment:
https://poc.zynap.com/api/v1/oauth2/callback - For Production environment:
https://platform.zynap.com/api/v1/oauth2/callback
- For POC environment:
- Note your Client ID and Client Secret
3. Service Account Authentication
For server-to-server authentication in production environments:
| Field | Description | Example |
|---|---|---|
| Service account email address | [email protected] | |
| Private Key | Service account private key | -----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAo... |
| Auth Type | Authentication type | serviceAccount |
How to set up Service Account:
- Go to the Google Cloud Console
- Navigate to "IAM & Admin" > "Service Accounts"
- Click "Create Service Account"
- Provide a name and description for the service account
- Grant the "Cloud Translation API User" role
- Create and download a JSON key file
- Extract the email and private_key fields from the JSON
Creating a Google Translate Credential
-
Navigate to the Credentials section in NINA
-
Click Add New Credential
-
Fill in the credential details:
- Name: A descriptive name (e.g., "Google Translate Production")
- Description: Optional details about the credential's purpose
- Integration Service: Select "Google Translate"
- Auth Type: Choose "apiKey", "oauth2", or "serviceAccount"
- Fill in the authentication fields based on your selected auth type
-
Click Test Connection to verify credentials
-
Click Save to store the credential
Supported Resources and Operations
The Google Translate integration supports the following resources and operations:
Language
| Operation | Description |
|---|---|
| Translate | Translates text from one language to another |
Parameter Merging
The Google Translate integration takes full advantage of NINA's parameter merging capabilities:
Parameter Sources (in order of precedence)
- Node Parameters: Parameters configured directly in the Google Translate Integration Node
- Extracted Parameters: Parameters automatically extracted from the input data
- Input Data: The complete input data from upstream nodes
When a Google Translate Integration Node executes:
- It combines parameters from all sources
- Node parameters take precedence over extracted parameters
- The combined parameters are used to execute the Google Translate operation
Dynamic Language Selection
The integration provides dynamic language selection through the getLanguages method, which retrieves the current list of supported languages from Google Translate. This ensures you always have access to the most up-to-date language options.
Language Selection Modes
1. List Mode (Dropdown Selection)
Select from a searchable dropdown of available languages:
- Real-time language list from Google Translate
- Searchable interface for quick language selection
- Display names in human-readable format
2. ID Mode (Language Code Input)
Enter language codes directly:
- Use standard language codes (e.g., 'en', 'es', 'fr', 'de')
- Suitable for automated workflows with known language codes
- Supports all ISO 639-1 language codes
Examples
Basic Text Translation
Below is an example of translating text from one language to another:
Node Configuration:
{
"resource": "language",
"operation": "translate",
"parameters": {
"text": "Hello, how are you today?",
"translateTo": {
"mode": "list",
"value": "Spanish"
},
"additionalFields": {
"detectSourceLanguage": true
}
}
}
Translation with Specific Source Language
When you know the source language and want to specify it explicitly:
Node Configuration:
{
"resource": "language",
"operation": "translate",
"parameters": {
"text": "Bonjour, comment allez-vous aujourd'hui?",
"translateTo": {
"mode": "id",
"value": "en"
},
"additionalFields": {
"detectSourceLanguage": false,
"sourceLanguage": {
"mode": "id",
"value": "fr"
}
}
}
}
Use Cases
Customer Support Automation
Automatically translate customer inquiries to your support team's language:
{
"resource": "language",
"operation": "translate",
"parameters": {
"text": "Hola, necesito ayuda con mi pedido",
"translateTo": {
"mode": "id",
"value": "en"
},
"additionalFields": {
"detectSourceLanguage": true
}
}
}
Content Localization
Translate marketing content for different regions:
{
"resource": "language",
"operation": "translate",
"parameters": {
"text": "New Product Launch - Experience the latest innovation in mobile technology",
"translateTo": {
"mode": "list",
"value": "Spanish"
},
"additionalFields": {
"detectSourceLanguage": false,
"sourceLanguage": {
"mode": "id",
"value": "en"
}
}
}
}
Multilingual Documentation
Translate documentation and help articles:
{
"resource": "language",
"operation": "translate",
"parameters": {
"text": "To reset your password, click on the 'Forgot Password' link on the login page and follow the instructions sent to your email.",
"translateTo": {
"mode": "id",
"value": "fr"
},
"additionalFields": {
"detectSourceLanguage": true
}
}
}
Best Practices
Performance Optimization
- Batch Processing: Group multiple translation requests when possible
- Language Detection: Use automatic language detection for unknown source languages
- Caching: Consider caching frequently translated content
- Rate Limiting: Be mindful of API rate limits in high-volume scenarios
Quality Considerations
- Context Awareness: Provide sufficient context for accurate translations
- Terminology: Consider using custom translation models for domain-specific content
- Review Process: Implement human review for critical translations
- Format Preservation: Be aware that formatting may be affected during translation
Security and Compliance
- Data Privacy: Ensure sensitive data is handled according to your privacy requirements
- API Key Security: Store API keys securely and rotate them regularly
- Content Filtering: Implement content filtering for inappropriate material
- Audit Logging: Log translation activities for compliance purposes
Troubleshooting
Common Issues
Authentication Errors
- Verify your API key or credentials are correct
- Check that the Cloud Translation API is enabled in your Google Cloud project
- Ensure your service account has the proper roles assigned
Translation Quality Issues
- Provide more context in the source text
- Consider specifying the source language explicitly
- Review Google's translation quality guidelines
Rate Limit Exceeded
- Implement proper rate limiting in your workflows
- Consider upgrading your Google Cloud Translation quota
- Use batch processing for multiple translations
Language Code Errors
- Verify language codes are valid ISO 639-1 codes
- Use the dynamic language list to see all supported languages
- Check for typos in manually entered language codes
Error Handling
Implement proper error handling in your workflows:
{
"error_handling": {
"on_authentication_error": "retry_with_backoff",
"on_rate_limit": "wait_and_retry",
"on_invalid_language": "log_and_skip",
"on_translation_error": "fallback_to_original"
}
}
Additional Resources
- Google Cloud Translation API Documentation
- Language Support Reference
- API Rate Limits and Quotas
- Best Practices for Translation
For additional support or questions about the Google Translate integration, consult the NINA documentation or contact your system administrator.