Nodes/ComfyUI-Bada-Utils/⚓ Bada Google Translator
ComfyUI Node

⚓ Bada Google Translator

Google Translate inside your graph — no API key, no pip install

By bada-ya·Created 15 days ago·Updated about 20 hours ago· 1
⚓ Bada Google Translator
    • text
    text
    from_langko
    to_langen
    preserve_quotestrue

    The pitch, minus the marketing

    You think in Korean, Japanese, Chinese, or just your own language, and the checkpoint wants English. So you alt-tab to Google Translate, paste, copy back, paste into the text box - every single prompt. That loop is stupid, and this node deletes it.

    BadaGoogleTranslator sits on the canvas, takes a STRING, and returns a STRING. You wire its output into your CLIPTextEncode (right-click the text widget → Convert widget to input) and now your Korean text box feeds the encoder through English. That's the whole idea; it's the same plumbing role as a PrimitiveString, except the string comes back translated (comfyui-node-plumbing.md § Primitive and value nodes).

    Two things the name implies that aren't true. It doesn't use the paid Google Cloud Translation API, and it needs no key, no billing account, no sign-up. It also doesn't need anything installed beyond the pack itself.

    How it actually works

    Open nodes/bada_google_translator.py and read it - that's about 150 lines of Python standard library, urllib and json and re, nothing else (external-api-nodes.md is about nodes that carry a paid credential and phone home; this is the other kind, and being auditable in a minute is genuinely rare in that category).

    It hits the same undocumented endpoint the Chrome translation extension uses - translate.googleapis.com/translate_a/single with client=dict-chrome-ex, plus convincing Chrome 124 headers. That client gets a friendlier quota than the plain gtx client everyone's scraper uses, which is the real reason it survives where naive wrappers get 429 Too Many Requests.

    Four request strategies, tried in order: the Chrome-extension client, then the clients5.google.com endpoint (flat ["chunk", ...] array instead of the nested shape - the parser handles both), then gtx twice on two different hosts. Ten-second timeout each, so a fully-blocked network stalls your queue for up to forty seconds before giving up.

    preserve_quotes works by substitution: anything in double quotes gets swapped for a __PRESERVED_0__ placeholder, the rest is sent, then placeholders are restored verbatim. That protects LoRA trigger words and artist names from Google's habit of helpfully localizing proper nouns.

    The four fields

    • text - multiline box, your source string.
    • from_lang - ko, auto, en, ja, zh-CN. Default ko. If you're unsure, auto; passing a wrong source language produces confidently wrong English.
    • to_lang - en, ko, ja, zh-CN. Default en.
    • preserve_quotes - leave this true.

    Output is a single STRING named text. Note what's missing: no Russian, Spanish, German, French, Portuguese, or anything else. The author built this for a Korean-speaking audience and the language table is exactly that. Need another language? This node can't help.

    Also in the source: if from_lang and to_lang match, it returns your text untouched without a request, and empty input returns empty. Cheap and sane.

    Installing it

    Manager → search ComfyUI-Bada-Utils → Install → restart → Ctrl+F5 in the browser. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/bada-ya/ComfyUI-Bada-Utils.git
    

    Windows users can also double-click install_junction.bat in the repo root, which junctions the folder into custom_nodes.

    About "zero dependency": true for this node, not for the pack. requirements.txt lists aiohttp>=3.8.0 and Pillow>=9.0.0 for the Gemini and Regional Prompt modules, and pip will pull them in. Harmless - just don't be surprised by a pip step.

    One pack-wide caveat that bites every module: leave Nodes 2.0 disabled (⚙️ Settings → Use New Nodes 2.0 → off). Bada Utils is frontend-heavy, in the same family as rgthree, and the Nodes 2.0 rewrite broke exactly that class of widget customisation (kg/entities/rgthree-comfy.json).

    Where people get burned

    Silent failure is the big one. If all four endpoints fail - Google blocked on your network, DNS trouble, a mandatory corporate proxy - the node logs to console and returns your original text unchanged. No error, no red border, no aborted queue. You get a clean render with the Korean prompt interpreted as noise, and you'll blame the checkpoint. Two-minute check that the endpoint is reachable at all:

    python -c "import urllib.request,json;u='https://translate.googleapis.com/translate_a/single?client=dict-chrome-ex&sl=en&tl=ko&dt=t&q=hello';print(json.load(urllib.request.urlopen(u)))"
    

    Related: the source builds its opener with ProxyHandler({}), deliberately ignoring system proxy settings so a broken local proxy doesn't poison requests. If your only route to the internet is a proxy, this node will fail and there's no setting to fix it.

    Quoting a whole sentence swallows it. preserve_quotes is per-quoted-chunk, so "the woman is wearing a red coat" in quotes passes through untranslated and lands in your CLIP encoder as Korean text. Quote the tag, not the sentence.

    Hammering it will get you rate-limited eventually. Four endpoints is headroom, not immunity. Looping this over a few hundred captions is how you find the wall.

    And a softer one worth internalising. Translation gets you off the blank page; it does not convert your language into the vocabulary your model wants. A tag-trained checkpoint (SDXL finetunes, Illustrious, Pony) responds to English Danbooru-style tags, and a fluent translated sentence is not a tag list - you'll get mushier results than the tag equivalent. On an LLM-encoded model like Z-Image or Krea 2, where the encoder reads instructions, the translated sentence is exactly right (prompt-engineering.md § Which encoder are you talking to). Same node, very different payoff, decided entirely by which checkpoint it feeds.

    And it's a network node: your prompt text leaves your machine for Google's servers. Fine for "a woman in a red coat at dusk". Less fine for anything you'd hesitate to paste into a search box.

    Category⚓ Bada Utils/Text

    Inputs (4)

    NameTypeDefaultDescription
    textSTRING
    from_langCOMBOko5 options: ko, auto, en, ja, zh-CN
    to_langCOMBOen4 options: en, ko, ja, zh-CN
    preserve_quotesBOOLEANtrue

    Outputs (1)

    NameTypeDescription
    textSTRING