lookupMessage method

String lookupMessage (String message_str, String locale, String name, List args, String meaning, { MessageIfAbsent ifAbsent })

Look up the message with the given name and locale and return the translated version with the values in args interpolated. If nothing is found, return the result of ifAbsent or message_str. The desc and examples parameters are ignored

Implementation

String lookupMessage(
    String message_str, String locale, String name, List args, String meaning,
    {MessageIfAbsent ifAbsent}) {
  // If passed null, use the default.
  var knownLocale = locale ?? Intl.getCurrentLocale();
  var messages = (knownLocale == _lastLocale)
      ? _lastLookup
      : _lookupMessageCatalog(knownLocale);
  // If we didn't find any messages for this locale, use the original string,
  // faking interpolations if necessary.
  if (messages == null) {
    return ifAbsent == null ? message_str : ifAbsent(message_str, args);
  }
  return messages.lookupMessage(message_str, locale, name, args, meaning,
      ifAbsent: ifAbsent);
}