Skip to main content

//clika-runtime/io.clika.modelverse/TranslateModel/translate

translate

[common]
fun translate(texts: List<String>, sourceLanguage: String?, targetLanguage: String, options: TranslateOptions, listener: TranslateListener): TranslateHandle

Translate texts from sourceLanguage (null keeps the model's default source) into targetLanguage, both codes from Capabilities.languages, under options. Returns at once; the worker runs the batch and calls listener on its thread: TranslateListener.onTranslations with one translation per text in order, then TranslateListener.onDone. An empty list or a code the model does not name ends in TranslateListener.onError.