Fix identation

This commit is contained in:
Andrii Shvaika 2025-05-19 17:12:29 +03:00
parent a1ad345f86
commit de62ab24fd

View File

@ -1,5 +1,8 @@
package org.thingsboard.client.tools.i18n; package org.thingsboard.client.tools.i18n;
import com.fasterxml.jackson.core.util.DefaultPrettyPrinter;
import com.fasterxml.jackson.core.util.Separators;
import com.fasterxml.jackson.core.util.Separators.Spacing;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.ObjectNode;
@ -73,8 +76,9 @@ public class TranslationPruner {
throw new IllegalArgumentException("Source JSON must be an object at root"); throw new IllegalArgumentException("Source JSON must be an object at root");
} }
ObjectNode pruned = pruneNode((ObjectNode) sourceRoot, validKeys, "", mapper); ObjectNode pruned = pruneNode((ObjectNode) sourceRoot, validKeys, "", mapper);
Separators seps = Separators.createDefaultInstance()
mapper.writerWithDefaultPrettyPrinter().writeValue(destFile, pruned); .withObjectFieldValueSpacing(Spacing.AFTER);
mapper.writer(new DefaultPrettyPrinter().withSeparators(seps)).writeValue(destFile, pruned);
System.out.println("Pruned translation written to " + destFile.getPath()); System.out.println("Pruned translation written to " + destFile.getPath());
} }
} catch (IOException e) { } catch (IOException e) {