Skip to content

Commit

Permalink
Updated it manifest (#271)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alse72 authored Jan 2, 2024
1 parent ca4ad54 commit 6669d05
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 16 deletions.
8 changes: 4 additions & 4 deletions cleanFiles/src/Definition.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ public class Definition implements JsonObject {
private final Map<String, Property> properties;

public Definition(String lang, String fileName, final Map<String, Property> properties) {
this.lang = lang;
this.lang = lang.equals("en") ? "template" : lang;
this.fileName = fileName;
this.properties = properties;
}

public Definition(Path defPath, final Map<String, Property> properties) {
this.lang = defPath.getParent().getFileName().toString();
this.fileName = defPath.getFileName().toString();
this.properties = properties;
this(defPath.getParent().getFileName().toString(),
defPath.getFileName().toString(),
properties);
}

public String getLang() {
Expand Down
8 changes: 2 additions & 6 deletions cleanFiles/src/FileUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,6 @@ public static void saveJson(Path toFile, Object o) {

private static Path shortenPath(Path toFile) {
int len = toFile.getNameCount();
Path toFileShort = toFile.subpath(len - 2, len);
if (toFileShort.getParent().endsWith("en"))
toFileShort = Paths.get("template", toFileShort.getFileName().toString());
return toFileShort;
return toFile.subpath(len - 2, len);
}

}
}
8 changes: 7 additions & 1 deletion cleanFiles/src/Property.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ public Extended removeEmptyFields() {
}
}

private String name;
private String description;
private DisplayProperties displayProperties;
private DisplayProperties originalDisplayProperties;
private Entry entry;
Expand All @@ -103,7 +105,9 @@ public String getProgressDescription() {

@Override
public boolean isEmpty() {
return (displayProperties == null || displayProperties.isEmpty())
return (name == null || name.isBlank())
&& (description == null || description.isBlank())
&& (displayProperties == null || displayProperties.isEmpty())
&& (originalDisplayProperties == null || originalDisplayProperties.isEmpty())
&& (entry == null || entry.isEmpty())
&& (sourceString == null || sourceString.isBlank()) && (statName == null || statName.isBlank())
Expand All @@ -121,6 +125,8 @@ public boolean isEmpty() {

@Override
public Property removeEmptyFields() {
name = removeEmptyString(name);
description = removeEmptyString(description);
displayProperties = (DisplayProperties) removeEmptyObj(displayProperties);
originalDisplayProperties = (DisplayProperties) removeEmptyObj(originalDisplayProperties);
entry = (Entry) removeEmptyObj(entry);
Expand Down
11 changes: 6 additions & 5 deletions cleanFiles/src/ToTranslate.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import java.util.List;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.stream.Collectors;
Expand All @@ -8,9 +9,9 @@ public class ToTranslate {
private Map<String, Integer> keysTotals;

public ToTranslate(String[] langs) {
this.keysToTranslate = new LinkedHashMap<>();
for (String lang : langs)
keysToTranslate.put(lang, new LinkedHashMap<>());
this.keysToTranslate = new LinkedHashMap<>(langs.length);

Arrays.asList(langs).forEach(lang -> keysToTranslate.put(lang, new LinkedHashMap<>()));

this.keysTotals = new LinkedHashMap<>(langs.length);

Expand All @@ -25,7 +26,7 @@ public ToTranslate(String[] langs) {
keysTotals.compute(def.getLang(), (k, v) -> v == null ? 0 : v + def.getPropertySize());
});

int templateTotal = templateDefs.stream().mapToInt(d -> d.getPropertySize()).sum();
int templateTotal = templateDefs.stream().mapToInt(Definition::getPropertySize).sum();

Map<String, Double> percentages = keysTotals.entrySet().stream().collect(Collectors.toMap(
Map.Entry::getKey, e -> (double) e.getValue() / templateTotal * 100, (a, b) -> a, LinkedHashMap::new));
Expand All @@ -44,4 +45,4 @@ private void removeEmpty() {
keysToTranslate.forEach((k, v) -> v.entrySet().removeIf(entry -> entry.getValue().isEmpty()));
keysToTranslate.entrySet().removeIf(entry -> entry.getValue().isEmpty());
}
}
}
6 changes: 6 additions & 0 deletions it/DestinyLoadoutNameDefinition.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"2166136261": {
"name": "Salva nuova dotazione",
"description": "Salva l'equipaggiamento attuale in questo slot dotazione. Successivamente potrai equipaggiare il tuo personaggio con la dotazione salvata in questo slot."
}
}

0 comments on commit 6669d05

Please sign in to comment.