BloomCatalog.fromJson constructor
Creates a BloomCatalog from a dynamic map, converting values to strings.
Useful when parsing translation bundles loaded from JSON assets or network endpoints.
final rawJson = {'home.title': 'Dashboard', 'home.unread': '{count, plural, =0 {None} other {# unread}}'};
final catalog = BloomCatalog.fromJson('en-US', rawJson);
Implementation
factory BloomCatalog.fromJson(String locale, Map<String, dynamic> json) {
final messages = <String, String>{};
json.forEach((key, value) {
if (value != null) {
messages[key] = value.toString();
}
});
return BloomCatalog(locale, messages);
}