AssetLocalizations class
Localization support using assets files.
Use translate to translate any text.
All translations should be put in the assets/lang/ folder as json files,
one for each local (e.g., en.jsonor da.json). Note that only the
languageCode of a Locale is used.
Remember to add the assets/lang/ folder to the list of assets in the
pubspec.yaml file like this:
flutter:
assets:
- assets/lang/
...
- Implementers
Constructors
- AssetLocalizations(Locale locale)
-
Create an assets localization based on
locale.
Properties
Methods
-
canTranslate(
String key) → bool -
Can this
keybe translated by this localization? -
load(
) → Future< bool> - Load the translations from filename based on the locale.
-
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
keyto this locale. Ifkeyis not translated,keyis returned 'as-is'.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
of(
BuildContext context) → AssetLocalizations? -
Returns the localized resources object of type AssetLocalizations for the
widget tree that corresponds to the given
context.
Constants
-
delegate
→ const LocalizationsDelegate<
AssetLocalizations> - A default LocalizationsDelegate for AssetLocalizations.