Nodes/ComfyUI-FailSafe-Translate-Node/Prompt Translate (Google, Fail-safe, Advanced)
ComfyUI Node

Prompt Translate (Google, Fail-safe, Advanced)

Google Translate inside your graph — without an API key, and without it killing the run

By ah-kun·Created 9 months ago·Updated about a month ago· 1
Prompt Translate (Google, Fail-safe, Advanced)
    • STRING
    text
    src_langen
    dest_lang
    fail_mode
    retries3
    retry_wait_sec1.00

    Most of the prompts that actually make good images are not in English. Japanese booru tags, Chinese model cards, a LoRA trigger word documented in French - you've either got a browser tab open or you're retyping garbage translations into CLIPTextEncode. The FailSafeTranslateAdvanced node (display name "Prompt Translate (Google, Fail-safe, Advanced)") puts a translator directly in your workflow: feed it a string, get a translated string back, wire that into your positive prompt. No API key, no account, no model download - it costs you nothing but a network call.

    Here's the honest part about why this pack exists. The translation runs through deep-translator's GoogleTranslator, which scrapes the free public translate.google.com web endpoint. That's not an official API, it's the same page you use in a browser, and it's exactly as reliable as that implies - rate limits, captchas, and upstream breakage are a real Tuesday. The entire point of this node is that it treats translation as a flaky network dependency instead of pretending otherwise. It retries, it waits, and it lets you decide what happens when everything falls over.

    What you actually set

    The node only has a handful of knobs, and only a couple matter on day one:

    • text (multiline STRING) - the prompt, tags, or text to translate.
    • src_lang - source language. Quirk alert: this one has 24 choices and no auto - the README says auto was deliberately removed, so you have to name the source or use [No Translation] to pass text through untouched.
    • dest_lang - 25 choices including auto, plus en, ja, zh-CN, zh-TW, ko, fr, de, es, it, ru and more. This is the field you'll actually change.
    • fail_mode - the interesting one, four ways to fail:
      • return_input - hand back the original text. The safe default for keeping a queue alive.
      • return_cached - return the last successful translation this node produced. Heads-up from the source: that's the most recent success, not necessarily a translation of this text. If the previous prompt was a hit, you'll silently get its translation. Read the output before trusting it.
      • return_error - return a [ERROR] ... string. Useful when you want to see it fail, but a poisoned string can end up inside your prompt if you wire it straight to CLIPTextEncode.
      • raise - stop the workflow with an error. Loud and honest, but it takes down the whole run.
    • retries (default 3, max 10) and retry_wait_sec (default 1.0, max 30) - how hard it fights the flaky endpoint before giving up.

    The output is a single STRING. That's it - one wire, and it plugs into anything that takes text: CLIPTextEncode, CLIP Text Encode (Prompt), or another text node upstream of the encoder.

    Install

    ComfyUI Manager is the easy path - search "ComfyUI-FailSafe-Translate-Node" and hit install, restart, done. Or do it by hand:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/ah-kun/ComfyUI-FailSafe-Translate-Node.git
    pip install -r requirements.txt
    

    The dependency list is exactly one package: deep-translator==1.11.4. No model files, no GPU requirement, no env vars. This is about as light as a custom node gets.

    Where people get burned

    • The endpoint flakes. If your translations randomly fail mid-run, that's the free Google endpoint, not your setup. Bump retries to 4–5 and set fail_mode to return_input so a hiccup degrades to "original prompt" instead of a dead queue. In a bigger graph this is the difference between "one weird batch" and "I lost the whole generation."
    • The cache is per-node and in-memory. If you run the same request twice on the same node, it short-circuits and returns the cached string - great for repeat runs, but it resets when ComfyUI restarts, and it's shared across nothing else.
    • Quality is Google quality. It's fine for prompts, but the community's standard advice when you care about the wording (say, for an English model card's style) is to use DeepL or an LLM instead. This node is for "good enough, in the graph," not literature.
    • Silent pollution. Any fail_mode that returns a string (all but raise) can inject an error message or a stale translation into your prompt. If your images suddenly look weird after a network hiccup, check what the node actually output.
    Categoryutils/text

    Inputs (6)

    NameTypeDefaultDescription
    textSTRING
    src_langCOMBOen24 options: en, ja, zh-CN, zh-TW, ko, fr, +18
    dest_langCOMBO25 options: auto, en, ja, zh-CN, zh-TW, ko, +19
    fail_modeCOMBO4 options: return_input, return_cached, return_error, raise
    retriesINT30–10
    retry_wait_secFLOAT1.000–30

    Outputs (1)

    NameTypeDescription
    STRINGSTRING