Traductor: CLIP Texto (Multi-Idioma)
Type Your Prompt in Spanish, Let CLIP Read English
- clip
- CONDITIONING
CLIP is an English-centric encoder. It'll cope with a Spanish prompt on an SD 1.5 or SDXL checkpoint, but it lives in English - and that gap is where your results quietly get worse. This node closes it in one step: you type in Spanish (or French, or German), it translates the text offline, and it feeds the English version straight into the conditioning. No API key, no internet after the first model download, no manual copy-paste into Google Translate.
The name is a "do what it says on the tin" kind of deal - it's a translator fused with a CLIP Text Encode. You hand it a clip model, your text, and src_lang/tgt_lang, and out comes a CONDITIONING tensor you wire straight into your sampler, exactly like the output of the built-in CLIP Text Encode node. Under the hood it runs the translation, then calls clip.encode_from_tokens() on the result with return_pooled=True, so the pooled output (the bit SDXL conditioning carries around) is preserved. If the translation blows up for any reason, it falls back to encoding your original text - the image gets made either way, just with the untranslated prompt.
The three inputs that actually matter
clip- any CLIP model from a checkpoint/CLIP loader. This is an SD 1.5 / SDXL / Pony / Illustrious node; it needs a real CLIP encoder.text- your prompt, multiline. This is the one variant that runs dynamic prompts on the input (dynamicPrompts: Truein the source), so prompt scheduling syntax still works.src_lang/tgt_lang- pick fromes,en,fr,de. Defaults arees→en, which tells you who this pack is for: the README is in Spanish.
How the translation actually works
The engine is the interesting bit. It uses ONNX Marian models (opus-mt-*) from Hugging Face - Xenova/opus-mt-es-en for Spanish→English, Helsinki-NLP variants for the rest - loaded through optimum[onnxruntime]. Three things make it feel decent in practice:
- Lazy loading. A model isn't loaded until the first translation for that language pair. The first run downloads and loads; every run after that is fast.
- A SQLite cache. Completed translations are stored in a
test_cache.dbfile in the pack's folder, keyed by text + language pair. Repeat a prompt and it's instant, no model inference at all. Delete that file if you ever need to clear it. - Chunking with a pivot fallback. Long text gets split into ~400-token chunks at sentence boundaries (NLTK, with proper Spanish/French/German sentence splitting), translated piece by piece, and rejoined. There's no direct model for every pair -
fr→de, for instance - so it pivots through English:fr→en, thenen→de.
Installing it
The easy route is ComfyUI Manager: search for ComfyUI-translate-offline and hit install. Otherwise:
cd ComfyUI/custom_nodes
git clone https://github.com/Jairodaniel-17/ComfyUI-translate-offline
Then install the dependencies - the pack's requirements.txt is torch, optimum[onnxruntime], transformers, nltk:
pip install torch optimum[onnxruntime] transformers nltk
Restart ComfyUI and you'll see Traductor: CLIP Texto (Multi-Idioma) under the conditioning category. The model downloads happen automatically on first use, so keep internet on for that one run. Note this installs into the same Python environment as everything else - optimum and transformers are heavy and occasionally collide with other nodes, so if something odd breaks right after, that's the usual suspect.
Where people get burned
First: this is a CLIP node, full stop. It will not help with the models everyone's actually excited about these days - Flux uses a dual CLIP-L + T5 encoder, and the LLM-encoded models (Z-Image, Klein, and friends) don't take a clip input at all. Those need their own prompt-handling path. Second, the language list is locked to es/en/fr/de in the UI, so if you were hoping to translate into Chinese to feed a model that "works better with Chinese prompts," this pack can't - you'd have to edit infrastructure/di_container.py and add pairs yourself. And expect the very first translation for a pair to hang for a while; it's downloading a model, not frozen.
If output looks off, check the console: the node logs [CLIP Translator] es→en: '...' so you can see exactly what the encoder received. When it silently returns your original text, the translation failed and it did the safe fallback - which is honest, but easy to miss.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| clip | CLIP | — | |
| text | STRING | — | |
| src_lang | COMBO | es | 4 options: es, en, fr, de |
| tgt_lang | COMBO | en | 4 options: en, es, fr, de |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| CONDITIONING | CONDITIONING | — |