Nodes/ComfyUI-TranslateLink/TranslateLink · Translate Text
ComfyUI Node

TranslateLink · Translate Text

Translate Any Text in Your Workflow, From Google to a Local Ollama — With Zero Dependencies

By leafiy·Created about a month ago·Updated about a month ago· 0
TranslateLink · Translate Text
    • translated_text
    providergoogle
    text
    source_languageauto
    target_languageen
    api_key
    api_secret
    endpoint
    model
    temperature0.10
    system_promptYou are a professional translator. Translate the user's text from {source_language} to {target_language}. Return only the translated text without explanations, labels, or Markdown fences. Preserve paragraph breaks and the meaning of placeholders, URLs, code fragments, and proper nouns.
    extra_body_json{}
    keep_alive5m

    The name is a small lie: TranslateLink doesn't link anything, and there's no API key required to start. It's one node - TranslateLink · Translate Text - that hands any string in your graph to whichever translation backend you pick: Google Cloud Translation, Baidu Fanyi, any OpenAI-compatible endpoint, your local Ollama, or your own custom HTTP API. If you've ever needed a prompt, a caption, or a chunk of Danbooru tags in another language, this is the node you reach for.

    The job is real and people do it by hand constantly. Wan's own docs recommend Chinese prompts for best results, so a whole corner of the community pastes English prompts into a web translator first. Anime-checkpoint workflows run tag captions that want massaging. "Translate the prompt" threads show up in r/StableDiffusion every few months. TranslateLink is what that habit looks like when it moves inside the graph, on autopilot.

    How it works

    Five providers, one interface, zero extra dependencies. The whole pack is Python standard library - urllib, json, ssl - so there's no requests, no vendor SDK, nothing pip-installed into your ComfyUI environment. Pick the provider from a dropdown, and a set of adapters does the rest: you choose zh once and the node translates that code per provider (Google gets zh-CN, Baidu gets zh, the LLM prompt gets "Simplified Chinese").

    Networking is deliberately boring: a fixed 60-second timeout, one automatic retry on network errors/HTTP 429/5xx, a 2 MiB response cap, TLS always on. There's also a built-in result cache - identical inputs replay the previous answer instead of hitting the provider again (LRU, 100 entries, errors never cached), and every hit/miss logs a [TranslateLink] cache … line to the console. Credentials resolve in a sensible order: node field > TRANSLATELINK_* environment variable > config.json.

    The inputs that matter

    • provider - google / baidu / openai / ollama / custom_http. Defaults to google.
    • text - multiline string. Empty input returns empty without touching the network, which makes it safe to leave wired into a graph with a blank prompt.
    • source_language / target_language - one unified list, auto for detection. Every choice works with every provider.
    • model - required for openai and ollama; temperature (default 0.1) applies to both. keep_alive is ollama-only.
    • api_key / api_secret - google/baidu/openai. Leave them empty and keep keys in env vars or config.json.

    Output is one translated_text STRING. Wire it into a CLIP Text Encode, a captioner, anywhere a string is consumed. For custom_http, fill endpoint and your server must speak the fixed contract: POST {"text","source","target"}{"translation": "..."}.

    Installing it

    Easiest: ComfyUI Manager, search ComfyUI-TranslateLink, install, restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/leafiy/ComfyUI-TranslateLink
    

    Restart ComfyUI. That's it - no pip install, no model downloads, Python 3.9+. The only extra step is if you want the Ollama tier: ollama pull qwen2.5:7b and set that as model.

    Where people get burned

    Keys typed into the node fields are saved in the workflow JSON - the README says it, and it's the one that bites people sharing workflows. Empty fields + env vars/config.json for anything you'll share; config.json is git-ignored. Other classic hits: "Google API key is not configured" (set it somewhere), Baidu wanting both App ID and Secret (one alone errors), "model is required" for openai/ollama, Ollama connection errors (is the server actually running?), and a response_path 'translation' not found from a custom endpoint that didn't follow the contract.

    One honest note on trust: an API node that ships a key is exactly the shape that already got weaponized once in this ecosystem (the LLMVISION incident). This pack is a decent citizen - import does no I/O, credentials are read only when the node executes, keys never appear in logs or errors - but the general rule holds: read fresh packs before their first run. And if the job can be done by your local Ollama, that's fewer credentials floating around your graph at all.

    CategoryTranslateLink

    Inputs (12)

    NameTypeDefaultDescription
    providerCOMBOgoogle5 options: google, baidu, openai, ollama, custom_http
    textSTRING
    source_languageCOMBOauto27 options: auto, en, zh, zh-TW, ja, ko, +21
    target_languageCOMBOen26 options: en, zh, zh-TW, ja, ko, fr, +20
    api_keyoptSTRINGgoogle: API key | baidu: App ID | openai: API key. Empty = use TRANSLATELINK_* env vars or config.json. Note: values typed here are saved in the workflow JSON.
    api_secretoptSTRINGbaidu only: the platform Secret. Empty = env var / config.json.
    endpointoptSTRINGEmpty = the provider's default endpoint. Required for custom_http.
    modeloptSTRINGopenai / ollama: model name (required for those providers).
    temperatureoptFLOAT0.100–2
    system_promptoptSTRINGYou are a professional translator. Translate the user's text from {source_language} to {target_language}. Return only the translated text without explanations, labels, or Markdown fences. Preserve paragraph breaks and the meaning of placeholders, URLs, code fragments, and proper nouns.openai / ollama translation prompt; {source_language} and {target_language} are filled in automatically.
    extra_body_jsonoptSTRING{}openai: JSON object merged into the request body; must not contain 'messages'.
    keep_aliveoptSTRING5mollama only.

    Outputs (1)

    NameTypeDescription
    translated_textSTRING