Nodes/ComfyUI-Prompt-Translator/Conditional Translate
ComfyUI Node

Conditional Translate

The prompt normalizer for shared workflows

By DrStone1971·Created about a year ago·Updated about a year ago· 4
Conditional Translate
  • clip
  • conditioning
  • final_text
  • detected_language
text
target_languageen - English
always_translatefalse

Conditional Translate is the pack's answer to a specific, slightly social problem: you've built a workflow and other people use it. They paste their prompts in their own language, and you'd rather not tell everyone on a forum to write English first. This node detects what language a prompt is in, encodes it directly if it's already your target, and only fires up the translator when it actually needs to.

In other words, it's a normalization layer. English in, English conditioning out with zero translation overhead. Italian in, Italian translated to English, then encoded. Same node, different work depending on what arrives at the input. For a workflow you share, that's genuinely nice - nobody has to remember to translate, and English speakers don't pay a translation penalty.

How it works

The flow is: detect the language of the incoming text, compare it to your target_language, and encode either the original or the translation. There's a always_translate boolean (default false) to force the translation even when the text already matches.

One detail worth flagging: this node uses the pack's simplified scripted language detector (simple_language_detect - character-range checks plus stopword tables for a handful of European languages), not the langdetect path the other nodes use. It's fast and needs no model, but it's also cruder. For the languages it knows it's fine; for something outside its stopword tables it may fall back to en and quietly skip translating a prompt that needed it. If you're feeding it genuinely mixed or unusual text, check the detected_language output before trusting the result.

Inputs and outputs

  • text - multiline, the prompt.
  • clip - from your checkpoint loader.
  • target_language - note there's no "auto" option here; you pick the language the workflow normalizes to (default en - English).
  • always_translate - force translation even if the text already matches the target.

Three outputs: conditioning (to the KSampler), final_text (what was actually encoded - the string), and detected_language (what the detector thought it saw). The last one is a decent little debugging wire.

Installing it

Same pack as always. ComfyUI Manager, search ComfyUI-Prompt-Translator, install, restart:

cd ComfyUI/custom_nodes
git clone https://github.com/DrStone71/ComfyUI-Prompt-Translator

If imports fail, pip install -r requirements.txt inside the cloned folder (argostranslate, ctranslate2, and sentencepiece are the ones that matter). Category 🌐 DrStone71.

Where to use it, and the one trap

Best case for this node is a shared workflow where prompts arrive in arbitrary languages - it saves you both the manual translation step and the overhead of translating already-English prompts. The trap is trusting the detection blindly. It's scripted, not statistical, so a short French prompt that happens to share stopwords with English can slip through untranslated. Run it once with your actual prompt and read detected_language; if it's wrong, either use one of the pack's explicit-source-language nodes or accept the English pass-through. And yes, the usual pack gotcha applies: the first translation of a new language pair downloads an Argos model and blocks until it's done.

Category🌐 DrStone71

Inputs (4)

NameTypeDefaultDescription
textSTRING
clipCLIP
target_languageCOMBOen - English38 options: en - English, ar - Arabic (العربية), az - Azerbaijani (Azərbaycan), ca - Catalan (Català), zh - Chinese (中文), cs - Czech (Čeština), +32
always_translateBOOLEANfalse

Outputs (3)

NameTypeDescription
conditioningCONDITIONING
final_textSTRING
detected_languageSTRING