Tolgee
The Tolgee
class serves as the primary interface for interacting with the Tolgee localization and translation framework. It provides mechanisms for managing languages, locales, and translations in a coroutine-safe and thread-safe manner, ensuring seamless integration of localization features into Kotlin-based applications.
This class maintains internal caches and reactive flows for efficient retrieval and updates of translations and locales, prioritizing both performance and flexibility in multilingual environments.
Core features include:
Loading and caching of project languages and translations
Locale management with support for reactive updates
On-demand and immediate translation resolution
Designed for applications requiring dynamic multilingual support, the Tolgee
class ensures thread-safe access patterns and handles asynchronous operations efficiently to maintain consistent behavior.
Properties:
config
: Configuration settings for the Tolgee instance.
Methods:
tFlow
: Processes and streams dynamic translations for a given key and parameters.t
: Immediately resolves a translation for a given key and parameters.preload
: Preloads languages and translations into memory for subsequent use.setLocale
: Updates the current locale using various parameter types.
Inheritors
Types
Interface for listening to changes in Tolgee translations.
Properties
Functions
Registers a listener to be notified when translations change.
Unregisters a previously registered change listener.
Sets the current locale for the Tolgee instance, updating it in the reactive locale flow.
Adjusts the current locale used for translations.
Immediate Tolgee translation for a key with parameters.
Updating Tolgee translation for a key with parameters.