LocalizationManager class

Manages localization resources for a Flutter application, handling the dynamic loading, adding, and removing of localized strings, with logging capabilities.

Constructors

LocalizationManager({required List<SupportedLocale> supportedLocales, required Locale initialLocale, required List<String> initialTranslations, required bool debugMode})
Constructs a localization manager with initial settings.

Properties

currentLocale Locale
Current locale used by the localization manager.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
logger → Logger
Logger instance for handling debug output.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
supportedLocales List<SupportedLocale>
List of all supported locales and their respective translations.
final

Methods

addTranslation(BuildContext context, SupportedTranslation translation) → void
Adds a translation if it is not already included, triggering a UI rebuild.
changeLocale(BuildContext context, Locale newLocale) → void
Changes the current locale, reloading all necessary translations and triggering a UI rebuild.
loadInitialTranslations(Locale locale, Set<String> initialTranslations) → void
Loads the initial translations for a given locale from the specified translations list.
loadTranslation(SupportedTranslation translation) → void
Loads a specific translation, adding its content to the internal map of localized strings.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeTranslation(BuildContext context, SupportedTranslation translation) → void
Removes a translation and its associated keys from the internal map, triggering a UI rebuild.
toString() String
A string representation of this object.
inherited
translate(String key) String
Retrieves a localized string by key, returning a default message if not found.

Operators

operator ==(Object other) bool
The equality operator.
inherited