Do not override existing nodes
This commit is contained in:
parent
f4f1416322
commit
32c2eb20b4
@ -113,8 +113,13 @@ public class JsonTranslatorIO implements TranslatorIO {
|
|||||||
// Try to go one level deeper
|
// Try to go one level deeper
|
||||||
JsonObject childObject = entry.getValue().getAsJsonObject();
|
JsonObject childObject = entry.getValue().getAsJsonObject();
|
||||||
|
|
||||||
LocalizedNode childrenNode = new LocalizedNode(key, new ArrayList<>());
|
LocalizedNode childrenNode = data.getChildren(key);
|
||||||
data.addChildren(childrenNode);
|
|
||||||
|
if(childrenNode == null) {
|
||||||
|
childrenNode = new LocalizedNode(key, new ArrayList<>());
|
||||||
|
data.addChildren(childrenNode);
|
||||||
|
}
|
||||||
|
|
||||||
readTree(locale, childObject, childrenNode);
|
readTree(locale, childObject, childrenNode);
|
||||||
|
|
||||||
} catch(IllegalStateException e) { // Reached end for this node
|
} catch(IllegalStateException e) { // Reached end for this node
|
||||||
@ -128,6 +133,8 @@ public class JsonTranslatorIO implements TranslatorIO {
|
|||||||
Map<String, String> messages = leafNode.getValue();
|
Map<String, String> messages = leafNode.getValue();
|
||||||
messages.put(locale, entry.getValue().getAsString());
|
messages.put(locale, entry.getValue().getAsString());
|
||||||
leafNode.setValue(messages);
|
leafNode.setValue(messages);
|
||||||
|
|
||||||
|
System.out.println("updated key + " + key + "de locale: " + messages.get("locale-de"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user