loadMap method
Load locale locale
from a specific map.
If a locale with the same name already exists, it will be overwritten.
The map must be a valid JSON map.
Implementation
void loadMap(String locale, Map<String, dynamic> map) {
final localeData = <String, String>{};
void load(String prefix, dynamic value) {
if (value is String) {
localeData[prefix] = value;
} else if (value is Map) {
value.forEach((key, value) {
var current = key;
if (prefix != '') current = '$prefix.$current';
load(current, value);
});
} else if (value is Iterable) {
value.toList().asMap().forEach((index, value) {
var current = index.toString();
if (prefix != '') current = '$prefix.$current';
load('$prefix.$index', value);
});
}
}
load('', map);
_loadLocale(LocalizerLocale(locale, localeData));
}