loadLocale method

Future<void> loadLocale(
  1. E locale
)

Loads the translations of the given locale if not already loaded.

Implementation

Future<void> loadLocale(E locale) async {
  if (translationMap.containsKey(locale)) {
    // already loaded
    return;
  }

  if (translationsLoading.contains(locale)) {
    // already loading
    return;
  }

  translationsLoading.add(locale);
  translationMap[locale] = await locale.build();
  translationsLoading.remove(locale);
}