Text Contains Chinese
A language detector for branching workflows
- BOOLEAN
Text Contains Chinese is a tiny predicate node: it looks at a string, checks whether it contains any Chinese characters, and returns a BOOLEAN. That's the whole thing. No dictionary, no model, no config - just a character-range check (specifically, whether any character lands in the CJK Unified Ideographs block) and a yes/no out.
Why would you want that? Branching. ComfyUI lets you route on booleans, and language detection is a genuinely useful branch condition. A common pattern: an LLM or a translation step outputs a string, and you need different downstream handling depending on whether it came out in Chinese or not. The pack's author clearly hits this constantly - it's the same Chinese-text awareness that makes Draw Text in BBox auto-switch to a Chinese font, and the pack's fonts ship with a hei.TTF for exactly that reason.
The inputs
One input, text (a STRING). One output, BOOLEAN - True if the string contains any character in the CJK block, False otherwise.
That's the entire API surface. You wire the boolean into a switch or a if-style node and branch.
Install
The pack standard:
cd ComfyUI/custom_nodes
git clone https://github.com/Duanyll/duanyll_nodepack
cd duanyll_nodepack && pip install -r requirements.txt
or via ComfyUI Manager → "Duanyll Nodepack" → install → restart. The node itself uses only the Python stdlib; the heavyweight requirements.txt (OpenCV, kornia, insightface, matplotlib, Volcengine SDK) is the pack's baggage, not this node's.
Where it's useful and where it isn't
This is a perfect example of a "the pack's author needed this, so it exists" node - and that's fine. The detection is binary: any CJK character at all returns True, so a mostly-English sentence with one Chinese character counts as "contains Chinese." For routing that's usually what you want; for anything subtler (percentage of CJK, which language dominates) it won't help.
Pair it with the pack's LLM nodes: ask the LLM for a translation, detect whether it actually switched languages, and branch on the result. That loop - generate, detect, branch - is where a one-line predicate node earns its keep. It's not a node you'll build a workflow around, but when you need it, you need it, and there's nothing else in most other packs that does exactly this with zero setup.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BOOLEAN | BOOLEAN | — |