lookupMessage method

  1. @override
String? lookupMessage(
  1. String? messageText,
  2. String? locale,
  3. String? name,
  4. List<Object>? args,
  5. String? meaning, {
  6. 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 messageText.

Implementation

@override
String? lookupMessage(String? messageText, String? locale, String? name,
    List<Object>? 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 ? messageText : ifAbsent(messageText, args);
  }
  return messages.lookupMessage(messageText, locale, name, args, meaning,
      ifAbsent: ifAbsent);
}