loadTranslations method

Future<void> loadTranslations(
  1. Locale locale,
  2. Set<String> translations, [
  3. BuildContext? context
])

Loads translations for the given locale and set of translation keys.

locale is the locale for which to load translations. translations is a set of translation keys to load. context is the build context, used to mark the widget tree as needing a rebuild.

Implementation

Future<void> loadTranslations(Locale locale, Set<String> translations,
    [BuildContext? context]) async {
  Map<String, dynamic> newTrs = await loader.loadTranslations(locale,
      supportedLocales: supportedLocales, trs: translations);
  _localizedStrings.addAll(newTrs);
  if (context != null) {
    (context as Element).markNeedsBuild();
  }
}