object LanguagesHelper
Use the static methods in this class to do all language-related operations.
Functions | |
---|---|
Void |
fun availableLanguages( applicationContext: Context, callback: (Result<List<RemoteLanguage?>>) -> Unit ) Downloads the list of available languages. |
Void |
fun downloadLanguageFile( applicationContext: Context, language: String, destination: File, detailedProgress: ((downloadedBytes: Long, totalBytes: Long) -> Unit)? = null, callback: (result: Result ) Downloads the file containing the specified language. |
LocalLanguage? | fun getMetadataFromLanguage(path: String) Creates the language metadata object from the language file at the specified path. |
fun availableLanguages(
applicationContext: Context,
callback: (Result<List<RemoteLanguage?>>) -> Unit
)
Downloads the list of available languages.
Parameters | |
---|---|
applicationContext: Context | The application’s context |
callback: (Result<List<RemoteLanguage?>>) -> Unit | A callback to monitor completion or error |
fun downloadLanguageFile(
applicationContext: Context,
language: String,
destination: File,
detailedProgress: ((downloadedBytes: Long, totalBytes: Long) -> Unit)? = null,
callback: (result: Result<Unit>) -> Unit?
)
Downloads the file containing the specified language.
Parameters | |
---|---|
applicationContext: Context | The application’s context |
language: String | The locale of the language file you want to download |
destination: File | A file to define the path where the file will be downloaded |
detailedProgress: ((downloadedBytes: Long, totalBytes: Long) -> Unit)? = null | a listener to monitor progress |
callback: (result: Result<Unit>) -> Unit? | A callback to monitor completion or error |
fun getMetadataFromLanguage(path: String): LocalLanguage?
Creates the language metadata object from the language file at the specified path.
Parameters | |
---|---|
path: String | The Path to the language file. |
Returns | |
---|---|
LocalLanguage? | An object with all the metadata for the specified language |