CPLocalizations class
Localization support for Cognition Package using LocalizationLoader
configurations.
Use translate
to translate any text, like this:
CPLocalizations.of(context).translate('key');
- Inheritance
-
- Object
- AssetLocalizations
- CPLocalizations
Constructors
- CPLocalizations(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(
) → Future< void> -
Load the translations for Cognition 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 thislocale
. Ifkey
is not translated,key
is returned 'as-is'.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
-
delegate
↔ LocalizationsDelegate<
CPLocalizations> -
A default LocalizationsDelegate for CPLocalizations.
getter/setter pair
Static Methods
-
of(
BuildContext context) → CPLocalizations? -
Returns the localized resources object of type CPLocalizations for the
widget tree that corresponds to the given
context
.override