ChineseToEnglish
Chinese to English prompt translation, fully local, no API key
- STRING
Most ComfyUI users who think in Chinese have a standing ritual: write the prompt in Chinese, translate it to English (because most checkpoints were trained on English), paste it into the encoder. This node automates that step inside the graph. ChineseToEnglish runs a real machine-translation model on your machine - no API, no key, no network call after the first download - and hands you the English string ready to plug into your CLIP text encoder.
It's squarely aimed at the pack's primary audience: the author is a Chinese ComfyUI creator whose README is bilingual and whose Bilibili tutorials are in Chinese. If you write prompts in Chinese, this is genuinely handy. If you don't, it's still interesting as an example of the pack's "AI tool" category - but you can skip it.
How it works
It loads the Helsinki-NLP opus-mt-zh-en Marian MT model (a small sequence-to-sequence transformer, ~300 MB) from Hugging Face. On first run it downloads the model and caches it into ComfyUI/models/translator/opus-mt-zh-en, so subsequent runs are fully offline and fast. The use_gpu toggle moves the model between CUDA and CPU; on GPU a short sentence is nearly instant.
One quirk worth knowing: the model is a plain translation model, not a "prompt enhancer." It will not add quality tags, fix your syntax, or expand a vague idea into a detailed prompt - it just translates what you wrote. If you wanted an AI prompt-writer, this isn't that.
Inputs and outputs
- input_text (STRING, multiline) - the Chinese text to translate.
- optional_input_text (STRING) - if you connect something here and it isn't empty, it takes priority over
input_text. That's handy for looping: a node downstream can push text back in. - use_gpu (BOOLEAN, default on) - off for CPU-only machines.
Output: a single STRING with the English translation. It's an output node, so it also shows the translated text in its own UI box - convenient for eyeballing the result before you commit to it.
Installing it
Part of ComfyUI-Apt_Preset:
cd ComfyUI/custom_nodes
git clone https://github.com/cardenluo/ComfyUI-Apt_Preset
# install.bat or pip install -r requirements.txt, restart
Or Manager → search "ComfyUI-Apt_Preset".
Where people get burned
Two real ones here. First, the model needs network access to Hugging Face on first use. If you're behind the GFW or on an air-gapped box, the download hangs - and note the author's own mirrors are on Quark Pan (a Chinese cloud drive), which tells you their audience's access situation. If HF is blocked, download Helsinki-NLP/opus-mt-zh-en elsewhere and drop it into ComfyUI/models/translator/opus-mt-zh-en manually.
Second, transformers isn't in the pack's requirements.txt. The node imports it at module load. If your ComfyUI env doesn't already have transformers (many setups do, from other packs), the whole pack can fail to import - fix with pip install transformers. A symptom of that is the pack showing as "not loaded" in Manager. Annoying, but a one-line fix.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| use_gpu | BOOLEAN | true | — |
| input_text | STRING | — | |
| optional_input_textopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |