getByLocale static method
Get a localization that is equivalent to locale
. If country is missing
get the localization based on the code, otherwise get
Implementation
static Localization? getByLocale(Locale locale) {
if (locale.countryCode == null) {
return getByCode(locale.languageCode);
} else {
final code = locale.languageCode;
final country = locale.countryCode;
return localizations.firstWhereOrNull(
(loc) => loc.code == code && loc.country == country,
);
}
}