TolgeeApple

data class TolgeeApple : Tolgee(source)

A data class representing the implementation of the Tolgee localization framework for Apple platforms. This class extends the base Tolgee class and provides methods for accessing translated strings, either as flows or as immediate values.

Types

Link copied to clipboard
object Companion

Contains utility methods for fetching localized strings from the main resource bundle or a fallback base resource bundle.

Properties

Link copied to clipboard
open val availableLocales: List<Locale>?

The list of available locales from the manifest or configuration.

Link copied to clipboard

The list of available locale tags (e.g., ["en", "fr", "de"]) from the manifest or configuration.

Link copied to clipboard
val changeFlow: MutableSharedFlow<Unit>

A flow that emits whenever translations change.

Link copied to clipboard
open override val config: Tolgee.Config

Functions

Link copied to clipboard

Registers a listener to be notified when translations change.

Link copied to clipboard
open fun getLocale(): Locale

Gets the current locale for the Tolgee instance.

Link copied to clipboard
open suspend fun preload()

Preloads the required languages and their translations for the current Tolgee instance.

Link copied to clipboard
open suspend fun preloadAll()

Preloads all available languages and their translations into memory.

Link copied to clipboard

Unregisters a previously registered change listener.

Link copied to clipboard
open fun setLocale(locale: Locale): Locale
fun setLocale(nsLocale: NSLocale): Locale

Sets the current locale for the Tolgee instance, updating it in the reactive locale flow.

open fun setLocale(localeTag: String): Locale

Adjusts the current locale used for translations.

Link copied to clipboard
open fun t(key: String, parameters: TolgeeMessageParams = TolgeeMessageParams.None): String?

Immediate Tolgee translation for a key with parameters.

fun t(key: String, default: String?, table: String? = null): String?

Retrieves the translation for a given key immediately. If no translation is found, falls back to the provided default value or bundle localization.

fun t(key: String, default: String?, table: String? = null, vararg args: Any): String?

Retrieves an immediate translation string for the given key with optional parameters and a fallback.

Link copied to clipboard
open fun tArray(key: String): List<String>
Link copied to clipboard
open fun tArrayFlow(key: String): Flow<List<String>>
Link copied to clipboard
open fun tFlow(key: String, parameters: TolgeeMessageParams = TolgeeMessageParams.None): Flow<String>

Updating Tolgee translation for a key with parameters.

fun tFlow(key: String, default: String?, table: String? = null): Flow<String>

Provides a flow of localized strings based on the given key, default value, and optional table name.

fun tFlow(key: String, default: String?, table: String? = null, vararg args: Any): Flow<String>

Provides a flow of localized string representations for a given key, allowing localization updates based on dynamic arguments and optional table-specific localization contexts.