diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java index 4ccb8bae..7d2f39f3 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java @@ -27,6 +27,7 @@ import the.bytecode.club.bytecodeviewer.plugin.PluginManager; import the.bytecode.club.bytecodeviewer.plugin.preinstalled.*; import the.bytecode.club.bytecodeviewer.resources.exporting.Export; import the.bytecode.club.bytecodeviewer.translation.components.TranslatedJCheckBoxMenuItem; +import the.bytecode.club.bytecodeviewer.translation.components.TranslatedJRadioButtonMenuItem; import the.bytecode.club.bytecodeviewer.util.*; import the.bytecode.club.bytecodeviewer.resources.ResourceDecompiling; import the.bytecode.club.bytecodeviewer.translation.Language; @@ -396,7 +397,7 @@ public class MainViewerGUI extends JFrame ButtonGroup rstaGroup = new ButtonGroup(); for (RSTATheme t : RSTATheme.values()) { - JRadioButtonMenuItem item = new JRadioButtonMenuItem(t.getReadableName()); + JRadioButtonMenuItem item = new TranslatedJRadioButtonMenuItem(t.getReadableName(), t.getTranslation()); if (Configuration.rstaTheme.equals(t)) item.setSelected(true); @@ -416,7 +417,7 @@ public class MainViewerGUI extends JFrame ButtonGroup lafGroup = new ButtonGroup(); for (LAFTheme theme : LAFTheme.values()) { - JRadioButtonMenuItem item = new JRadioButtonMenuItem(theme.getReadableName()); + JRadioButtonMenuItem item = new TranslatedJRadioButtonMenuItem(theme.getReadableName(), theme.getTranslation()); if (Configuration.lafTheme.equals(theme)) item.setSelected(true); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/DecompilerViewComponent.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/DecompilerViewComponent.java index b88f9b0d..13281c90 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/DecompilerViewComponent.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/DecompilerViewComponent.java @@ -2,6 +2,7 @@ package the.bytecode.club.bytecodeviewer.gui.components; import the.bytecode.club.bytecodeviewer.translation.Translation; import the.bytecode.club.bytecodeviewer.translation.components.TranslatedJCheckBoxMenuItem; +import the.bytecode.club.bytecodeviewer.translation.components.TranslatedJRadioButtonMenuItem; import the.bytecode.club.bytecodeviewer.util.RefreshWorkPane; import javax.swing.*; @@ -33,8 +34,8 @@ public class DecompilerViewComponent private final String name; private final boolean hasBytecodeOption; private final JMenu menu; - private final JRadioButtonMenuItem java = new JRadioButtonMenuItem("Java"); - private final JRadioButtonMenuItem bytecode = new JRadioButtonMenuItem("Bytecode"); + private final JRadioButtonMenuItem java = new TranslatedJRadioButtonMenuItem("Java", Translation.JAVA); + private final JRadioButtonMenuItem bytecode = new TranslatedJRadioButtonMenuItem("Bytecode", Translation.BYTECODE); private final JCheckBoxMenuItem editable = new TranslatedJCheckBoxMenuItem("Editable", Translation.EDITABLE); public DecompilerViewComponent(String name) { diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/DecompilerSelectionPane.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/DecompilerSelectionPane.java index 2190f22f..347f86f6 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/DecompilerSelectionPane.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/DecompilerSelectionPane.java @@ -25,11 +25,12 @@ public class DecompilerSelectionPane public final DecompilerViewComponent fern = new DecompilerViewComponent("FernFlower"); public final DecompilerViewComponent krakatau = new DecompilerViewComponent("Krakatau", true); public final DecompilerViewComponent smali = new DecompilerViewComponent("Smali/DEX"); - public final JRadioButtonMenuItem hexcode = new JRadioButtonMenuItem("Hexcode"); - public final JRadioButtonMenuItem bytecode = new JRadioButtonMenuItem("Bytecode"); - public final JRadioButtonMenuItem asmTextify = new JRadioButtonMenuItem("ASM Textify"); + public final JRadioButtonMenuItem hexcode = new TranslatedJRadioButtonMenuItem("Hexcode", Translation.HEXCODE); + public final JRadioButtonMenuItem bytecode = new TranslatedJRadioButtonMenuItem("Bytecode", Translation.BYTECODE); + public final JRadioButtonMenuItem asmTextify = new TranslatedJRadioButtonMenuItem("ASM Textify", Translation.ASM_TEXTIFY); - public DecompilerSelectionPane(int paneID) { + public DecompilerSelectionPane(int paneID) + { this.paneID = paneID; if(paneID == 1) this.menu = new TranslatedJMenu("Pane " + paneID, Translation.PANE_1); @@ -37,6 +38,7 @@ public class DecompilerSelectionPane this.menu = new TranslatedJMenu("Pane " + paneID, Translation.PANE_2); else this.menu = new TranslatedJMenu("Pane " + paneID, Translation.PANE_3); + buildMenu(); } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/theme/LAFTheme.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/theme/LAFTheme.java index 1a65a9a2..df96b02f 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/theme/LAFTheme.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/theme/LAFTheme.java @@ -3,6 +3,7 @@ package the.bytecode.club.bytecodeviewer.gui.theme; import com.github.weisj.darklaf.LafManager; import com.github.weisj.darklaf.theme.DarculaTheme; import com.github.weisj.darklaf.theme.IntelliJTheme; +import the.bytecode.club.bytecodeviewer.translation.Translation; import javax.swing.*; @@ -13,18 +14,20 @@ import javax.swing.*; */ public enum LAFTheme { - SYSTEM("System Theme", RSTATheme.DEFAULT), //System theme - DARK("Dark Theme", RSTATheme.DARK), //DarkLaf - LIGHT("Light Theme", RSTATheme.DEFAULT), //Intellij theme + SYSTEM("System Theme", RSTATheme.DEFAULT, Translation.SYSTEM_THEME), //System theme + DARK("Dark Theme", RSTATheme.DARK, Translation.DARK_THEME), //DarkLaf + LIGHT("Light Theme", RSTATheme.DEFAULT, Translation.LIGHT_THEME), //Intellij theme ; private final String readableName; private final RSTATheme rstaTheme; + private final Translation translation; - LAFTheme(String readableName, RSTATheme rstaTheme) + LAFTheme(String readableName, RSTATheme rstaTheme, Translation translation) { this.readableName = readableName; this.rstaTheme = rstaTheme; + this.translation = translation; } public String getReadableName() @@ -37,6 +40,11 @@ public enum LAFTheme return rstaTheme; } + public Translation getTranslation() + { + return translation; + } + public void setLAF() throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException { switch(this) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/theme/RSTATheme.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/theme/RSTATheme.java index ad82b334..f2df0875 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/theme/RSTATheme.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/theme/RSTATheme.java @@ -3,6 +3,7 @@ package the.bytecode.club.bytecodeviewer.gui.theme; import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; import org.fife.ui.rsyntaxtextarea.Theme; import the.bytecode.club.bytecodeviewer.Constants; +import the.bytecode.club.bytecodeviewer.translation.Translation; /** * @author ThexXTURBOXx @@ -10,28 +11,35 @@ import the.bytecode.club.bytecodeviewer.Constants; */ public enum RSTATheme { - DEFAULT("Default (Recommended Light)", null), - DARK("Dark (Recommended Dark)", "/org/fife/ui/rsyntaxtextarea/themes/dark.xml"), - DEFAULT_ALT( "Default-Alt", "/org/fife/ui/rsyntaxtextarea/themes/default-alt.xml"), - ECLIPSE("Eclipse", "/org/fife/ui/rsyntaxtextarea/themes/eclipse.xml"), - IDEA("IntelliJ", "/org/fife/ui/rsyntaxtextarea/themes/idea.xml"), - VS("Visual Studio", "/org/fife/ui/rsyntaxtextarea/themes/vs.xml"), - DRUID( "Druid (Dark)", "/org/fife/ui/rsyntaxtextarea/themes/druid.xml"), - MONOKAI( "Monokai (Dark)", "/org/fife/ui/rsyntaxtextarea/themes/monokai.xml"); + DEFAULT("Default (Recommended Light)", null, Translation.DEFAULT_RECOMMENDED_LIGHT), + DARK("Dark (Recommended Dark)", "/org/fife/ui/rsyntaxtextarea/themes/dark.xml", Translation.DARK_RECOMMENDED_DARK), + DEFAULT_ALT( "Default-Alt", "/org/fife/ui/rsyntaxtextarea/themes/default-alt.xml", Translation.DEFAULT_ALT), + ECLIPSE("Eclipse", "/org/fife/ui/rsyntaxtextarea/themes/eclipse.xml", Translation.ECLIPSE), + IDEA("IntelliJ", "/org/fife/ui/rsyntaxtextarea/themes/idea.xml", Translation.INTELLIJ), + VS("Visual Studio", "/org/fife/ui/rsyntaxtextarea/themes/vs.xml", Translation.VISUAL_STUDIO), + DRUID( "Druid (Dark)", "/org/fife/ui/rsyntaxtextarea/themes/druid.xml", Translation.DRUID_DARK), + MONOKAI( "Monokai (Dark)", "/org/fife/ui/rsyntaxtextarea/themes/monokai.xml", Translation.MONOKAI_DARK); private final String readableName; private final String file; + private final Translation translation; - RSTATheme(String readableName, String file) + RSTATheme(String readableName, String file, Translation translation) { this.readableName = readableName; this.file = file; + this.translation = translation; } public String getReadableName() { return readableName; } + public Translation getTranslation() + { + return translation; + } + public RSyntaxTextArea apply(RSyntaxTextArea area) { if (file != null) { try { diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/translation/Translation.java b/src/main/java/the/bytecode/club/bytecodeviewer/translation/Translation.java index 466b481d..54da811a 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/translation/Translation.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/translation/Translation.java @@ -53,6 +53,10 @@ public enum Translation PANE_3, NONE, EDITABLE, + JAVA, + BYTECODE, + HEXCODE, + ASM_TEXTIFY, SETTINGS, COMPILE_ON_SAVE, @@ -85,6 +89,29 @@ public enum Translation ALLATORI_STRING_DECRYPTER, ZSTRINGARRAY_DECRYPTER, + DEX_TO_JAR, + ENJARIFY, + PROCYON, + CRF, + FERNFLOWER, + KRAKATAU, + JDGUI, + JADX, + SMALI_DEX, + PROCYON_DECOMPILER, + CRF_DECOMPILER, + FERNFLOWER_DECOMPILER, + JADX_DECOMPILER, + JD_DECOMPILER, + BYTECODE_DISASSEMBLER, + FILES, + QUICK_FILE_SEARCH_NO_FILE_EXTENSION, + WORK_SPACE, + EXACT, + SEARCH, + RESULTS, + REFRESH, + ; private final TranslatedComponent component; diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/translation/components/TranslatedJCheckBoxMenuItem.java b/src/main/java/the/bytecode/club/bytecodeviewer/translation/components/TranslatedJCheckBoxMenuItem.java index e1ef2574..a2d92ad4 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/translation/components/TranslatedJCheckBoxMenuItem.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/translation/components/TranslatedJCheckBoxMenuItem.java @@ -16,12 +16,21 @@ public class TranslatedJCheckBoxMenuItem extends JCheckBoxMenuItem public TranslatedJCheckBoxMenuItem(String text, Translation translation) { super(text); - this.component = translation.getTranslatedComponent(); - this.component.runOnUpdate.add(this::updateText); + + if(translation != null) + { + this.component = translation.getTranslatedComponent(); + this.component.runOnUpdate.add(this::updateText); + } + else + { + this.component = null; + } } public void updateText() { - setText(component.value); + if(component != null) + setText(component.value); } } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/translation/components/TranslatedJMenu.java b/src/main/java/the/bytecode/club/bytecodeviewer/translation/components/TranslatedJMenu.java index 1b2b5b1d..ba096b2d 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/translation/components/TranslatedJMenu.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/translation/components/TranslatedJMenu.java @@ -16,12 +16,21 @@ public class TranslatedJMenu extends JMenu public TranslatedJMenu(String text, Translation translation) { super(text); - this.component = translation.getTranslatedComponent(); - this.component.runOnUpdate.add(this::updateText); + + if(translation != null) + { + this.component = translation.getTranslatedComponent(); + this.component.runOnUpdate.add(this::updateText); + } + else + { + this.component = null; + } } public void updateText() { - setText(component.value); + if(component != null) + setText(component.value); } } \ No newline at end of file diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/translation/components/TranslatedJMenuItem.java b/src/main/java/the/bytecode/club/bytecodeviewer/translation/components/TranslatedJMenuItem.java index 22c8f9b7..1fd4f8ee 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/translation/components/TranslatedJMenuItem.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/translation/components/TranslatedJMenuItem.java @@ -16,12 +16,21 @@ public class TranslatedJMenuItem extends JMenuItem public TranslatedJMenuItem(String text, Translation translation) { super(text); - this.component = translation.getTranslatedComponent(); - this.component.runOnUpdate.add(this::updateText); + + if(translation != null) + { + this.component = translation.getTranslatedComponent(); + this.component.runOnUpdate.add(this::updateText); + } + else + { + this.component = null; + } } public void updateText() { - setText(component.value); + if(component != null) + setText(component.value); } } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/translation/components/TranslatedJRadioButtonMenuItem.java b/src/main/java/the/bytecode/club/bytecodeviewer/translation/components/TranslatedJRadioButtonMenuItem.java index b3e25290..592696cf 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/translation/components/TranslatedJRadioButtonMenuItem.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/translation/components/TranslatedJRadioButtonMenuItem.java @@ -16,12 +16,21 @@ public class TranslatedJRadioButtonMenuItem extends JRadioButtonMenuItem public TranslatedJRadioButtonMenuItem(String text, Translation translation) { super(text); - this.component = translation.getTranslatedComponent(); - this.component.runOnUpdate.add(this::updateText); + + if(translation != null) + { + this.component = translation.getTranslatedComponent(); + this.component.runOnUpdate.add(this::updateText); + } + else + { + this.component = null; + } } public void updateText() { - setText(component.value); + if(component != null) + setText(component.value); } }