Overview
This node provides AI-powered translation services with cultural adaptation, specifically for files when using the "File" resource and "Translate" operation. It translates file content from a source language (auto-detected if not provided) into a specified target language. The node supports various file types such as JSON, YAML, XML, CSV, text formats, PDF, and Word documents.
Common scenarios include:
- Translating documentation files or configuration files to different languages.
- Localizing marketing materials or product descriptions stored in files.
- Automatically translating user-generated content files for global audiences.
Practical example:
- You have a JSON configuration file in English that you want to translate into Spanish while preserving the JSON structure. This node can take the binary file data or raw text content, send it to the translation service, and return the translated file in the desired format.
Properties
| Name | Meaning |
|---|---|
| Target Language | The language code to translate the file content into. Options are dynamically loaded from supported languages (e.g., Spanish, French, German). |
| Input Source | Specifies whether the file content is provided as binary data from a previous node or as raw text content. Options: "Binary Data", "Text Content". |
| Binary Property | The name of the binary property containing the file data when "Input Source" is set to "binary". Default is "data". |
| File Content | The raw text content of the file to translate when "Input Source" is set to "text". |
| File Type | The type/format of the file to translate. Options include: Auto-detect, JSON, YAML, XML, CSV, Text, Markdown, HTML, Properties, PDF, Word (DOCX). |
| Additional Options | A collection of optional parameters to customize the translation: |
| - Target Audience | The intended audience style for the translation. Options: General, Technical, Casual, Formal. |
| - Industry | The industry context to tailor specialized terminology. Options: Technology, Healthcare, Finance, Education, Legal, Marketing, E-commerce. |
| - Source Language | The source language code of the file content. If omitted, auto-detection is used. |
| - Region | Specific region/localization variant (e.g., Spain, Mexico, Brazil). |
| - Translation Notes | Additional instructions or context for the translation (e.g., keep technical terms in English, use formal tone). |
| - Preserve Keys | Whether to preserve keys/structure for structured files like JSON or YAML. Boolean, default true. |
| - Output Format | The output format of the translated file. Options: Same as Input, JSON, YAML, Text. |
Output
The node outputs a JSON object representing the translation result. For the "File" resource and "Translate" operation, the output JSON typically contains the translated file content or metadata returned by the translation API.
If the input was binary data, the node sends the file as multipart form-data and receives the translated file content accordingly. The output JSON will contain the translated file data or a reference to it.
The exact structure depends on the API response but generally includes fields like:
translatedTextor equivalent holding the translated content.- Possibly metadata about the translation or file.
Binary data output is handled internally by n8n helpers and is not explicitly detailed here.
Dependencies
- Requires an API key credential for the external AI-powered translation service.
- The node communicates with the translation API endpoint at
https://api.i18nagent.aior a custom URL if configured. - Uses HTTP POST requests with either JSON body or multipart form-data depending on input source.
- Requires n8n environment to have internet access to reach the translation API.
Troubleshooting
Common issues:
- Incorrect or missing API credentials will cause authentication failures.
- Providing an unsupported file type or corrupted binary data may lead to translation errors.
- Network connectivity problems can prevent reaching the translation API.
- Omitting required parameters like target language or file content will cause validation errors.
Error messages:
- Authentication errors: Check that the API key credential is correctly configured and valid.
- Validation errors: Ensure all required properties (target language, file content or binary property) are properly set.
- API request failures: Verify network connectivity and that the API endpoint URL is correct.
- Parsing errors: When using text input, ensure the file content matches the declared file type.
To resolve errors, verify input parameters, credentials, and network settings. Use the node's "Continue On Fail" option to handle individual item errors gracefully.
Links and References
- i18n Agent API Documentation (hypothetical link)
- n8n Documentation on Creating Custom Nodes
- Common language codes reference: ISO 639-1 Codes