File Translator Plugin
Translate common Office documents inside Dify while keeping layout, fonts, and basic styling intact.
Overview
The plugin wraps several file translators (TXT / DOCX / XLSX / PPTX). Each tool downloads the source file, streams text to an LLM in token-aware batches, then writes the translated content back to a copy of the original document.
Provided Tools
All tools expose the same parameter set; only the output format changes.
Features
- Structure-aware rewriting keeps paragraphs, bullet points, and table cells aligned.
- Automatic batching with retry and fallback ensures long documents are covered, even when a chunk exceeds the model’s token limit.
- Uses whatever LLM configuration you supply through Dify (temperature, model name, max tokens, etc.).
- Generates predictable filenames such as .
Installation
- Package the plugin:
- Upload the generated in Dify’s Plugin Management console.
- Enable the tools you need for your App/Workflow.
No extra environment variables or API keys are required beyond the LLM credentials already configured in Dify.
Usage
- In a workflow node (or tool call), select one of the translators.
- Supply the required parameters:
- Collect the response:
- A binary blob message containing the translated document.
- A text summary confirming completion.
Output
- File MIME type matches the input format (, , , ).
- Original filename is preserved with appended before the extension.
- When the source has no translatable content, the original file is returned unchanged with an informational message.
Requirements
The plugin’s runtime depends on:
These are pulled automatically during packaging/execution.
Notes & Limitations
- Excel support requires . Legacy files should be converted first.
- Formatting is preserved at run/cell level; complex scripting, animations, or embedded objects are not modified.
- If the LLM fails to translate a line after backoff retries, the original text is left in place to avoid data loss.
- PPT translation now splits oversized chunks recursively so every slide receives an attempt even when token limits are tight.
Development
To run the plugin locally for debugging:
Ensure is configured with your Dify remote debugging credentials (see for details).
License
Distributed under the MIT License. See for full text.