WorkersTools
Translate
📸 Screenshots
Here are visual examples of this section:
Translate - Worker Configuration Interface
1. Overview and Purpose
The Translate worker provides text translation capabilities using Google's Translation API. It accepts text input and a target language code, then returns the translated text. This worker requires Google Translate API credentials to function properly.
2. Configuration Parameters
This worker requires API keys to be configured in the agent parameters:
googleTranslateApiKey: Google Translate API authentication key for accessing the translation servicegoogleTranslateProjectId: Google Cloud project ID associated with the translation service
3. Input/Output Handles
input: Input handle - accepts the text content to be translatedlanguage: Input handle - accepts the target language code (e.g., "es" for Spanish, "fr" for French)output: Output handle - returns the translated textcondition: Input handle - optional condition for conditional execution
4. Usage Examples with Code
// Configure the translate worker
const translateWorker = {
type: "translate",
fields: {
input: { value: "Hello, how are you today?" },
language: { value: "es" }, // Spanish
output: { value: "" }
}
}
// The worker will output: "Hola, ¿cómo estás hoy?"5. Integration Examples
The Translate worker fits well into content localization workflows, chatbot systems that need multilingual support, or document processing pipelines where text needs to be translated into multiple languages.
6. Best Practices
- Use standard ISO 639-1 language codes for the language parameter (e.g., "en", "es", "fr", "de")
- Ensure your Google Cloud project has the Translation API enabled and proper billing configured
- Consider rate limiting when processing large volumes of text to avoid API quota issues
- Test translations with sample content to verify language code compatibility
7. Troubleshooting Tips
- Verify that both Google Translate API key and Project ID are correctly configured in your agent settings
- Check that the target language code is valid and supported by Google Translate
- If translations fail, ensure your Google Cloud project has the Translation API enabled and billing configured
- Monitor API usage to avoid exceeding quotas, especially when processing large amounts of text
