verifiedLocale function
Implementation
String? verifiedLocale(String? newLocale, bool Function(String) localeExists) {
if (newLocale == null) {
return verifiedLocale(Intl.getCurrentLocale(), localeExists);
}
if (localeExists(newLocale)) {
return newLocale;
}
for (final each in [
canonicalizedLocale(newLocale),
shortLocale(newLocale),
'fallback',
]) {
if (localeExists(each)) {
return each;
}
}
return newLocale;
}