lookupMessage method
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);
}