9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-29 11:59:11 +00:00
This commit is contained in:
jhqwqmc
2025-12-22 05:26:54 +08:00
parent 23375d7b0e
commit 3a82fbfb9c
2 changed files with 15 additions and 4 deletions

View File

@@ -308,9 +308,19 @@ public class TranslationManagerImpl implements TranslationManager {
Map<String, String> bundle = new HashMap<>();
for (Map.Entry<String, Object> entry : section.entrySet()) {
String key = entry.getKey();
bundle.put(key, entry.getValue().toString());
TranslationManagerImpl.this.translationKeys.add(key);
StringBuilder key = new StringBuilder(entry.getKey());
Object value = entry.getValue();
for (;;) {
if (!(value instanceof Map<?,?> map)) {
value = entry.getValue();
break;
}
Map.Entry<?, ?> next = map.entrySet().iterator().next();
key.append(".").append(next.getKey());
value = next.getValue();
}
bundle.put(key.toString(), String.valueOf(value));
TranslationManagerImpl.this.translationKeys.add(key.toString());
this.count++;
}