localesClosing property

String localesClosing

Constant string used in generateLocalesImportFile as the end of the file.

Implementation

String get localesClosing => '''
  default:\n      return null;
}
}

/// User programs should call this before using [localeName] for messages.
Future<bool> initializeMessages(String? localeName) async {
var availableLocale = Intl.verifiedLocale(
  localeName,
  (locale) => _deferredLibraries[locale] != null,
  onFailure: (_) => null);
if (availableLocale == null) {
  return Future.value(false);
}
var lib = _deferredLibraries[availableLocale];
await (lib == null ? Future.value(false) : lib());
initializeInternalMessageLookup(() => CompositeMessageLookup());
messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor);
return Future.value(true);
}

bool _messagesExistFor(String locale) {
try {
  return _findExact(locale) != null;
} catch (e) {
  return false;
}
}

MessageLookupByLibrary? _findGeneratedMessagesFor(String locale) {
var actualLocale = Intl.verifiedLocale(locale, _messagesExistFor,
    onFailure: (_) => null);
if (actualLocale == null) return null;
return _findExact(actualLocale);
}
''';