Nodes/NX_Translator/♻ Translator
ComfyUI Node

♻ Translator

Prompt in your own language, generate like an English speaker

By Franck-Demongin·Created 2 years ago·Updated 2 years ago· 3
♻ Translator
    • translation
    translatorGoogle Translate
    modereplace
    sepcomma
    prompt
    text

    The name is a lie, sort of: ♻ Translator doesn't translate the prompt for you at generate time. It's a translate button with a text buffer bolted to a node, and it's aimed squarely at people who think in a language other than English. If you're one of them, this is the node that stops you from round-tripping prompts through a browser tab every time you iterate.

    Here's the thing about prompting in 2026: nearly every model you actually run - SDXL-lineage tag models, Flux's T5-XXL, the newer LLM-encoded checkpoints - was trained on English captions. The prompt-engineering notes hammer this home: the encoder decides what your prompt means, and almost all of them were fed English. You can absolutely feed them another language, but the quality ceiling is lower. This node translates anything you type into English, on demand, from two backends: Google Translate (free, no key) or DeepL (better quality, needs an API key).

    How it actually works

    This part surprises people, and it explains two of the gotchas below. The Python Nx_Translator.run() does basically nothing - it just returns whatever is sitting in the text field. All the real work lives in a frontend extension (js/Nx_Tranlator.js) and some HTTP routes the pack registers on the ComfyUI server.

    When you click the 🔀 Translate button, the node POSTs to /googletranslate or /deepltranslate on the server, and the server makes the actual network call. Google's path hits translate.googleapis.com/translate_a/single - the unofficial "gtx" endpoint that powers translate.google.com. No key, no account - just a public endpoint that's stayed up for years. DeepL's path uses their real v2 API, so it needs a token.

    A couple of implementation details worth knowing: the Google path replaces newlines with [NL] and periods with [.] before sending, then restores them after - a workaround because the gtx endpoint mangles formatting. So your multi-line prompt survives the trip, mostly. And the DeepL token lives in a .env file in the node's own folder, which you can set from the Token DeepL button. The button auto-detects free vs paid DeepL and shows your remaining quota right in its label.

    The inputs that matter

    All five are technically required, but only a couple deserve your attention:

    • prompt - what you type, in whatever language. Source language is auto-detected; output is always English.
    • text - the buffer the translated result lands in. This is also the widget that feeds the output, so watch it when you're debugging.
    • translator - Google Translate or DeepL. Pick DeepL only if you have a key; Google is the zero-setup default.
    • mode + sep - what happens when you translate again: replace the old text, append or prepend the new translation, joined by comma, space, newline, or nothing. Handy for assembling a prompt from several translated phrases.

    The single output is translation (a STRING), and that's what you wire into a CLIP Text Encode node or whatever text encoder your model uses. The node is marked as an output node, so the graph runs through it.

    Installing it

    Easiest route: ComfyUI Manager, search NX_Translator, install, restart. Or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Franck-Demongin/NX_Translator.git
    

    Then, with your ComfyUI venv activated, install its two dependencies:

    pip install -r requirements.txt   # python-dotenv, deepl
    

    Restart ComfyUI and the node appears under NX_Nodes. No model downloads, no heavy deps - this is a featherweight pack.

    Where people get burned

    • Queueing the workflow does nothing. Because the translation is button-driven, not graph-driven, you must click 🔀 Translate to populate text before you hit run. Forget, and your translation output is empty.
    • DeepL says "No token provided" or "Invalid token". You picked DeepL without a key. Switch to Google Translate, or set a token via the button.
    • Google suddenly refuses to translate. You're using an unofficial free endpoint; Google throttles and tweaks it without warning. When it happens, it's not your install - it's the free ride.
    • Translation fails even though your browser has internet. The request goes out from the ComfyUI server. If that machine is offline or behind a restrictive proxy, no amount of local connectivity helps.
    • It's unmaintained. Last commit was mid-2024. It still works because it leans on two stable endpoints, but nobody's actively fixing it. Treat it as a finished, frozen tool.

    Is it the most sophisticated way to get an English prompt? No - an LLM node or a browser tab both work. But if you iterate in your own language all day, having the translate button right next to the prompt box keeps the loop tight, and the free Google path costs you nothing. For a two-file utility that's been frozen for two years, that's a fair deal.

    CategoryNX_Nodes

    Inputs (5)

    NameTypeDefaultDescription
    translatorCOMBOGoogle Translate2 options: Google Translate, DeepL
    modeCOMBOreplace3 options: replace, append, prepend
    sepCOMBOcomma4 options: comma, space, newline, none
    promptSTRING
    textSTRING

    Outputs (1)

    NameTypeDescription
    translationSTRING