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.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);
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -16,12 +16,21 @@ public class TranslatedJCheckBoxMenuItem extends JCheckBoxMenuItem
|
|||
public TranslatedJCheckBoxMenuItem(String text, Translation translation)
|
||||
{
|
||||
super(text);
|
||||
|
||||
if(translation != null)
|
||||
{
|
||||
this.component = translation.getTranslatedComponent();
|
||||
this.component.runOnUpdate.add(this::updateText);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.component = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void updateText()
|
||||
{
|
||||
if(component != null)
|
||||
setText(component.value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,12 +16,21 @@ public class TranslatedJMenu extends JMenu
|
|||
public TranslatedJMenu(String text, Translation translation)
|
||||
{
|
||||
super(text);
|
||||
|
||||
if(translation != null)
|
||||
{
|
||||
this.component = translation.getTranslatedComponent();
|
||||
this.component.runOnUpdate.add(this::updateText);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.component = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void updateText()
|
||||
{
|
||||
if(component != null)
|
||||
setText(component.value);
|
||||
}
|
||||
}
|
|
@ -16,12 +16,21 @@ public class TranslatedJMenuItem extends JMenuItem
|
|||
public TranslatedJMenuItem(String text, Translation translation)
|
||||
{
|
||||
super(text);
|
||||
|
||||
if(translation != null)
|
||||
{
|
||||
this.component = translation.getTranslatedComponent();
|
||||
this.component.runOnUpdate.add(this::updateText);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.component = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void updateText()
|
||||
{
|
||||
if(component != null)
|
||||
setText(component.value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,12 +16,21 @@ public class TranslatedJRadioButtonMenuItem extends JRadioButtonMenuItem
|
|||
public TranslatedJRadioButtonMenuItem(String text, Translation translation)
|
||||
{
|
||||
super(text);
|
||||
|
||||
if(translation != null)
|
||||
{
|
||||
this.component = translation.getTranslatedComponent();
|
||||
this.component.runOnUpdate.add(this::updateText);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.component = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void updateText()
|
||||
{
|
||||
if(component != null)
|
||||
setText(component.value);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue