LocalizationExt extension
Extends BuildContext to provide easy access to LocalizationManager methods.
This extension adds several convenience methods to any BuildContext, facilitating the management of localization actions directly from the context.
- on
Properties
- locale → Locale
-
Retrieves the current locale from the LocalizationProvider.
no setter
-
localizationsDelegates
→ Iterable<
LocalizationsDelegate> -
Returns a list of localization delegates including:
no setter
- locManager → LocalizationManager
-
Retrieves the LocalizationManager from the nearest LocalizationProvider in the widget tree.
no setter
-
supportedLocales
→ Iterable<
Locale> -
Retrieves the list of supported locales by mapping them from the LocalizationProvider.
no setter
Methods
-
addTranslation(
String name) → void - Adds a translation resource by its name.
-
changeLocale(
Locale newLocale) → void - Changes the application's current locale.
-
reloadTranslation(
String name) → void - Reloads a specific translation by its name for the current locale.
-
reloadTranslations(
) → void - Reloads all translations for the current context.
-
removeTranslation(
String name) → void - Removes a translation resource by its name.