String Translate
Free Google translation inside your graph, no API key — until it breaks
- string
The FairLab String Translate node runs text through Google Translate - the free web endpoint, not the paid API - and hands you the translation as a STRING you can pipe straight into a CLIP encode. No API key, no account, no billing page. The name is not a lie; it genuinely calls Google's free service and needs nothing from you but an internet connection.
The name of the game is "translate your prompt before the sampler sees it," or the inverse: take a model whose training data is heavily English (or heavily Japanese, for the danbooru-style tag models) and rewrite your prompt into the language it understands best. It's also the node LoRA trainers want when their dataset captions are in one language and they need them in another - the exact use case the community keeps re-implementing by hand in standalone scripts.
How it works
It's googletrans, the Python library that wraps the free Google Translate endpoint, run asynchronously. There's a subtlety the author handled properly: ComfyUI runs its own event loop, and asyncio.run() refuses to run inside an existing loop. The node catches that RuntimeError and falls back to nest_asyncio to patch the loop so the translation can actually complete. That's why nest_asyncio is in the pack's requirements - it's load-bearing for this node.
The inputs that matter
- string - the text to translate, multiline.
- src - source language, a dropdown of 245 language codes, defaulting to
zh. - dest - target language, defaulting to
en.
The defaults tell you something about the author: the pack is bilingual (the README ships a Chinese version), and zh → en is the built-in assumption. Change them per-node as needed. The codes are the standard googletrans 2–3 letter codes - en, zh, ja, de, es… - and the dropdown is populated from the library itself.
The single output is the translated string, ready to wire into a CLIP Text Encode or a Show String for verification.
The honest troubleshooting section
This node is free, and "free" here means "fragile." googletrans is a well-known bit of plumbing that has broken multiple times when Google quietly changed its endpoint, and it's the first thing to suspect when the node fails:
- Update the library. The README's own advice:
pip install --upgrade googletrans. A stale version is the most common cause of an abrupt failure. - You need outbound network. It's a live web call to Google. Offline boxes, strict firewalls, or a flaky connection will fail or time out. There's no local model here.
- Rate limits exist. The free endpoint isn't a promise; hammering it from a big batch can get you throttled, and errors may look like "node failed" rather than "translate is mad at us."
- It's not a quality oracle. For short prompts it's fine. For long, idiom-heavy prose, expect Google-grade translation - fine, not literature.
If you need deterministic, offline, high-quality translation (for example, Japanese tag prompts), this free endpoint is the wrong tool and you'd be better served by a local LLM node in the ecosystem. If you need "get my prompt into English without leaving the graph," this does the job.
Installing it
cd ComfyUI/custom_nodes
git clone https://github.com/yanhuifair/ComfyUI-FairLab.git
cd ComfyUI-FairLab
pip install -r requirements.txt
Restart ComfyUI, or search "ComfyUI-FairLab" in Manager. This is one of the few FairLab nodes that actually pulls a non-trivial dependency - googletrans plus nest_asyncio - so if you did a manual install and skipped the requirements step, this node (and only this node) will fail to import. Verify with pip list | grep googletrans.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| string | STRING | — | |
| src | COMBO | zh | 245 options: abk, ace, ach, aar, af, sq, +239 |
| dest | COMBO | en | 245 options: abk, ace, ach, aar, af, sq, +239 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| string | STRING | — |