diff options
| author | 2020-03-05 22:17:08 +0000 | |
|---|---|---|
| committer | 2020-03-05 22:17:08 +0000 | |
| commit | 863d40a1c1f6591ef1ee8594b12ae4b0942fe810 (patch) | |
| tree | 614c0e3bc842e1ab50413dcc18b450c96224db10 /src/main/java/cuchaz/enigma/translation/mapping | |
| parent | Fix drop mappings not checking localVars (diff) | |
| download | enigma-fork-863d40a1c1f6591ef1ee8594b12ae4b0942fe810.tar.gz enigma-fork-863d40a1c1f6591ef1ee8594b12ae4b0942fe810.tar.xz enigma-fork-863d40a1c1f6591ef1ee8594b12ae4b0942fe810.zip | |
Made Enigma gui translatable (#193)
* made enigma gui translatable
* key renamings
* missed strings
* string.format() & another missed string
* cached content (thanks @liach)
* added a dialog when changing language
* better sentence
* more %s
* liach's requests
* empty map
* the last (?) missed strings
* IT WORKS
* French translation
* Update fr_fr.json
Diffstat (limited to 'src/main/java/cuchaz/enigma/translation/mapping')
5 files changed, 17 insertions, 12 deletions
diff --git a/src/main/java/cuchaz/enigma/translation/mapping/serde/EnigmaMappingsReader.java b/src/main/java/cuchaz/enigma/translation/mapping/serde/EnigmaMappingsReader.java index 5e49a2a..60ce587 100644 --- a/src/main/java/cuchaz/enigma/translation/mapping/serde/EnigmaMappingsReader.java +++ b/src/main/java/cuchaz/enigma/translation/mapping/serde/EnigmaMappingsReader.java | |||
| @@ -12,6 +12,7 @@ import cuchaz.enigma.translation.mapping.tree.HashEntryTree; | |||
| 12 | import cuchaz.enigma.translation.representation.MethodDescriptor; | 12 | import cuchaz.enigma.translation.representation.MethodDescriptor; |
| 13 | import cuchaz.enigma.translation.representation.TypeDescriptor; | 13 | import cuchaz.enigma.translation.representation.TypeDescriptor; |
| 14 | import cuchaz.enigma.translation.representation.entry.*; | 14 | import cuchaz.enigma.translation.representation.entry.*; |
| 15 | import cuchaz.enigma.utils.I18n; | ||
| 15 | 16 | ||
| 16 | import javax.annotation.Nullable; | 17 | import javax.annotation.Nullable; |
| 17 | import java.io.IOException; | 18 | import java.io.IOException; |
| @@ -28,12 +29,12 @@ public enum EnigmaMappingsReader implements MappingsReader { | |||
| 28 | FILE { | 29 | FILE { |
| 29 | @Override | 30 | @Override |
| 30 | public EntryTree<EntryMapping> read(Path path, ProgressListener progress, MappingSaveParameters saveParameters) throws IOException, MappingParseException { | 31 | public EntryTree<EntryMapping> read(Path path, ProgressListener progress, MappingSaveParameters saveParameters) throws IOException, MappingParseException { |
| 31 | progress.init(1, "Loading mapping file"); | 32 | progress.init(1, I18n.translate("progress.mappings.enigma_file.loading")); |
| 32 | 33 | ||
| 33 | EntryTree<EntryMapping> mappings = new HashEntryTree<>(); | 34 | EntryTree<EntryMapping> mappings = new HashEntryTree<>(); |
| 34 | readFile(path, mappings); | 35 | readFile(path, mappings); |
| 35 | 36 | ||
| 36 | progress.step(1, "Done!"); | 37 | progress.step(1, I18n.translate("progress.mappings.enigma_file.done")); |
| 37 | 38 | ||
| 38 | return mappings; | 39 | return mappings; |
| 39 | } | 40 | } |
| @@ -48,7 +49,7 @@ public enum EnigmaMappingsReader implements MappingsReader { | |||
| 48 | .filter(f -> f.toString().endsWith(".mapping")) | 49 | .filter(f -> f.toString().endsWith(".mapping")) |
| 49 | .collect(Collectors.toList()); | 50 | .collect(Collectors.toList()); |
| 50 | 51 | ||
| 51 | progress.init(files.size(), "Loading mapping files"); | 52 | progress.init(files.size(), I18n.translate("progress.mappings.enigma_directory.loading")); |
| 52 | int step = 0; | 53 | int step = 0; |
| 53 | 54 | ||
| 54 | for (Path file : files) { | 55 | for (Path file : files) { |
diff --git a/src/main/java/cuchaz/enigma/translation/mapping/serde/EnigmaMappingsWriter.java b/src/main/java/cuchaz/enigma/translation/mapping/serde/EnigmaMappingsWriter.java index f490b1d..2ce1234 100644 --- a/src/main/java/cuchaz/enigma/translation/mapping/serde/EnigmaMappingsWriter.java +++ b/src/main/java/cuchaz/enigma/translation/mapping/serde/EnigmaMappingsWriter.java | |||
| @@ -40,6 +40,7 @@ import cuchaz.enigma.translation.representation.entry.Entry; | |||
| 40 | import cuchaz.enigma.translation.representation.entry.FieldEntry; | 40 | import cuchaz.enigma.translation.representation.entry.FieldEntry; |
| 41 | import cuchaz.enigma.translation.representation.entry.LocalVariableEntry; | 41 | import cuchaz.enigma.translation.representation.entry.LocalVariableEntry; |
| 42 | import cuchaz.enigma.translation.representation.entry.MethodEntry; | 42 | import cuchaz.enigma.translation.representation.entry.MethodEntry; |
| 43 | import cuchaz.enigma.utils.I18n; | ||
| 43 | import cuchaz.enigma.utils.LFPrintWriter; | 44 | import cuchaz.enigma.utils.LFPrintWriter; |
| 44 | 45 | ||
| 45 | public enum EnigmaMappingsWriter implements MappingsWriter { | 46 | public enum EnigmaMappingsWriter implements MappingsWriter { |
| @@ -51,7 +52,7 @@ public enum EnigmaMappingsWriter implements MappingsWriter { | |||
| 51 | .map(entry -> (ClassEntry) entry) | 52 | .map(entry -> (ClassEntry) entry) |
| 52 | .collect(Collectors.toList()); | 53 | .collect(Collectors.toList()); |
| 53 | 54 | ||
| 54 | progress.init(classes.size(), "Writing classes"); | 55 | progress.init(classes.size(), I18n.translate("progress.mappings.enigma_file.writing")); |
| 55 | 56 | ||
| 56 | int steps = 0; | 57 | int steps = 0; |
| 57 | try (PrintWriter writer = new LFPrintWriter(Files.newBufferedWriter(path))) { | 58 | try (PrintWriter writer = new LFPrintWriter(Files.newBufferedWriter(path))) { |
| @@ -74,7 +75,7 @@ public enum EnigmaMappingsWriter implements MappingsWriter { | |||
| 74 | 75 | ||
| 75 | applyDeletions(path, changedClasses, mappings, delta.getBaseMappings(), saveParameters.getFileNameFormat()); | 76 | applyDeletions(path, changedClasses, mappings, delta.getBaseMappings(), saveParameters.getFileNameFormat()); |
| 76 | 77 | ||
| 77 | progress.init(changedClasses.size(), "Writing classes"); | 78 | progress.init(changedClasses.size(), I18n.translate("progress.mappings.enigma_directory.writing")); |
| 78 | 79 | ||
| 79 | AtomicInteger steps = new AtomicInteger(); | 80 | AtomicInteger steps = new AtomicInteger(); |
| 80 | 81 | ||
diff --git a/src/main/java/cuchaz/enigma/translation/mapping/serde/SrgMappingsWriter.java b/src/main/java/cuchaz/enigma/translation/mapping/serde/SrgMappingsWriter.java index 1270d51..f67f8fc 100644 --- a/src/main/java/cuchaz/enigma/translation/mapping/serde/SrgMappingsWriter.java +++ b/src/main/java/cuchaz/enigma/translation/mapping/serde/SrgMappingsWriter.java | |||
| @@ -14,6 +14,7 @@ import cuchaz.enigma.translation.representation.entry.ClassEntry; | |||
| 14 | import cuchaz.enigma.translation.representation.entry.Entry; | 14 | import cuchaz.enigma.translation.representation.entry.Entry; |
| 15 | import cuchaz.enigma.translation.representation.entry.FieldEntry; | 15 | import cuchaz.enigma.translation.representation.entry.FieldEntry; |
| 16 | import cuchaz.enigma.translation.representation.entry.MethodEntry; | 16 | import cuchaz.enigma.translation.representation.entry.MethodEntry; |
| 17 | import cuchaz.enigma.utils.I18n; | ||
| 17 | import cuchaz.enigma.utils.LFPrintWriter; | 18 | import cuchaz.enigma.utils.LFPrintWriter; |
| 18 | 19 | ||
| 19 | import java.io.IOException; | 20 | import java.io.IOException; |
| @@ -45,7 +46,7 @@ public enum SrgMappingsWriter implements MappingsWriter { | |||
| 45 | Collection<Entry<?>> rootEntries = Lists.newArrayList(mappings).stream() | 46 | Collection<Entry<?>> rootEntries = Lists.newArrayList(mappings).stream() |
| 46 | .map(EntryTreeNode::getEntry) | 47 | .map(EntryTreeNode::getEntry) |
| 47 | .collect(Collectors.toList()); | 48 | .collect(Collectors.toList()); |
| 48 | progress.init(rootEntries.size(), "Generating mappings"); | 49 | progress.init(rootEntries.size(), I18n.translate("progress.mappings.srg_file.generating")); |
| 49 | 50 | ||
| 50 | int steps = 0; | 51 | int steps = 0; |
| 51 | for (Entry<?> entry : sorted(rootEntries)) { | 52 | for (Entry<?> entry : sorted(rootEntries)) { |
| @@ -53,13 +54,13 @@ public enum SrgMappingsWriter implements MappingsWriter { | |||
| 53 | writeEntry(classLines, fieldLines, methodLines, mappings, entry); | 54 | writeEntry(classLines, fieldLines, methodLines, mappings, entry); |
| 54 | } | 55 | } |
| 55 | 56 | ||
| 56 | progress.init(3, "Writing mappings"); | 57 | progress.init(3, I18n.translate("progress.mappings.srg_file.writing")); |
| 57 | try (PrintWriter writer = new LFPrintWriter(Files.newBufferedWriter(path))) { | 58 | try (PrintWriter writer = new LFPrintWriter(Files.newBufferedWriter(path))) { |
| 58 | progress.step(0, "Classes"); | 59 | progress.step(0, I18n.translate("type.classes")); |
| 59 | classLines.forEach(writer::println); | 60 | classLines.forEach(writer::println); |
| 60 | progress.step(1, "Fields"); | 61 | progress.step(1, I18n.translate("type.fields")); |
| 61 | fieldLines.forEach(writer::println); | 62 | fieldLines.forEach(writer::println); |
| 62 | progress.step(2, "Methods"); | 63 | progress.step(2, I18n.translate("type.methods")); |
| 63 | methodLines.forEach(writer::println); | 64 | methodLines.forEach(writer::println); |
| 64 | } catch (IOException e) { | 65 | } catch (IOException e) { |
| 65 | e.printStackTrace(); | 66 | e.printStackTrace(); |
diff --git a/src/main/java/cuchaz/enigma/translation/mapping/serde/TinyMappingsReader.java b/src/main/java/cuchaz/enigma/translation/mapping/serde/TinyMappingsReader.java index aceb02f..773c95e 100644 --- a/src/main/java/cuchaz/enigma/translation/mapping/serde/TinyMappingsReader.java +++ b/src/main/java/cuchaz/enigma/translation/mapping/serde/TinyMappingsReader.java | |||
| @@ -14,6 +14,7 @@ import cuchaz.enigma.translation.representation.entry.ClassEntry; | |||
| 14 | import cuchaz.enigma.translation.representation.entry.FieldEntry; | 14 | import cuchaz.enigma.translation.representation.entry.FieldEntry; |
| 15 | import cuchaz.enigma.translation.representation.entry.LocalVariableEntry; | 15 | import cuchaz.enigma.translation.representation.entry.LocalVariableEntry; |
| 16 | import cuchaz.enigma.translation.representation.entry.MethodEntry; | 16 | import cuchaz.enigma.translation.representation.entry.MethodEntry; |
| 17 | import cuchaz.enigma.utils.I18n; | ||
| 17 | 18 | ||
| 18 | import java.io.IOException; | 19 | import java.io.IOException; |
| 19 | import java.nio.file.Files; | 20 | import java.nio.file.Files; |
| @@ -32,7 +33,7 @@ public enum TinyMappingsReader implements MappingsReader { | |||
| 32 | EntryTree<EntryMapping> mappings = new HashEntryTree<>(); | 33 | EntryTree<EntryMapping> mappings = new HashEntryTree<>(); |
| 33 | lines.remove(0); | 34 | lines.remove(0); |
| 34 | 35 | ||
| 35 | progress.init(lines.size(), "Loading mapping file"); | 36 | progress.init(lines.size(), I18n.translate("progress.mappings.tiny_file.loading")); |
| 36 | 37 | ||
| 37 | for (int lineNumber = 0; lineNumber < lines.size(); lineNumber++) { | 38 | for (int lineNumber = 0; lineNumber < lines.size(); lineNumber++) { |
| 38 | progress.step(lineNumber, ""); | 39 | progress.step(lineNumber, ""); |
diff --git a/src/main/java/cuchaz/enigma/translation/mapping/serde/TinyV2Reader.java b/src/main/java/cuchaz/enigma/translation/mapping/serde/TinyV2Reader.java index c0488e9..a47143a 100644 --- a/src/main/java/cuchaz/enigma/translation/mapping/serde/TinyV2Reader.java +++ b/src/main/java/cuchaz/enigma/translation/mapping/serde/TinyV2Reader.java | |||
| @@ -14,6 +14,7 @@ import cuchaz.enigma.translation.representation.entry.Entry; | |||
| 14 | import cuchaz.enigma.translation.representation.entry.FieldEntry; | 14 | import cuchaz.enigma.translation.representation.entry.FieldEntry; |
| 15 | import cuchaz.enigma.translation.representation.entry.LocalVariableEntry; | 15 | import cuchaz.enigma.translation.representation.entry.LocalVariableEntry; |
| 16 | import cuchaz.enigma.translation.representation.entry.MethodEntry; | 16 | import cuchaz.enigma.translation.representation.entry.MethodEntry; |
| 17 | import cuchaz.enigma.utils.I18n; | ||
| 17 | 18 | ||
| 18 | import java.io.IOException; | 19 | import java.io.IOException; |
| 19 | import java.nio.charset.StandardCharsets; | 20 | import java.nio.charset.StandardCharsets; |
| @@ -45,7 +46,7 @@ final class TinyV2Reader implements MappingsReader { | |||
| 45 | private EntryTree<EntryMapping> read(Path path, List<String> lines, ProgressListener progress) throws MappingParseException { | 46 | private EntryTree<EntryMapping> read(Path path, List<String> lines, ProgressListener progress) throws MappingParseException { |
| 46 | EntryTree<EntryMapping> mappings = new HashEntryTree<>(); | 47 | EntryTree<EntryMapping> mappings = new HashEntryTree<>(); |
| 47 | 48 | ||
| 48 | progress.init(lines.size(), "Loading mapping file"); | 49 | progress.init(lines.size(), I18n.translate("progress.mappings.tiny_v2.loading")); |
| 49 | 50 | ||
| 50 | BitSet state = new BitSet(STATE_SIZE); | 51 | BitSet state = new BitSet(STATE_SIZE); |
| 51 | @SuppressWarnings({"unchecked", "rawtypes"}) | 52 | @SuppressWarnings({"unchecked", "rawtypes"}) |