L10nLocale class

The Translations Manager Class

Constructors

L10nLocale()
factory

Properties

allowDeviceChangeLocale bool
A flag allowing the Locale to change dynamically or not.
getter/setter pair
appLocale Locale?
The App's Locale
no setter
backupLocale Locale?
Supply the 'backup' Locale if any.
no setter
delegate LocalizationsDelegate<L10nLocale>
======================================================= Code from the older version.
no setter
deviceLocale Locale?
Intended to store the device's original Locale.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
supportedLocales List<Locale>
Use this getter below for your MaterialApp supportedLocales parameter It will also load the translations defined above.
no setter
textLocale Locale?
The Locale of the original text at times being translated.
getter/setter pair
translations Map<Locale, Map<String, String>>
Translation Map
no setter

Methods

addTranslations(Map<Locale, Map<String, String>>? map) bool
Supply the translations Return true if successful
appendTranslations(Map<Locale, Map<String, String>> tr) → void
Add additional Translations Overwrite existing Translation
clearTranslations() → void
Clear the Translations Map variable
getLocale(int index) Locale?
Get a Locale from the List of 'supported' Locales.
load([Locale? locale]) Future<L10nLocale>
Called by the LocalizationsDelegate object
localeOf(BuildContext? context, {bool? allowLocaleChange}) Locale?
Record the device's Locale at that point in time. Traditionally placed in a build() function.
localeResolutionCallback(Locale? systemLocale, Iterable<Locale>? supportedLocales) Locale?
Called by the LocalizationsDelegate. Possibly needed to resolve current Locale.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
of(Text? text, {Key? key, TextStyle? style, StrutStyle? strutStyle, TextAlign? textAlign, TextDirection? textDirection, Locale? locale, bool? softWrap, TextOverflow? overflow, double? textScaleFactor, int? maxLines, String? semanticsLabel, TextWidthBasis? textWidthBasis}) Text
Convert a Text object to one with a translation.
s(String? word) String
Translate the String
setAppBackupLocale(Locale? locale) → void
Set the 'backup' Locale to use.
setAppLocale(Locale? locale) bool
Explicitly set a supported Locale using this class Allow your App to not reference L10n or L10nLocale at all. Set the Locale to translate Returns true if set to that Locale
t(String? data, {Key? key, TextStyle? style, StrutStyle? strutStyle, TextAlign? textAlign, TextDirection? textDirection, Locale? locale, bool? softWrap, TextOverflow? overflow, double? textScaleFactor, int? maxLines, String? semanticsLabel, TextWidthBasis? textWidthBasis, TextHeightBehavior? textHeightBehavior}) Text
Supply a Text object for the translation.
toLocale(String? _locale) Locale?
Return a Locale object from the provided String
toString() String
A string representation of this object.
inherited
translate(String word) String
Possibly translate the supplied word.

Operators

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