LocalizationManager class
Manages localization, handling translations and locales.
Constructors
-
LocalizationManager({required List<
SupportedLocale> supportedLocales, required Locale initialLocale, required List<String> initialTranslations, required bool debugMode, bool saveLocale = true}) - Creates a localization manager with the necessary initial setup.
Properties
- currentLocale ↔ Locale
-
The current locale being used by the localization manager.
getter/setter pair
- debugMode → bool
-
Flag to enable or disable debug mode for logging purposes.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- loader ↔ LoaderPro
-
Loader instance for loading translation resources.
latefinal
- logger → Logger
-
Logger instance used for logging messages.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- saveLocale ↔ bool
-
Flag to determine if the locale should be saved to storage.
getter/setter pair
-
supportedLocales
→ List<
SupportedLocale> -
List of supported locales.
final
- translator ↔ TranslatorPro
-
Translator instance for handling translation operations.
latefinal
Methods
-
addTranslation(
BuildContext context, Translation translation) → void - Adds a translation to the manager and requests a UI update.
-
changeLocale(
BuildContext context, Locale newLocale) → Future< void> - Changes the current locale and reloads translations.
-
loadInitialTranslations(
Locale locale, Set< String> initialTranslations) → Future<void> - Loads initial translations for the given locale.
-
loadTranslation(
Translation translation) → Future< void> - Loads a single translation entry.
-
loadTranslations(
Locale locale, Set< String> translations, [BuildContext? context]) → Future<void> - Loads translations for the given locale and set of translation keys.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reLoadTranslation(
BuildContext context, Translation translation) → void - Reloads a single translation and requests a UI update.
-
reLoadTranslations(
BuildContext context) → void - Reloads all included translations and requests a UI update.
-
removeTranslation(
BuildContext context, Translation translation) → Future< void> - Removes a translation and updates the manager's state.
-
toString(
) → String -
A string representation of this object.
inherited
-
translate(
String key) → String - Translates a given key.
-
translatePlural(
String key, int count) → String - Returns the appropriate plural form of a string based on a given count.
-
translateWithParams(
String key, Map< String, dynamic> namedArgs) → String - Translates a given key with parameters.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited