TranslateLink · Translate Text
Translate Any Text in Your Workflow, From Google to a Local Ollama — With Zero Dependencies
- translated_text
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,autofor detection. Every choice works with every provider.model- required foropenaiandollama;temperature(default 0.1) applies to both.keep_aliveis ollama-only.api_key/api_secret- google/baidu/openai. Leave them empty and keep keys in env vars orconfig.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.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| provider | COMBO | 5 options: google, baidu, openai, ollama, custom_http | |
| text | STRING | — | |
| source_language | COMBO | auto | 27 options: auto, en, zh, zh-TW, ja, ko, +21 |
| target_language | COMBO | en | 26 options: en, zh, zh-TW, ja, ko, fr, +20 |
| api_keyopt | STRING | google: 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_secretopt | STRING | baidu only: the platform Secret. Empty = env var / config.json. | |
| endpointopt | STRING | Empty = the provider's default endpoint. Required for custom_http. | |
| modelopt | STRING | openai / ollama: model name (required for those providers). | |
| temperatureopt | FLOAT | 0.100–2 | — |
| system_promptopt | STRING | You 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_jsonopt | STRING | {} | openai: JSON object merged into the request body; must not contain 'messages'. |
| keep_aliveopt | STRING | 5m | ollama only. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| translated_text | STRING | — |