load static method

Future<I10n> load(
  1. Locale locale
)

Load the static Map object with the appropriate translations.

Implementation

static Future<I10n> load(Locale locale) async {
  _locale = locale;

//    await initializeDateFormatting(locale.languageCode, null);

  final String localString = locale.toLanguageTag();
  String? code;

  if (_allValues == null) {
    // No means to get the translations.
    _useKey = true;
    _locales ??= ['en-US'];
  } else {
    code = _allValues!.keys.firstWhere(
        (code) => code.toString() == localString,
        orElse: () => '');
    _useKey = code.isEmpty;
  }

  _localizedValues = _useKey ? {} : _allValues![code!];

  return Future.value(I10n());
}