Nodes/ComfyUI-String-Helper/🐟String Translate
ComfyUI Node

🐟String Translate

The single-string translator with a hidden gotcha

By liuqianhonga·Created 2 years ago·Updated about a year ago· 13
🐟String Translate
    • string
    translate_outputfalse
    string

    🐟String Translate is the pack's "translate this one string to English" node - a single input, a toggle, one output. If that sounds like the simplest node in the world, it is. It's also the node with the most surprising behavior in the whole pack, so let's start there.

    The gotcha, up front

    I tested the actual code, and here's the thing: when translate_output is true, your string is passed straight into a translation helper that iterates its input as if it were a list. In Python, iterating a plain string yields its characters. So a multi-character string gets translated character by character - "你好世界" doesn't come back as one clean English sentence, it comes back as four separately translated characters stitched together.

    The README's example ("你好,世界""Hello, world") is aspirational, not what ships. In practice, anything beyond a single character or two produces mangled output. The node works fine as a passthrough with translate_output off, and the pack's other nodes handle real text: StringList and StringListFromCSV both have their own (working) translate toggles, and ShowTranslateString is the one that actually does batch translation with a language picker. If translation is your goal, use those.

    The honest version of the inputs

    Two required inputs: string (multiline, the text) and translate_output (boolean, default false). Output is a single string - the original when the toggle is off, the (character-by-character, mangled) translation when it's on. There's nothing else to configure, which is why the node exists: quick toggle, no dropdowns, wire it inline.

    Why it's in the pack at all

    The author's intent is clear: this is the "flip a switch and see the English version of a Chinese string" node - a convenience for reading, not a production translation pipeline. It rides the same free Bing endpoint (via the translators library) as the rest of the pack, so it needs internet, and it can fail with [翻译失败] ... or Translation error: ... strings baked into the output. Given the char-iteration issue, my honest advice: treat it as a display/debug node for short tokens, and route real text through ShowTranslateString instead.

    Installing

    ComfyUI Manager, search "ComfyUI-String-Helper", install, restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/liuqianhonga/ComfyUI-String-Helper.git
    

    The pack's dependencies are translators and chardet; this node only uses the translator half. No models, nothing heavy.

    Bottom line

    If your workflow just needs a "maybe translate, maybe not" inline toggle and you control what goes in, it's fine. If you're translating real sentences, skip this node - the pack already has better options, and you'll be chasing mangled output otherwise. Knowing that distinction is the whole article.

    CategoryString Helper

    Inputs (2)

    NameTypeDefaultDescription
    translate_outputBOOLEANfalse
    stringSTRING

    Outputs (1)

    NameTypeDescription
    stringSTRING