
Translates a String or [String] with a HuggingFace seq2seq model loaded in-process (default NLLB-200), forcing the target-language decode token, and returns a string, string list, or language-tagged record chosen from the resolved downstream port.
Translate spoken audio: a file source paces frames, ASR transcribes, this component translates between any language pair the loaded model supports, and the JSON sink streams the output.
Translate a text file end to end and log the result.
String joins all segments, a [String] keeps them split, and the language-tagged Translation / [Translation] arms attach the configured source_language and target_language distinctly alongside the text. Every arm projects the same translated-segment list, so on a single-string input they agree.source_language and target_language are language codes whose accepted form is model-specific. The default NLLB-200 uses FLORES-200 script-tagged codes such as `eng_Latn`, `fra_Latn`, or `zho_Hans`; the source is set on the tokenizer and the target is resolved to the forced decode-start token, so an unknown target code yields a wrong start token. A different seq2seq MT model swapped in via model (M2M100, MarianMT, T5-translate) uses its own code convention, which must then be supplied.model and device are hot-swappable at runtime and trigger a model reload (and a GPU memory reclaim on CUDA) on the next call, producing a one-call latency spike. source_language, target_language, num_beams, batch_size and max_new_tokens are re-read every call and switch for free with no reload.num_beams widens beam search for quality at the cost of latency, and batch_size bounds GPU memory on long [String] inputs. A dedicated NMT model is cheaper and faster than routing translation through a chat LLM.hf_token for gated or private repos); a requested CUDA device falls back to CPU when no GPU is visible. Empty or whitespace-only input, or a list whose entries are all empty, returns the safe empty value for the resolved arm without invoking the model, and a fault inside translation degrades to that same safe value rather than dropping the message. Every input emits exactly one output.Automated release