Skip to content

CPLocalizations

Localization support for Cognition Package using LocalizationLoader configurations.

Use translate to translate any text, like this:

 CPLocalizations.of(context).translate('key');
Inheritance

Constructors

CPLocalizations

CPLocalizations(
  1. Locale locale
)

Create a localization based on locale.

Constants

assetPath

String const assetPath

Properties

delegate

LocalizationsDelegate<CPLocalizations> delegate
getter/setter pair

A default LocalizationsDelegate for CPLocalizations.

staticAssetName

String get staticAssetName

The name of the static localization asset.

Methods

load

Future<void> load()
override

Load the translations for Cognition Package.

The translations consists of the static names in the package as provided in staticAssetName.

of

CPLocalizations? of(
  1. BuildContext context
)
override

Returns the localized resources object of type CPLocalizations for the widget tree that corresponds to the given context.

Returns null if no resources object of type CPLocalizations exists within the given context.