TranslationEngine

The on-device language tools OnDeviceTranslator needs; ML Kit provides the real one.

Inheritors

Functions

Link copied to clipboard
abstract suspend fun detectLanguage(text: String): String?

Language code of text (for example fr), or null if it cannot be told.

Link copied to clipboard
abstract suspend fun downloadModel(language: String)

Downloads the model for language; throws on failure.

Link copied to clipboard
abstract suspend fun isModelReady(language: String): Boolean

True if the model for language is already on the device.

Link copied to clipboard
abstract fun isSupported(language: String): Boolean

True if translating language to English is supported at all.

Link copied to clipboard
abstract suspend fun translate(text: String, language: String): String

Translates text from language to English; the model must be ready.