do not override data by locale iteration

This commit is contained in:
Marcel Haßlinger 2021-11-10 14:15:10 +01:00
parent 70747bf90a
commit d0aff2f816

View File

@ -88,16 +88,18 @@ public class ModularizedJsonIOStrategy implements IOStrategy {
continue; continue;
} }
TranslationNode moduleNode = new TranslationNode(state.isSortKeys() String moduleName = module.getNameWithoutExtension();
? new TreeMap<>()
: new LinkedHashMap<>()); TranslationNode moduleNode = data.getNode(moduleName) != null
? data.getNode(moduleName)
: new TranslationNode(state.isSortKeys() ? new TreeMap<>() : new LinkedHashMap<>());
JsonObject tree = GSON.fromJson(new InputStreamReader(module.getInputStream(), JsonObject tree = GSON.fromJson(new InputStreamReader(module.getInputStream(),
module.getCharset()), JsonObject.class); module.getCharset()), JsonObject.class);
JsonMapper.read(locale, tree, moduleNode); JsonMapper.read(locale, tree, moduleNode);
data.getRootNode().setChildren(module.getNameWithoutExtension(), moduleNode); data.getRootNode().setChildren(moduleName, moduleNode);
} }
} }