MPLocalizations class

Localization support for Mobility Package using LocalizationLoader configurations.

Use translate to translate any text, like this:

 MPLocalizations.of(context).translate('key');
Inheritance
  • Object
  • AssetLocalizations
  • MPLocalizations

Constructors

MPLocalizations.new(Locale locale)
Create a localization based on locale.

Properties

filename String
The file name of the localization asset.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
locale Locale
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
staticAssetName String
The name of the static localization asset.
no setter
translations Map<String, String>
A map of available translations for this locale.
getter/setter pairinherited

Methods

canTranslate(String key) bool
Can this key be translated by this localization?
inherited
load({List<LocalizationLoader> loaders = const []}) Future<void>
Load the translations for Mobility Package.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
translate(String key) String
Translate key to this locale. If key is not translated, key is returned 'as-is'.
inherited
translateWithArgs(String key, [Map<String, String>? args]) String
Translate key to this locale. If key is not translated, key is returned 'as-is'. If args is provided, it replaces placeholders in the translation. Example:

Operators

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

Static Properties

delegate LocalizationsDelegate<MPLocalizations>
A default LocalizationsDelegate for MPLocalizations.
getter/setter pair

Static Methods

of(BuildContext context) MPLocalizations?
Returns the localized resources object of type MPLocalizations for the widget tree that corresponds to the given context.
override

Constants

assetPath → const String