Nodes/ComfyUI-Google-Translate-Plus/[cozdx1] Google Translate Plus
ComfyUI Node

[cozdx1] Google Translate Plus

Your prompt has to be English. Your brain doesn't.

By cozdx1·Created 12 days ago·Updated 8 days ago· 0
[cozdx1] Google Translate Plus
    • translated_text
    ◄source_language자동 감지 [auto]►
    ◄target_language영어 [en]►
    ◄protectionQuotes + backticks►
    ◄text►
    ◄translated_text►
    ◄translation_state►
    ◄backendGoogle►

    The problem this actually solves

    Almost every text encoder you'll load in ComfyUI was fed English. Danbooru tags are English. Flux, SDXL, Qwen-Image, the Wan prompt guides - English. So if you think in Korean, Japanese or Chinese, you're doing a translation step in your head, badly, at 1am, and then copy-pasting the result into a text box.

    The usual community answer is a local LLM rewriting your prompt (llm-in-comfyui.md covers that whole category, and it's a genuinely good answer). But a local LLM is 4–8GB of weights, a sampler's worth of VRAM, and a model with opinions about your wording. Sometimes you just want the words in English.

    That's this node: a text box, a language pair, and a translate step that runs when you hit Queue. The name says "Google Translate" and that's accurate - but the part worth caring about is that it knows not to translate everything.

    How it works, briefly

    Under the hood the Google backend calls translate.googleapis.com/translate_a/single with client=gtx - the same undocumented endpoint the browser widget uses. No API key, no Cloud project, no billing. Also no rate limit guarantee, which is the trade.

    The interesting half is protection. Before the request goes out, anything inside the delimiters you chose gets swapped for a unique token (ZXQKEEP<random>N0QXZ style), the rest is translated, and the originals are pasted back in. If Google mangles or duplicates one of those markers the node refuses the result and tells you to retry rather than silently handing you a prompt with a token in the middle of it. That's the sort of bug that quietly ruins a 200-image batch, so good on the author for guarding it.

    One rule trips people up: inside double quotes, text in (...) still gets translated. "안녕 (웃으며)" becomes "안녕 (smiling)" - dialogue stays, acting note gets localized, which is exactly what you want for video prompts. Backticks preserve everything, parens included.

    The inputs that matter

    text is your source. Type in whatever language, leave it there - the source stays editable and the translation appears in the read-only translated_text field directly below it. translated_text is also the node's only output, a plain STRING; drag from it into the text input of your CLIP Text Encode (right-click the widget → Convert widget to input first), or into a Show Text node if you just want to read it.

    source_language defaults to auto-detect, worth leaving alone. target_language defaults to English. protection defaults to Quotes + backticks; the other three modes just subtract from that. backend is optional and defaults to Google.

    The dropdown's stored value may read "자동 감지 [auto]" - that's the label, auto-detect, and display names get localized to your ComfyUI language setting. Don't go hunting for a hidden "auto" string.

    Install

    ComfyUI Manager, search "Google Translate Plus", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/cozdx1/ComfyUI-Google-Translate-Plus.git
    

    Restart ComfyUI and refresh the browser - a chunk of this node is frontend JS, so a bare restart leaves you with a stale node. No models, no dependencies for the Google path. Then search cozdx1 in the node menu.

    The optional offline mode is a different story. It's Korean → English only, and it needs ctranslate2 and sentencepiece installed in ComfyUI's Python plus a model download:

    python -m pip install "ctranslate2>=4.6,<5" "sentencepiece>=0.2,<1"
    python custom_nodes/ComfyUI-Google-Translate-Plus/install_local_model.py --models-dir models
    

    That pulls ~777MB, verifies a checksum, and converts it to an INT8 CTranslate2 model (~222MB) in models/translation/opus-mt-tc-big-ko-en-int8. On Windows portable, swap python for ..\python_embeded\python.exe. Install the pip packages first - the installer bails if CTranslate2 isn't importable.

    Where people get burned

    Nothing happens on Queue. This node isn't an output node, so if translated_text isn't wired into anything that reaches a Save or Preview, ComfyUI prunes it and it never runs. The Translate button still works, because that's a separate HTTP call from the frontend - which makes the confusion worse: preview shows text, queue produces nothing. Wire the output.

    HTTP 429. You're on a free endpoint. A batch that changes the text every iteration means a request every iteration, and Google starts refusing. The node caches by a hash of text + language pair + protection mode and reuses a valid preview on Queue, so re-running the same prompt costs nothing - unique prompts in a loop will get throttled.

    The 5,000 character limit. It errors out and tells you. It does not truncate, which is the right call and still annoying when a long video prompt is over.

    Unclosed quotes. Every " and backtick needs its partner. Unbalanced pairs are a hard error, not a "translate it anyway". Single quotes don't protect anything, so 'like this' gets translated with the rest of the sentence.

    Local mode refusing to run. If source is French and target is English, the local backend rejects the job - it only does Korean (or auto with Korean input) → English. Missing or partial model folders are also a distinct error, not a silent fallback to Google.

    And the honest caveat, straight from the README: short instructions work best. Long, clause-heavy sentences lose subjects. This is a translator, not a prompt engineer - for a prompt that needs restructuring, go back to the LLM-rewrite approach.

    Categorycozdx1/translation

    Inputs (7)

    NameTypeDefaultDescription
    source_languageCOMBO자동 감지 [auto]Language of the source text. Auto-detect identifies it automatically.
    target_languageCOMBO영어 [en]Language to translate the source text into.
    protectionCOMBOQuotes + backticksPreserve quotes and backticks. Text inside parentheses in quotes is translated.
    textSTRINGEnter the source text. Queue translates automatically; Translate previews the result before running.
    translated_textSTRINGRead-only translation result.
    translation_stateSTRING—
    backendoptCOMBOGoogleTranslation engine. Local OPUS-MT uses CPU only and supports Korean to English.

    Outputs (1)

    NameTypeDescription
    translated_textSTRING—