getTextForLocale method
The text for textId in locale, searching in order:
locale, the given form;locale, no form (if fallbackDefaultForm and a form was given);- then the same in the default locale, if both fallbacks are on and
localeisn't the default.
Returns null if nothing is found. Throws
UnregisteredLocaleException if locale is null or undefined.
Implementation
String? getTextForLocale(String textId, String? locale) {
var text = getRawText(locale, textId);
if (text == null && fallbackDefaultForm && textId.contains(';')) {
text = getRawText(locale, textId.substring(0, textId.indexOf(';')));
}
final defaultLocale = _defaultLocale;
if (text == null &&
fallbackDefaultLocale &&
locale != defaultLocale &&
defaultLocale != null &&
fallbackDefaultForm) {
text = getTextForLocale(textId, defaultLocale);
}
return text;
}