Google Translate Chunked
Write Your Prompts in Your Own Language — This Node Handles the Long Ones
- translated_text
The text encoder in most models only truly speaks English, and if you think in another language you've felt it: you either write approximate English or type your real prompt and watch the sampler ignore half of it. This node is the in-between. Drop your text in any language in, get a proper English translation out, and feed that to your CLIP encode node. And it does the one thing every naive translate node botches: long prompts.
The whole trick is in the name. The googletrans library underneath it (the free, unofficial Google Translate endpoint - no API key, no account) gives out around 5000 characters per call before it starts truncating or erroring. Most translation nodes just call it once and silently lose your tail. This one splits your text into chunks under that limit, translates each, and stitches them back together.
How it works
Check the code and the logic is refreshingly honest. If your text fits in the chunk size, it translates it whole. Longer text gets split at sentence boundaries (. , ! , ? , line breaks), falling back to the last space, and only hard-cutting mid-word as a last resort. Each chunk is translated sequentially, logged to the console as it goes ([GoogleTranslateChunked] Translating chunk 2/3 (4998 chars)...), then joined back into one string. If a chunk fails - and the unofficial API does fail - it keeps the original text for that chunk and keeps going, so you get a partial translation and a console message instead of a dead workflow.
The inputs that matter
- text - the multiline box for whatever you want translated.
- from_translate - source language, default
auto. Leave it; it detects. - to_translate - target, default
en. The dropdown actually carries the full googletrans language list, so yes, it's more than the two or three the schema sample shows. - manual_translate - the one that'll trip you. The name reads like "translate by hand," but
truemeans skip translation entirely and pass the text through untouched. Handy when you've already got the English and don't want a redundant API call. - chunk_size - default 4999, and that's the Google-friendly ceiling. You can crank it to 10000 in the widget, but past ~5k the unofficial endpoint tends to push back.
Output: a single translated_text (STRING). Wire it into the prompt input of a CLIP Text Encode node - right-click the prompt field and "Convert widget to input" - or into any text consumer.
Installing it
ComfyUI Manager: search "GoogleTranslate Chunked" and install. Or do it by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/SergPoletaev/ComfyUI-GoogleTranslate-Chunked
Restart ComfyUI, then install the one real dependency:
pip install googletrans==4.0.0-rc1
or, if you run ComfyUI's embedded Python: cd ComfyUI/python_embeded && python -m pip install googletrans==4.0.0-rc1. Note the repo has no requirements.txt, so nothing auto-installs - you do this step yourself or the node will greet you with "googletrans not installed." No models to download, no GPU needed. If you'd rather pay for reliability, setting the GOOGLE_TRANSLATION_API_KEY env var switches it to Google's official Cloud Translation API.
Where people get burned
Mostly it's the free endpoint's personality. Google changes its token scheme, googletrans versions go stale, and long multi-chunk runs can get rate-limited - the README says as much: wait a few minutes and retry. When that happens the node logs the error and leaves the original chunk text in place, so check the console if your output comes back half-English, half-Russian. Keep chunk_size near the default and don't expect the free tier to be as reliable as a paid API. For a no-key, no-signup way to get decent prompts out of your native language, it's hard to beat.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — | |
| from_translate | COMBO | auto | 3 options: auto, en, ru |
| to_translate | COMBO | en | 2 options: en, ru |
| manual_translateopt | BOOLEAN | false | — |
| chunk_sizeopt | INT | 4999100–10000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| translated_text | STRING | — |