Nodes/AlekPet/ComfyUI_Custom_Nodes_AlekPet/Google Translate Text Node
ComfyUI Node

Google Translate Text Node

Translate any prompt into English before it hits your model

By AlekPet·Created 3 years ago·Updated 6 days ago· 1,520
Google Translate Text Node
    • text
    from_translateauto
    to_translateen
    manual_translatefalse
    text

    Most diffusion models - Flux, SDXL, Z-Image, all of them - are trained almost entirely on English captions. If you think in Russian, Spanish, Japanese, whatever, and you type your prompt straight into a text box, you're feeding the model tokens it barely learned anything about, and the output quality drops off a cliff. GoogleTranslateTextNode is the blunt fix: drop your prompt in your own language, get it back in English (or any of 100+ others), and wire that straight into the rest of your graph.

    It's a plain string in, string out node - no CLIP, no conditioning, just text. That's deliberate: it slots in before whatever text-encode node you're actually using, so it works the same whether you're on SD 1.5, SDXL, Flux, or something brand new. If you want the translate-and-encode combined into one node instead, this pack also ships GoogleTranslateCLIPTextEncodeNode, which is this node fused with a CLIP Text Encode.

    How it works

    Under the hood this uses googletrans, the free, unofficial Python wrapper that talks to Google Translate's public web endpoint - not the paid Google Cloud Translation API. That's why it's free and needs no API key, and also why it's the flakier of the translator nodes in this pack: it's scraping a web interface Google didn't design for programmatic use, so it can rate-limit you or just start erroring after Google tweaks something on their end. If it stops working outright, that's usually not your workflow - see Troubleshooting.

    The inputs and outputs that matter

    • text - your prompt, in whatever language you wrote it in. Multiline, so paste full paragraph prompts fine.
    • from_translate (default auto) - source language. Leave it on auto and it'll detect for you; there are 108 language codes available if you want to force one (useful when auto-detect guesses wrong on a short or ambiguous phrase).
    • to_translate (default en) - target language, 107 choices. You'll leave this on English almost always, but nothing stops you from translating prompt snippets between two non-English languages if that's your workflow.
    • manual_translate (default false) - a boolean toggle; leave it off unless you're specifically trying to bypass the automatic call (useful mainly for debugging what the node does when you don't want a live network hit).

    Output is a single text string - wire it into any node that takes STRING, most commonly a CLIP Text Encode.

    How to install it

    Easiest path is ComfyUI Manager: search for "ComfyUI Custom Nodes AlekPet" (or just "AlekPet") and install. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/AlekPet/ComfyUI_Custom_Nodes_AlekPet
    

    Restart ComfyUI. Per the pack's own README, each node folder pulls in its own dependencies automatically on first launch - for this one, that's googletrans. No model downloads, no GPU cost; this runs on CPU and needs an internet connection to actually reach Google's translate endpoint.

    Common issues & troubleshooting

    Nothing translates, or you get a timeout/connection error. This is almost always the node itself, not your setup - googletrans breaks periodically because it depends on an undocumented Google web endpoint that changes without notice. If Google Translate's website still works fine in your browser but this node throws errors, that's the tell. Check the pack's GitHub issues before assuming your install is broken.

    Translation quality is mediocre on slang or short phrases. Free machine translation is what it is - decent for straightforward sentences, rougher on idiom and very short fragments. If accuracy matters and you have an API key handy, DeepTranslatorTextNode in this same pack supports several other services (some paid, generally more consistent), and ChatGLM4TranslateTextNode gives you an LLM in the loop, which tends to handle nuance and slang better than either.

    You're behind a proxy or firewall that blocks Google. googletrans has no built-in proxy support in this node (that's a DeepTranslatorTextNode-only feature via its add_proxies/proxies fields). If direct access to Google is blocked, you'll want the Deep Translator or Argos Translate variant instead - Argos in particular runs fully offline once its language models are downloaded, so it doesn't care about network restrictions at all.

    CategoryAlekPet Nodes/text

    Inputs (4)

    NameTypeDefaultDescription
    from_translateCOMBOauto108 options: auto, af, sq, am, ar, hy, +102
    to_translateCOMBOen107 options: af, sq, am, ar, hy, az, +101
    manual_translateBOOLEANfalse
    textSTRING

    Outputs (1)

    NameTypeDescription
    textSTRING