initializeMessages function

bool initializeMessages(
  1. String localeName
)

User programs should call this before using localeName for messages.

Implementation

bool initializeMessages(String localeName) {
  var availableLocale = Intl.verifiedLocale(
    localeName,
    (locale) => _messageByLocale.containsKey(locale),
    onFailure: (_) => _,
  );
  if (availableLocale == null) {
    return false;
  }

  initializeInternalMessageLookup(() => CompositeMessageLookup());
  messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor);
  return true;
}