for (Locale locale: Arrays.asList(Locale.getDefault(), Locale.ENGLISH, Locale.GERMAN, Locale.GERMANY)) {
resourcesMap.putIfAbsent(locale, prepareLocalizedResources(locale));
}
}
private ObjectNode prepareLocalizedResources(Locale locale) {
ObjectNode resources = JsonNodeFactory.instance.objectNode();
ObjectNode resourcesTree = JsonNodeFactory.instance.objectNode();
resources.put("${symbol_dollar}tree", resourcesTree);
Iterable<Map.Entry<Object, Object>> entries = Utils.IterableIterator.from(
messageSource.getProperties(locale).entrySet(),
applicationMessageSource.getProperties(locale).entrySet()
);
for (Map.Entry<Object, Object> entry: entries) {
String key = entry.getKey().toString();
String value = entry.getValue().toString();
String[] keyParts = key.split("${symbol_escape}${symbol_escape}.");
// go down the object properties
ObjectNode node = resourcesTree;
for (String keyPart : keyParts) {
JsonNode child = node.get(keyPart);
ObjectNode childObject;
if (child == null) {
childObject = JsonNodeFactory.instance.objectNode();
node.put(keyPart, childObject);
} else {