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

on

Properties

currentLocale → E

Available on BaseLocaleSettings<E, T>, provided by the LocaleSettingsExt extension

Gets the current locale.
no setter
currentTranslations → T

Available on BaseLocaleSettings<E, T>, provided by the LocaleSettingsExt extension

Gets the current translations. Falls back to the base locale if the current locale is not loaded.
no setter
supportedLocalesRaw List<String>

Available on BaseLocaleSettings<E, T>, provided by the LocaleSettingsExt extension

Gets supported locales in string format.
no setter

Methods

getLocaleStream() Stream<E>

Available on BaseLocaleSettings<E, T>, provided by the LocaleSettingsExt extension

Gets the broadcast stream to keep track of every locale change.
getTranslations(E locale) → T

Available on BaseLocaleSettings<E, T>, provided by the LocaleSettingsExt extension

Gets the translations of the given locale. Falls back to the base locale if the given locale is not loaded.
isLocaleLoaded(E locale) bool

Available on BaseLocaleSettings<E, T>, provided by the LocaleSettingsExt extension

Returns true if the translations of the given locale are loaded.
loadAllLocales() Future<void>

Available on BaseLocaleSettings<E, T>, provided by the LocaleSettingsExt extension

Loads all locales.
loadAllLocalesSync() → void

Available on BaseLocaleSettings<E, T>, provided by the LocaleSettingsExt extension

Sync version of loadAllLocales.
loadLocale(E locale) Future<void>

Available on BaseLocaleSettings<E, T>, provided by the LocaleSettingsExt extension

Loads the translations of the given locale if not already loaded.
loadLocaleSync(E locale) → void

Available on BaseLocaleSettings<E, T>, provided by the LocaleSettingsExt extension

Sync version of loadLocale.
overrideTranslations({required E locale, required FileType fileType, required String content}) Future<void>

Available on BaseLocaleSettings<E, T>, provided by the LocaleSettingsExt extension

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}) Future<void>

Available on BaseLocaleSettings<E, T>, provided by the LocaleSettingsExt extension

Overrides existing translations of locale with new ones from the map.
overrideTranslationsFromMapSync({required E locale, required bool isFlatMap, required Map map}) → void

Available on BaseLocaleSettings<E, T>, provided by the LocaleSettingsExt extension

Sync version of overrideTranslationsFromMap.
overrideTranslationsSync({required E locale, required FileType fileType, required String content}) → void

Available on BaseLocaleSettings<E, T>, provided by the LocaleSettingsExt extension

Sync version of overrideTranslations.
setLocale(E locale, {bool? listenToDeviceLocale = false}) Future<E>

Available on BaseLocaleSettings<E, T>, provided by the LocaleSettingsExt extension

Sets locale. Returns the locale which has been set.
setLocaleRaw(String rawLocale, {bool? listenToDeviceLocale = false}) Future<E>

Available on BaseLocaleSettings<E, T>, provided by the LocaleSettingsExt extension

Sets locale using string tag (e.g. en_US, de-DE, fr) Fallbacks to base locale. Returns the locale which has been set.
setLocaleRawSync(String rawLocale, {bool? listenToDeviceLocale = false}) → E

Available on BaseLocaleSettings<E, T>, provided by the LocaleSettingsExt extension

Sync version of setLocaleRaw.
setLocaleSync(E locale, {bool? listenToDeviceLocale = false}) → E

Available on BaseLocaleSettings<E, T>, provided by the LocaleSettingsExt extension

Sync version of setLocale.
setPluralResolver({String? language, E? locale, PluralResolver? cardinalResolver, PluralResolver? ordinalResolver}) Future<void>

Available on BaseLocaleSettings<E, T>, provided by the LocaleSettingsExt extension

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/src/api/plural_resolver_map.dart Either specify language, or locale. locale has precedence.
setPluralResolverSync({String? language, E? locale, PluralResolver? cardinalResolver, PluralResolver? ordinalResolver}) → void

Available on BaseLocaleSettings<E, T>, provided by the LocaleSettingsExt extension

Sync version of setPluralResolver.