Nodes/ComfyUI-ADIC/图片翻译参数构建器
ComfyUI Node

图片翻译参数构建器

Stop hand-writing the JSON the translate node needs

By jinchanz·Created about a year ago·Updated a day ago· 5
图片翻译参数构建器
    • params_json
    url1
    source_language1
    target_language1en
    url2
    source_language2
    target_language2en
    url3
    source_language3
    target_language3en

    Every pack has its glue, and this is the glue. ImageTranslateParamsBuilder exists for one reason: the ImageTranslateAPI node needs its batch request as a JSON string with an exact shape, and nobody wants to type that by hand - or, worse, debug a malformed string at 1am. Give this node up to three image URLs with their language settings, and it hands you back a ready-to-go params_json.

    Mechanically it's as simple as a node gets: it collects your up to three (url, sourceLanguage, targetLanguage) triples, skips the ones with no URL, and serializes them into the API's expected format:

    {"params": [{"url": "https://example.com/1.jpg", "sourceLanguage": "zh", "targetLanguage": "en"}]}
    

    What comes out of the single params_json output wires straight into ImageTranslateAPI.params (which is forceInput, so the two nodes snap together nicely).

    Inputs you'll touch

    • url1 - required; the only mandatory field. This node does nothing useful with an empty url1.
    • source_language1 - "" (unspecified / auto), zh, en, or tr. Blank means "don't send it" - the API then auto-detects.
    • target_language1 - es, fr, pt, ko, or en; default en. This is the one you'll change most.
    • url2 / source_language2 / target_language2 and url3 / ... - a second and third image, same options, all optional.

    That's the whole node. Three images is the ceiling; if you need more, either chain two builders (the API accepts multiple params blocks) or feed the JSON in directly via ImageTranslateAPI.

    Why you'd reach for it

    Honestly, it's a nicety rather than a necessity - you could paste JSON straight into the API node. But it saves the two most common failure classes: wrong key names (the API wants camelCase sourceLanguage, not source_language) and invalid JSON from a stray quote. It also keeps the workflow self-documenting: the languages are visible dropdowns instead of buried in a blob of text.

    Worth one caveat: the API's supported source languages (auto/zh/en/tr) and targets (es/fr/pt/ko/en) are hard limits of the service, not of this node - picking a combo the service doesn't support gets you an error downstream, not here.

    Installing

    cd ComfyUI/custom_nodes
    git clone https://github.com/jinchanz/ComfyUI-ADIC
    

    Restart ComfyUI, or find "ComfyUI-ADIC" in ComfyUI Manager. No dependencies beyond what the pack already needs (requests), no model downloads. The README's only documentation of this node is the short "参数构建器" section, but its behavior is simple enough that what you just read covers it.

    CategoryMalette

    Inputs (9)

    NameTypeDefaultDescription
    url1STRING
    source_language1optCOMBO4 options: , zh, en, tr
    target_language1optCOMBOen6 options: , es, fr, pt, ko, en
    url2optSTRING
    source_language2optCOMBO4 options: , zh, en, tr
    target_language2optCOMBOen6 options: , es, fr, pt, ko, en
    url3optSTRING
    source_language3optCOMBO4 options: , zh, en, tr
    target_language3optCOMBOen6 options: , es, fr, pt, ko, en

    Outputs (1)

    NameTypeDescription
    params_jsonSTRING