Skip to content

RPLocalizations

Localization support for Research Package using LocalizationLoader configurations.

Use translate to translate any text, like this:

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

Constructors

RPLocalizations

RPLocalizations(
  1. Locale locale
)

Create a localization based on locale.

Constants

assetPath

String const assetPath

Properties

delegate

LocalizationsDelegate<RPLocalizations> delegate
getter/setter pair

A default LocalizationsDelegate for RPLocalizations.

This default delegate loads translations from the assets/lang file path.

staticAssetName

String get staticAssetName

The name of the static localization asset.

Methods

load

Future<void> load({
  1. List<LocalizationLoader> loaders = const [],
})
override

Load the translations for Research Package.

The translations is a combination of the static names in the package as provided in staticAssetName combined with translations of the any text provided by the loaders, which knows how to load translations.

of

RPLocalizations? of(
  1. BuildContext context
)
override

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

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