LocaleSettingsExt<E extends BaseAppLocale<E, T>, T extends BaseTranslations<E, T>> extension

on

Properties

currentLocale → E
Gets current locale.
no setter
currentTranslations → T
Gets current translations
no setter
supportedLocalesRaw List<String>
Gets supported locales in string format.
no setter

Methods

getLocaleStream() Stream<E>
Gets the broadcast stream to keep track of every locale change.
overrideTranslations({required E locale, required FileType fileType, required String content}) → void
Overrides existing translations of locale with new ones from content. The content should be formatted and structured exactly the same way as the original files.
overrideTranslationsFromMap({required E locale, required bool isFlatMap, required Map map}) → void
Overrides existing translations of locale with new ones from the map.
setLocale(E locale, {bool? listenToDeviceLocale = false}) → E
Sets locale. Returns the locale which has been set.
setLocaleRaw(String rawLocale, {bool? listenToDeviceLocale = false}) → E
Sets locale using string tag (e.g. en_US, de-DE, fr) Fallbacks to base locale. Returns the locale which has been set.
setPluralResolver({String? language, E? locale, PluralResolver? cardinalResolver, PluralResolver? ordinalResolver}) → void
Sets plural resolvers. See https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html See https://github.com/slang-i18n/slang/blob/main/slang/lib/api/plural_resolver_map.dart Either specify language, or locale. locale has precedence.