TranslationsProvider

abstract class TranslationsProvider(val defaultLocaleBuilder: () -> Locale) : KordExKoinComponent

Translation provider interface, in charge of taking string keys and returning translated strings.

Parameters

defaultLocaleBuilder

Builder returning the default locale - available in defaultLocale, which calls it the first time it's accessed.

Inheritors

Constructors

Link copied to clipboard
constructor(defaultLocaleBuilder: () -> Locale)

Properties

Link copied to clipboard

Default locale, resolved via defaultLocaleBuilder. Avoid accessing this outside of your get functions, as accessing it too early will prevent the user from configuring it properly.

Link copied to clipboard

Functions

Link copied to clipboard
abstract fun get(key: Key): String

Get a translation by key.

Link copied to clipboard
open override fun getKoin(): Koin

Get the associated Koin instance.

Link copied to clipboard
abstract fun hasKey(key: Key): Boolean

Check whether a translation key exists.

Link copied to clipboard
abstract fun translate(key: Key, replacements: Array<Any?> = arrayOf()): String

Get a formatted translation using the provided arguments.

Link copied to clipboard
abstract fun translateNamed(key: Key, replacements: Map<String, Any?>): String

Get a formatted translation using the provided arguments.