Nodes/ComfyUI_zfkun/Text Translation ๐Ÿ•๐Ÿ…ฉ๐Ÿ…•
ComfyUI Node

Text Translation ๐Ÿ•๐Ÿ…ฉ๐Ÿ…•

Translate your prompt without leaving the graph

By zfkunยทCreated 3 years agoยทUpdated 6 months agoยท 23
Text Translation ๐Ÿ•๐Ÿ…ฉ๐Ÿ…•
    • text
    • platform
    • source
    • target
    โ—„textโ€”โ–บ
    โ—„platformbaiduโ–บ
    โ—„sourceautoโ–บ
    โ—„targetenโ–บ

    Most diffusion checkpoints were trained on English captions, which is a problem if you think in Chinese, Japanese, or anything else and keep bouncing out to a browser tab to translate your prompt before pasting it back in. Text Translation puts that step inside the graph: type your prompt in whatever language you actually think in, wire the output straight into your CLIP Text Encode, and skip the tab-switching.

    How it works

    It's a thin wrapper around a handful of translation backends - you pick one, it calls out, you get text back. Nothing fancy happening in the node itself; all the actual translation logic lives on whichever platform you choose.

    The inputs and outputs that matter

    Four required fields, and you'll only ever touch three of them per run:

    • text - the multiline string you want translated. This is the one you're actually typing into.
    • platform - which backend does the work. Choices are baidu, alibaba, tencent, volcengine, niutrans, bigmodel, and siliconflow. The first five are Chinese cloud translation APIs (the kind of service you'd know if you've used the "Bob Translate" macOS tool, which is where this node's platform list comes straight from); the last two are LLM-backed and each ship a free default model - bigmodel defaults to glm-4-flash, siliconflow defaults to Qwen/Qwen2.5-7B-Instruct. If you don't want to set up API credentials for a dedicated translation service, those two are your easiest on-ramp.
    • source - source language, defaults to auto-detect. Leave it unless auto-detect is guessing wrong.
    • target - defaults to en, which is what you want for most checkpoints.

    Output is four strings: the translated text (the one you'll actually wire onward), plus platform, source, and target echoed back - handy if you're logging what a run used or branching logic downstream on which backend fired.

    How to install it

    Easiest path is ComfyUI Manager - search "ComfyUI_zfkun" and install. Manually:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/zfkun/ComfyUI_zfkun
    pip install -r requirements.txt
    

    (if ComfyUI runs in a venv, point at that venv's pip instead of system). Restart ComfyUI either way.

    Then, specifically for this node, there's one extra step the other nodes in this pack don't need: copy config.yaml.example to config.yaml inside the pack's folder, set the translator field to your chosen platform (and its API key, if the platform needs one), save it as UTF-8, and restart ComfyUI again. The five cloud-API platforms need real credentials in that file; the two AI-model platforms work out of the box on their free-tier models with no key at all.

    Common issues & troubleshooting

    Node loads but translation silently fails or errors on first use. Nine times out of ten this is config.yaml - either it doesn't exist yet (you're still on the .example file), or it exists but you didn't restart after editing it. ComfyUI reads that config at startup, not per-request.

    Garbled output or the node refuses to load the config at all. The README calls this out specifically: config.yaml has to be saved as UTF-8. If your editor defaulted to a different encoding (common on Windows), re-save it explicitly as UTF-8.

    You picked a cloud platform (baidu, alibaba, etc.) and nothing happens. Those five need real API credentials configured for that specific platform in config.yaml - they're not free-to-use out of the box the way the two AI-model platforms are. If you just want something that works immediately without hunting down API keys, switch platform to bigmodel or siliconflow and leave the config on its default free model.

    Translation quality is mediocre for anything nuanced. These are general-purpose translation backends, not prompt-aware ones - they'll translate your sentence correctly but won't necessarily preserve Danbooru-style tag phrasing or artist-name conventions. For straightforward natural-language prompts it's fine; for a wall of comma-separated tags, sanity-check the output before you commit to a long render.

    Categoryzfkun ๐Ÿ•๐Ÿ…ฉ๐Ÿ…•

    Inputs (4)

    NameTypeDefaultDescription
    textSTRINGOriginal text content to be translated
    platformCOMBObaiduTranslation platform to be used
    sourceCOMBOautoSource language of the text to be translated
    targetCOMBOenTarget language into which the text is to be translated

    Outputs (4)

    NameTypeDescription
    textSTRINGโ€”
    platformSTRINGโ€”
    sourceSTRINGโ€”
    targetSTRINGโ€”