LanguageManager Class

class LanguageManager

Manages the OCR language data an application can download and install.

Get the shared instance with getInstance, then use it to list, download, and remove languages, and to find the directory to hand to com.pixelnetica.scanning.ScanReader.

Types

Companion

object Companion : Tag

Logging tag, and the manager’s single instance.

LanguageStore

data class LanguageStore(val directory: File, val languages: String)

Where OCR language data lives on disk, and which languages are installed there.

Properties

detectorPath

val detectorPath: Flow<File?>

Path to the installed orientation-detection model, or null until one is installed.

languageStore

val languageStore: Flow<LanguageManager.LanguageStore>

Where the installed OCR language data lives, and which languages are in it.

Functions

deleteArchives

suspend fun deleteArchives(vararg codes: Int)

Removes downloaded language archives, freeing the space they occupy.

deleteRemoved

suspend fun deleteRemoved()

Cleanup removed languages. This can reinstall predefined languages.

ensureArchives

suspend fun ensureArchives(vararg codes: Int)

Removes downloaded archives other than the ones named.

getDisplayString

fun getDisplayString(limit: Int = -1): Flow<Unit>

Renders a language selection as a short label for a UI.

requestAssets

suspend fun requestAssets(assetDir: String, code: Int)

Installs language data shipped in the application’s assets.

requestServer

suspend fun requestServer(baseUri: String, code: Int)

Downloads the list of languages available from the server.

Top