Nodes/ComfyUI_NYJY/Translate(NYJY)
ComfyUI Node

Translate(NYJY)

The prompt translator that hands you a finished conditioning

By aidenli·Created 2 years ago·Updated 4 months ago· 146
Translate(NYJY)
  • clip
  • STRING
  • CONDITIONING
from_lang自动
to_lang英语
text
platform百度

If you prompt in anything other than English, half your ComfyUI session is babysitting a translation tab. You type Chinese, you paste it into some web translator, you copy English back into a CLIP Text Encode node. This node cuts most of that loop out: it translates in-graph, and if you feed it a CLIP model it also emits a ready-made CONDITIONING, so you can drop it straight into a KSampler without a separate encode step.

It's one of the most-used nodes in the NYJY pack for a reason - it's the only one here that's both genuinely useful and needs nothing extra to run (depending on which backend you pick, see below).

How it works

Translate is a thin wrapper around three translation backends, chosen with the platform dropdown: Google, 百度 (Baidu), and DeepSeek. The mechanism differs per backend, which is the part that bites people:

  • Google - uses the pygtrans library. No key needed. But Google's free translation endpoint is blocked in mainland China, so you need a working proxy. The node reads your system proxy automatically on Windows (via the registry) or the Google.proxy value in config.json on other OSes.
  • 百度 (Baidu) - the default. This calls Baidu's official text-translation API, which requires an AppID and Secret key that you must put in the pack's config.json. See troubleshooting below - this is where almost everyone gets stuck.
  • DeepSeek - uses DeepSeek's LLM API, which needs a DeepSeek.Key in config.json.

from_lang defaults to 自动 (auto) and honestly you can leave it there. to_lang defaults to 英语 (English) - set that once and forget it. The languages available are the same 26-ish set across Google and Baidu (the enum is Chinese/English/Japanese/Korean/French/Spanish/Thai/Arabic/Russian/Portuguese/German/Italian plus a bunch more).

The inputs that matter

Only three of the four required inputs are worth touching: text (the prompt or sentence to translate, multiline), to_lang, and platform. from_lang is auto-detect. There's also an optional clip input - that's the magic one. Plug a CLIP loader into it and the second output becomes real conditioning for whatever model family that CLIP belongs to.

Two outputs:

  • STRING - the translated text, if you'd rather route it into a normal text encoder or a prompt node yourself.
  • CONDITIONING - only populated when clip is connected. Wire this into a sampler and skip the separate CLIP Text Encode node entirely.

Installing it

This is a shared pack, so the install is the same for every NYJY node:

  • ComfyUI Manager: Custom Nodes Manager → Install via Git URL → https://github.com/aidenli/ComfyUI_NYJY → restart.
  • Manual: cd ComfyUI/custom_nodes && git clone https://github.com/aidenli/ComfyUI_NYJY, restart ComfyUI.

Then copy config.json.template to config.json inside the pack folder if you plan to use Baidu or DeepSeek. The full requirements list is in the pack's requirements.txt - if you installed via Manager, pip dependencies are handled for you.

Common issues

"请在config.json中设置百度的API KEY" - the #1 stumble. Create the config file and fill in Baidu.AppId and Baidu.Secret from the Baidu developer center (fanyi.baidu.com). You also need to enable the "通用文本翻译API" service in the Baidu console or the API returns an error code.

Google backend returns nothing - no proxy or the proxy isn't reachable. On Windows it reads the system proxy automatically; if you're on Linux/Mac, set Google.proxy in config.json.

Underscore words like long_hair translate oddly - a known quirk of Baidu's API; the node works around it by splitting underscores before translating, so booru-style tags survive the trip better than you'd expect.

CategoryNYJY/text

Inputs (5)

NameTypeDefaultDescription
from_langCOMBO自动27 options: 自动, 中文, 英语, 日语, 韩语, 法语, +21
to_langCOMBO英语26 options: 中文, 英语, 日语, 韩语, 法语, 西班牙语, +20
textSTRING
platformCOMBO百度3 options: Google, 百度, DeepSeek
clipoptCLIP

Outputs (2)

NameTypeDescription
STRINGSTRING
CONDITIONINGCONDITIONING