normalizeLocale static method
Return the string representation of the locale, normalized (trims spaces and underscore).
Implementation
static String normalizeLocale(Locale locale) {
String str = locale.toString().toLowerCase();
RegExp pattern = RegExp('^[_ ]+|[_ ]+\$');
return str.replaceAll(pattern, '');
}