Nodes/chinese_clip_encode/ChineseCLIPEncode
ComfyUI Node

ChineseCLIPEncode

Type your prompt in Chinese, let the node do the translating

By yuan199696·Created 2 years ago·Updated about a year ago· 12
ChineseCLIPEncode
  • clip
  • CONDITIONING
text

If you write your prompts in Chinese but generate on SD / SDXL / Illustrious / Pony checkpoints, you already know the drill: those models were trained on English captions, and feeding them raw Chinese usually gets you mush. The old routine is paste into Google Translate, copy the English back, repeat every time you tweak a word. ChineseCLIPEncode is that copy-paste step, automated. It's a drop-in replacement for the built-in CLIPTextEncode that detects Chinese in your prompt, translates it to English, and encodes the result. That's the entire job, and honestly, it does it fine - with a few sharp edges worth knowing before you build a workflow around it.

How it works

The mechanism is short enough to summarize in one breath. The node scans your text for any character in the CJK unified ideograph range (\u4e00\u9fff). If it finds one, it hands the whole string to the translate library - terryyin's free Google Translate wrapper, no API key, no account - set to zh → en, and prints the translation to your ComfyUI console. Then it does exactly what CLIPTextEncode does: clip.tokenize(text)clip.encode_from_tokens(..., return_pooled=True) and emits CONDITIONING. English-only prompts skip the translation step entirely and pass straight through, so the node is harmless to keep in a shared workflow.

Two practical consequences fall out of that design. First, you need internet at generation time - the translation is a live web call, not an offline model. Second, the "any Chinese character" trigger means a mixed prompt like 一个女孩, masterpiece, (detailed face:1.3) gets its entire string run through Google Translate, which will happily mangle your booru tags, acronyms, and (word:weight) syntax. Keep the text pure Chinese (or pure English), don't mix, and check the console - what it prints is exactly what gets encoded.

The inputs that matter

  • clip - your CLIP model, straight from a Checkpoint Loader or CLIPLoader. Nothing special.
  • text - the multiline prompt box, Chinese or English. One light gotcha: the 77-token limit applies to the translated English, so keep long rambling prompts short.

Output: CONDITIONING, which you wire into a KSampler's positive input. Need a negative prompt? Add a second instance for negative - there's no separate prompt/text split on this node.

Installing it

No model files, no VRAM tax, no heavy deps - the only real dependency is the translate pip package. Either install via ComfyUI Manager (search chinese_clip_encode), or the manual way:

cd ComfyUI/custom_nodes
git clone https://github.com/yuan199696/chinese_clip_encode
# restart ComfyUI; it shows up under Add Node → AI_Boy → ChineseCLIPEncode

Where people get burned

Beyond the internet requirement and the mixed-language mangling above, two things bite. The translate library hits Google's free web endpoint, which is occasionally rate-limited or blocked - when that happens the node throws and your whole queue stops, with no image. If you generate offline or in a flaky-network environment, skip this node and translate beforehand. And don't reach for it on newer LLM-encoder models like Flux or Z-Image: those architectures understand natural language (and Chinese, in Z-Image's case) natively, so a translate-to-English wrapper is working backwards. For classic CLIP checkpoints though? Type in your language, glance at the console, and generate.

CategoryAI_Boy

Inputs (2)

NameTypeDefaultDescription
clipCLIP
textSTRING

Outputs (1)

NameTypeDescription
CONDITIONINGCONDITIONING