L10n class abstract

The Translations Manager Class

Inheritance

Constructors

L10n()

Properties

delegate → LocalizationsDelegate<L10n>?
Supply the Localization Delegate (It's itself!)
no setter
hashCode → int
The hash code for this object.
no setterinherited
l10nMap → Map<Locale, Map<String, String>>
The app's translations
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
supportedLocales → List<Locale>
Supported Locales
no setter
textLocale → Locale
The text's original Locale
no setter
type → Type
The type of the object returned by the load method, T by default.
no setterinherited

Methods

getLocale(int index) → Locale?
Get a Locale from the List of 'supported' Locales.
isSupported(Locale locale) → bool
Indicate to the Flutter framework this delegate can support the passed Locale.
override
load([Locale? locale]) → Future<L10n>
Start loading the resources for locale. The returned future completes when the resources have finished loading.
override
localeResolutionCallback(Locale? preferredLocale, 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
setAppBackupLocale(Locale? locale) → void
Set the 'backup' Locale to use.
shouldReload(covariant L10n old) → bool
Reload if the delegate has changed.
override
toString() → String
A string representation of this object.
inherited

Operators

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

Static 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
deviceLocale → Locale?
Intended to store the device's original Locale.
no setter
translations → Map<Locale, Map<String, String>>
Translation Map
no setter

Static Methods

appendTranslations(Map<Locale, Map<String, String>> tr) → void
Add additional Translations Overwrite existing Translation
clearTranslations() → void
Clear the Translations Map variable
localeOf(BuildContext? context, {bool? allowLocaleChange}) → Locale?
Record the device's Locale at that point in time. Traditionally placed in a build() function.
of(BuildContext context) → L10n?
Return an instance of the L10Locale class Really not needed. L10n. prefix can be used instead. Merely for conformity.
s(String? word) → String
Translate the String
setAppLocale(Locale? locale) → bool
A more verbose method name
setLocale(Locale? locale) → bool
Explicitly set a supported Locale using this class 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
translate(String word) → String
Possibly translate the supplied word.