Extended Translation Support
This commit is contained in:
parent
4a4fe40dc0
commit
370f2b9a1c
10 changed files with 116 additions and 33 deletions
|
@ -27,6 +27,7 @@ import the.bytecode.club.bytecodeviewer.plugin.PluginManager;
|
||||||
import the.bytecode.club.bytecodeviewer.plugin.preinstalled.*;
|
import the.bytecode.club.bytecodeviewer.plugin.preinstalled.*;
|
||||||
import the.bytecode.club.bytecodeviewer.resources.exporting.Export;
|
import the.bytecode.club.bytecodeviewer.resources.exporting.Export;
|
||||||
import the.bytecode.club.bytecodeviewer.translation.components.TranslatedJCheckBoxMenuItem;
|
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.util.*;
|
||||||
import the.bytecode.club.bytecodeviewer.resources.ResourceDecompiling;
|
import the.bytecode.club.bytecodeviewer.resources.ResourceDecompiling;
|
||||||
import the.bytecode.club.bytecodeviewer.translation.Language;
|
import the.bytecode.club.bytecodeviewer.translation.Language;
|
||||||
|
@ -396,7 +397,7 @@ public class MainViewerGUI extends JFrame
|
||||||
ButtonGroup rstaGroup = new ButtonGroup();
|
ButtonGroup rstaGroup = new ButtonGroup();
|
||||||
for (RSTATheme t : RSTATheme.values())
|
for (RSTATheme t : RSTATheme.values())
|
||||||
{
|
{
|
||||||
JRadioButtonMenuItem item = new JRadioButtonMenuItem(t.getReadableName());
|
JRadioButtonMenuItem item = new TranslatedJRadioButtonMenuItem(t.getReadableName(), t.getTranslation());
|
||||||
if (Configuration.rstaTheme.equals(t))
|
if (Configuration.rstaTheme.equals(t))
|
||||||
item.setSelected(true);
|
item.setSelected(true);
|
||||||
|
|
||||||
|
@ -416,7 +417,7 @@ public class MainViewerGUI extends JFrame
|
||||||
ButtonGroup lafGroup = new ButtonGroup();
|
ButtonGroup lafGroup = new ButtonGroup();
|
||||||
for (LAFTheme theme : LAFTheme.values())
|
for (LAFTheme theme : LAFTheme.values())
|
||||||
{
|
{
|
||||||
JRadioButtonMenuItem item = new JRadioButtonMenuItem(theme.getReadableName());
|
JRadioButtonMenuItem item = new TranslatedJRadioButtonMenuItem(theme.getReadableName(), theme.getTranslation());
|
||||||
if (Configuration.lafTheme.equals(theme))
|
if (Configuration.lafTheme.equals(theme))
|
||||||
item.setSelected(true);
|
item.setSelected(true);
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package the.bytecode.club.bytecodeviewer.gui.components;
|
||||||
|
|
||||||
import the.bytecode.club.bytecodeviewer.translation.Translation;
|
import the.bytecode.club.bytecodeviewer.translation.Translation;
|
||||||
import the.bytecode.club.bytecodeviewer.translation.components.TranslatedJCheckBoxMenuItem;
|
import the.bytecode.club.bytecodeviewer.translation.components.TranslatedJCheckBoxMenuItem;
|
||||||
|
import the.bytecode.club.bytecodeviewer.translation.components.TranslatedJRadioButtonMenuItem;
|
||||||
import the.bytecode.club.bytecodeviewer.util.RefreshWorkPane;
|
import the.bytecode.club.bytecodeviewer.util.RefreshWorkPane;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
@ -33,8 +34,8 @@ public class DecompilerViewComponent
|
||||||
private final String name;
|
private final String name;
|
||||||
private final boolean hasBytecodeOption;
|
private final boolean hasBytecodeOption;
|
||||||
private final JMenu menu;
|
private final JMenu menu;
|
||||||
private final JRadioButtonMenuItem java = new JRadioButtonMenuItem("Java");
|
private final JRadioButtonMenuItem java = new TranslatedJRadioButtonMenuItem("Java", Translation.JAVA);
|
||||||
private final JRadioButtonMenuItem bytecode = new JRadioButtonMenuItem("Bytecode");
|
private final JRadioButtonMenuItem bytecode = new TranslatedJRadioButtonMenuItem("Bytecode", Translation.BYTECODE);
|
||||||
private final JCheckBoxMenuItem editable = new TranslatedJCheckBoxMenuItem("Editable", Translation.EDITABLE);
|
private final JCheckBoxMenuItem editable = new TranslatedJCheckBoxMenuItem("Editable", Translation.EDITABLE);
|
||||||
|
|
||||||
public DecompilerViewComponent(String name) {
|
public DecompilerViewComponent(String name) {
|
||||||
|
|
|
@ -25,11 +25,12 @@ public class DecompilerSelectionPane
|
||||||
public final DecompilerViewComponent fern = new DecompilerViewComponent("FernFlower");
|
public final DecompilerViewComponent fern = new DecompilerViewComponent("FernFlower");
|
||||||
public final DecompilerViewComponent krakatau = new DecompilerViewComponent("Krakatau", true);
|
public final DecompilerViewComponent krakatau = new DecompilerViewComponent("Krakatau", true);
|
||||||
public final DecompilerViewComponent smali = new DecompilerViewComponent("Smali/DEX");
|
public final DecompilerViewComponent smali = new DecompilerViewComponent("Smali/DEX");
|
||||||
public final JRadioButtonMenuItem hexcode = new JRadioButtonMenuItem("Hexcode");
|
public final JRadioButtonMenuItem hexcode = new TranslatedJRadioButtonMenuItem("Hexcode", Translation.HEXCODE);
|
||||||
public final JRadioButtonMenuItem bytecode = new JRadioButtonMenuItem("Bytecode");
|
public final JRadioButtonMenuItem bytecode = new TranslatedJRadioButtonMenuItem("Bytecode", Translation.BYTECODE);
|
||||||
public final JRadioButtonMenuItem asmTextify = new JRadioButtonMenuItem("ASM Textify");
|
public final JRadioButtonMenuItem asmTextify = new TranslatedJRadioButtonMenuItem("ASM Textify", Translation.ASM_TEXTIFY);
|
||||||
|
|
||||||
public DecompilerSelectionPane(int paneID) {
|
public DecompilerSelectionPane(int paneID)
|
||||||
|
{
|
||||||
this.paneID = paneID;
|
this.paneID = paneID;
|
||||||
if(paneID == 1)
|
if(paneID == 1)
|
||||||
this.menu = new TranslatedJMenu("Pane " + paneID, Translation.PANE_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);
|
this.menu = new TranslatedJMenu("Pane " + paneID, Translation.PANE_2);
|
||||||
else
|
else
|
||||||
this.menu = new TranslatedJMenu("Pane " + paneID, Translation.PANE_3);
|
this.menu = new TranslatedJMenu("Pane " + paneID, Translation.PANE_3);
|
||||||
|
|
||||||
buildMenu();
|
buildMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package the.bytecode.club.bytecodeviewer.gui.theme;
|
||||||
import com.github.weisj.darklaf.LafManager;
|
import com.github.weisj.darklaf.LafManager;
|
||||||
import com.github.weisj.darklaf.theme.DarculaTheme;
|
import com.github.weisj.darklaf.theme.DarculaTheme;
|
||||||
import com.github.weisj.darklaf.theme.IntelliJTheme;
|
import com.github.weisj.darklaf.theme.IntelliJTheme;
|
||||||
|
import the.bytecode.club.bytecodeviewer.translation.Translation;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
|
@ -13,18 +14,20 @@ import javax.swing.*;
|
||||||
*/
|
*/
|
||||||
public enum LAFTheme
|
public enum LAFTheme
|
||||||
{
|
{
|
||||||
SYSTEM("System Theme", RSTATheme.DEFAULT), //System theme
|
SYSTEM("System Theme", RSTATheme.DEFAULT, Translation.SYSTEM_THEME), //System theme
|
||||||
DARK("Dark Theme", RSTATheme.DARK), //DarkLaf
|
DARK("Dark Theme", RSTATheme.DARK, Translation.DARK_THEME), //DarkLaf
|
||||||
LIGHT("Light Theme", RSTATheme.DEFAULT), //Intellij theme
|
LIGHT("Light Theme", RSTATheme.DEFAULT, Translation.LIGHT_THEME), //Intellij theme
|
||||||
;
|
;
|
||||||
|
|
||||||
private final String readableName;
|
private final String readableName;
|
||||||
private final RSTATheme rstaTheme;
|
private final RSTATheme rstaTheme;
|
||||||
|
private final Translation translation;
|
||||||
|
|
||||||
LAFTheme(String readableName, RSTATheme rstaTheme)
|
LAFTheme(String readableName, RSTATheme rstaTheme, Translation translation)
|
||||||
{
|
{
|
||||||
this.readableName = readableName;
|
this.readableName = readableName;
|
||||||
this.rstaTheme = rstaTheme;
|
this.rstaTheme = rstaTheme;
|
||||||
|
this.translation = translation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getReadableName()
|
public String getReadableName()
|
||||||
|
@ -37,6 +40,11 @@ public enum LAFTheme
|
||||||
return rstaTheme;
|
return rstaTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Translation getTranslation()
|
||||||
|
{
|
||||||
|
return translation;
|
||||||
|
}
|
||||||
|
|
||||||
public void setLAF() throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException
|
public void setLAF() throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException
|
||||||
{
|
{
|
||||||
switch(this)
|
switch(this)
|
||||||
|
|
|
@ -3,6 +3,7 @@ package the.bytecode.club.bytecodeviewer.gui.theme;
|
||||||
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
|
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
|
||||||
import org.fife.ui.rsyntaxtextarea.Theme;
|
import org.fife.ui.rsyntaxtextarea.Theme;
|
||||||
import the.bytecode.club.bytecodeviewer.Constants;
|
import the.bytecode.club.bytecodeviewer.Constants;
|
||||||
|
import the.bytecode.club.bytecodeviewer.translation.Translation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ThexXTURBOXx
|
* @author ThexXTURBOXx
|
||||||
|
@ -10,28 +11,35 @@ import the.bytecode.club.bytecodeviewer.Constants;
|
||||||
*/
|
*/
|
||||||
public enum RSTATheme
|
public enum RSTATheme
|
||||||
{
|
{
|
||||||
DEFAULT("Default (Recommended Light)", null),
|
DEFAULT("Default (Recommended Light)", null, Translation.DEFAULT_RECOMMENDED_LIGHT),
|
||||||
DARK("Dark (Recommended Dark)", "/org/fife/ui/rsyntaxtextarea/themes/dark.xml"),
|
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"),
|
DEFAULT_ALT( "Default-Alt", "/org/fife/ui/rsyntaxtextarea/themes/default-alt.xml", Translation.DEFAULT_ALT),
|
||||||
ECLIPSE("Eclipse", "/org/fife/ui/rsyntaxtextarea/themes/eclipse.xml"),
|
ECLIPSE("Eclipse", "/org/fife/ui/rsyntaxtextarea/themes/eclipse.xml", Translation.ECLIPSE),
|
||||||
IDEA("IntelliJ", "/org/fife/ui/rsyntaxtextarea/themes/idea.xml"),
|
IDEA("IntelliJ", "/org/fife/ui/rsyntaxtextarea/themes/idea.xml", Translation.INTELLIJ),
|
||||||
VS("Visual Studio", "/org/fife/ui/rsyntaxtextarea/themes/vs.xml"),
|
VS("Visual Studio", "/org/fife/ui/rsyntaxtextarea/themes/vs.xml", Translation.VISUAL_STUDIO),
|
||||||
DRUID( "Druid (Dark)", "/org/fife/ui/rsyntaxtextarea/themes/druid.xml"),
|
DRUID( "Druid (Dark)", "/org/fife/ui/rsyntaxtextarea/themes/druid.xml", Translation.DRUID_DARK),
|
||||||
MONOKAI( "Monokai (Dark)", "/org/fife/ui/rsyntaxtextarea/themes/monokai.xml");
|
MONOKAI( "Monokai (Dark)", "/org/fife/ui/rsyntaxtextarea/themes/monokai.xml", Translation.MONOKAI_DARK);
|
||||||
|
|
||||||
private final String readableName;
|
private final String readableName;
|
||||||
private final String file;
|
private final String file;
|
||||||
|
private final Translation translation;
|
||||||
|
|
||||||
RSTATheme(String readableName, String file)
|
RSTATheme(String readableName, String file, Translation translation)
|
||||||
{
|
{
|
||||||
this.readableName = readableName;
|
this.readableName = readableName;
|
||||||
this.file = file;
|
this.file = file;
|
||||||
|
this.translation = translation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getReadableName() {
|
public String getReadableName() {
|
||||||
return readableName;
|
return readableName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Translation getTranslation()
|
||||||
|
{
|
||||||
|
return translation;
|
||||||
|
}
|
||||||
|
|
||||||
public RSyntaxTextArea apply(RSyntaxTextArea area) {
|
public RSyntaxTextArea apply(RSyntaxTextArea area) {
|
||||||
if (file != null) {
|
if (file != null) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -53,6 +53,10 @@ public enum Translation
|
||||||
PANE_3,
|
PANE_3,
|
||||||
NONE,
|
NONE,
|
||||||
EDITABLE,
|
EDITABLE,
|
||||||
|
JAVA,
|
||||||
|
BYTECODE,
|
||||||
|
HEXCODE,
|
||||||
|
ASM_TEXTIFY,
|
||||||
|
|
||||||
SETTINGS,
|
SETTINGS,
|
||||||
COMPILE_ON_SAVE,
|
COMPILE_ON_SAVE,
|
||||||
|
@ -85,6 +89,29 @@ public enum Translation
|
||||||
ALLATORI_STRING_DECRYPTER,
|
ALLATORI_STRING_DECRYPTER,
|
||||||
ZSTRINGARRAY_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;
|
private final TranslatedComponent component;
|
||||||
|
|
|
@ -16,12 +16,21 @@ public class TranslatedJCheckBoxMenuItem extends JCheckBoxMenuItem
|
||||||
public TranslatedJCheckBoxMenuItem(String text, Translation translation)
|
public TranslatedJCheckBoxMenuItem(String text, Translation translation)
|
||||||
{
|
{
|
||||||
super(text);
|
super(text);
|
||||||
|
|
||||||
|
if(translation != null)
|
||||||
|
{
|
||||||
this.component = translation.getTranslatedComponent();
|
this.component = translation.getTranslatedComponent();
|
||||||
this.component.runOnUpdate.add(this::updateText);
|
this.component.runOnUpdate.add(this::updateText);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.component = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void updateText()
|
public void updateText()
|
||||||
{
|
{
|
||||||
|
if(component != null)
|
||||||
setText(component.value);
|
setText(component.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,12 +16,21 @@ public class TranslatedJMenu extends JMenu
|
||||||
public TranslatedJMenu(String text, Translation translation)
|
public TranslatedJMenu(String text, Translation translation)
|
||||||
{
|
{
|
||||||
super(text);
|
super(text);
|
||||||
|
|
||||||
|
if(translation != null)
|
||||||
|
{
|
||||||
this.component = translation.getTranslatedComponent();
|
this.component = translation.getTranslatedComponent();
|
||||||
this.component.runOnUpdate.add(this::updateText);
|
this.component.runOnUpdate.add(this::updateText);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.component = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void updateText()
|
public void updateText()
|
||||||
{
|
{
|
||||||
|
if(component != null)
|
||||||
setText(component.value);
|
setText(component.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -16,12 +16,21 @@ public class TranslatedJMenuItem extends JMenuItem
|
||||||
public TranslatedJMenuItem(String text, Translation translation)
|
public TranslatedJMenuItem(String text, Translation translation)
|
||||||
{
|
{
|
||||||
super(text);
|
super(text);
|
||||||
|
|
||||||
|
if(translation != null)
|
||||||
|
{
|
||||||
this.component = translation.getTranslatedComponent();
|
this.component = translation.getTranslatedComponent();
|
||||||
this.component.runOnUpdate.add(this::updateText);
|
this.component.runOnUpdate.add(this::updateText);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.component = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void updateText()
|
public void updateText()
|
||||||
{
|
{
|
||||||
|
if(component != null)
|
||||||
setText(component.value);
|
setText(component.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,12 +16,21 @@ public class TranslatedJRadioButtonMenuItem extends JRadioButtonMenuItem
|
||||||
public TranslatedJRadioButtonMenuItem(String text, Translation translation)
|
public TranslatedJRadioButtonMenuItem(String text, Translation translation)
|
||||||
{
|
{
|
||||||
super(text);
|
super(text);
|
||||||
|
|
||||||
|
if(translation != null)
|
||||||
|
{
|
||||||
this.component = translation.getTranslatedComponent();
|
this.component = translation.getTranslatedComponent();
|
||||||
this.component.runOnUpdate.add(this::updateText);
|
this.component.runOnUpdate.add(this::updateText);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.component = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void updateText()
|
public void updateText()
|
||||||
{
|
{
|
||||||
|
if(component != null)
|
||||||
setText(component.value);
|
setText(component.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue