Skip to content
This repository was archived by the owner on Jan 2, 2023. It is now read-only.

Commit 3c39b3e

Browse files
committed
i18n
1 parent 6e120b5 commit 3c39b3e

17 files changed

+139
-70
lines changed

src/main/java/cn/enaium/joe/JavaOctetEditor.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,25 @@ public class JavaOctetEditor {
4949

5050
public Jar jar;
5151

52-
public FileTabbedPanel fileTabbedPanel = new FileTabbedPanel();
52+
public FileTabbedPanel fileTabbedPanel;
5353

54-
public FileTreePanel fileTreePanel = new FileTreePanel();
54+
public FileTreePanel fileTreePanel;
5555

56-
public BottomPanel bottomPanel = new BottomPanel();
56+
public BottomPanel bottomPanel;
5757

58-
public ConfigManager configManager = new ConfigManager();
58+
public ConfigManager configManager;
5959

6060
public JavaOctetEditor() {
6161
instance = this;
62+
configManager = new ConfigManager();
63+
configManager.load();
64+
Runtime.getRuntime().addShutdownHook(new Thread(configManager::save));
65+
fileTabbedPanel = new FileTabbedPanel();
66+
fileTreePanel = new FileTreePanel();
67+
bottomPanel = new BottomPanel();
6268
}
6369

6470
public void run() {
65-
configManager.load();
66-
Runtime.getRuntime().addShutdownHook(new Thread(configManager::save));
6771

6872
ToolTipManager.sharedInstance().setInitialDelay(0);
6973

@@ -91,7 +95,7 @@ public void run() {
9195
window.addWindowListener(new WindowAdapter() {
9296
@Override
9397
public void windowClosing(WindowEvent e) {
94-
MessageUtil.confirm(LangUtil.i18n("dialog.wantCloseWindow"), "WARNING", () -> {
98+
MessageUtil.confirm(LangUtil.i18n("dialog.wantCloseWindow"), LangUtil.i18n("warning"), () -> {
9599
window.dispose();
96100
System.exit(0);
97101
}, () -> {

src/main/java/cn/enaium/joe/gui/panel/confirm/BootstrapMethodArgumentEditPanel.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package cn.enaium.joe.gui.panel.confirm;
1818

19+
import cn.enaium.joe.util.LangUtil;
1920
import cn.enaium.joe.util.MessageUtil;
2021
import cn.enaium.joe.wrapper.Wrapper;
2122
import org.objectweb.asm.Handle;
@@ -40,7 +41,7 @@ public BootstrapMethodArgumentEditPanel(Wrapper<Object[]> wrapper) {
4041
}
4142
add(new JScrollPane(objectJList), BorderLayout.CENTER);
4243
add(new JPanel() {{
43-
add(new JButton("Add") {{
44+
add(new JButton(LangUtil.i18n("button.add")) {{
4445
addActionListener(e -> {
4546
MessageUtil.confirm(new ConfirmPanel() {{
4647
setLayout(new BorderLayout());
@@ -49,9 +50,9 @@ public BootstrapMethodArgumentEditPanel(Wrapper<Object[]> wrapper) {
4950
add(left, BorderLayout.WEST);
5051
add(right, BorderLayout.CENTER);
5152
JComboBox<String> jComboBox = new JComboBox<>(new String[]{"String", "float", "double", "int", "long", "Class"});
52-
left.add(new JLabel("Type:"));
53+
left.add(new JLabel(LangUtil.i18n("instruction.type")));
5354
right.add(jComboBox);
54-
left.add(new JLabel("Var:"));
55+
left.add(new JLabel(LangUtil.i18n("instruction.var")));
5556
JTextField ldc = new JTextField();
5657
right.add(ldc);
5758
setConfirm(() -> {
@@ -79,7 +80,7 @@ public BootstrapMethodArgumentEditPanel(Wrapper<Object[]> wrapper) {
7980
objectDefaultListModel.addElement(value);
8081
}
8182
});
82-
}}, "Add");
83+
}}, LangUtil.i18n("button.add"));
8384
});
8485
}});
8586
add(new JButton("Add Handle") {{
@@ -93,7 +94,7 @@ public BootstrapMethodArgumentEditPanel(Wrapper<Object[]> wrapper) {
9394
});
9495
});
9596
}});
96-
add(new JButton("Remove") {{
97+
add(new JButton(LangUtil.i18n("button.remove")) {{
9798
addActionListener(e -> {
9899
if (objectJList.getSelectedIndex() != -1) {
99100
objectDefaultListModel.remove(objectJList.getSelectedIndex());

src/main/java/cn/enaium/joe/gui/panel/confirm/FrameListEditPanel.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package cn.enaium.joe.gui.panel.confirm;
1818

19+
import cn.enaium.joe.util.LangUtil;
1920
import cn.enaium.joe.util.MessageUtil;
2021
import cn.enaium.joe.util.OpcodeUtil;
2122
import cn.enaium.joe.util.StringUtil;
@@ -106,7 +107,7 @@ public ObjectList(List<Object> list) {
106107
});
107108
});
108109
}});
109-
add(new JButton("Remove") {{
110+
add(new JButton(LangUtil.i18n("button.remove")) {{
110111
addActionListener(e -> {
111112
if (jList.getSelectedIndex() != -1) {
112113
stringDefaultListModel.remove(jList.getSelectedIndex());

src/main/java/cn/enaium/joe/gui/panel/confirm/InstructionEditPanel.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package cn.enaium.joe.gui.panel.confirm;
1818

1919
import cn.enaium.joe.gui.panel.instruction.*;
20+
import cn.enaium.joe.util.LangUtil;
2021
import cn.enaium.joe.util.MessageUtil;
2122
import cn.enaium.joe.util.OpcodeUtil;
2223
import org.objectweb.asm.tree.*;
@@ -87,7 +88,7 @@ public InstructionEditPanel(AbstractInsnNode instruction) {
8788
setConfirm(() -> {
8889
try {
8990
if (!finalAbstractInstructionPanel.getConfirm().call()) {
90-
MessageUtil.info("Failed");
91+
MessageUtil.info(LangUtil.i18n("fail"));
9192
}
9293
} catch (Exception ex) {
9394
MessageUtil.error(ex);

src/main/java/cn/enaium/joe/gui/panel/confirm/LabelListEditPanel.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package cn.enaium.joe.gui.panel.confirm;
1818

19+
import cn.enaium.joe.util.LangUtil;
1920
import cn.enaium.joe.util.MessageUtil;
2021
import cn.enaium.joe.wrapper.LabelNodeWrapper;
2122
import cn.enaium.joe.wrapper.Wrapper;
@@ -41,7 +42,7 @@ public LabelListEditPanel(List<LabelNode> labelNodes, InsnList instructions) {
4142
}
4243
add(new JScrollPane(labelNodeWrapperJList), BorderLayout.CENTER);
4344
add(new JPanel() {{
44-
add(new JButton("Add") {{
45+
add(new JButton(LangUtil.i18n("button.add")) {{
4546
addActionListener(e -> {
4647
DefaultComboBoxModel<LabelNodeWrapper> labelNodeWrapperDefaultComboBoxModel = new DefaultComboBoxModel<>();
4748
JComboBox<LabelNodeWrapper> labelNodeWrapperJComboBox = new JComboBox<>(labelNodeWrapperDefaultComboBoxModel);
@@ -58,7 +59,7 @@ public LabelListEditPanel(List<LabelNode> labelNodes, InsnList instructions) {
5859
});
5960
});
6061
}});
61-
add(new JButton("Remove") {{
62+
add(new JButton(LangUtil.i18n("button.remove")) {{
6263
addActionListener(e -> {
6364
if (labelNodeWrapperJList.getSelectedIndex() != -1) {
6465
labelNodeWrapperDefaultListModel.remove(labelNodeWrapperJList.getSelectedIndex());

src/main/java/cn/enaium/joe/gui/panel/confirm/LookupSwitchEditPanel.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package cn.enaium.joe.gui.panel.confirm;
1818

1919
import cn.enaium.joe.gui.component.LabelNodeComboBox;
20+
import cn.enaium.joe.util.LangUtil;
2021
import cn.enaium.joe.util.MessageUtil;
2122
import cn.enaium.joe.wrapper.LabelNodeWrapper;
2223
import org.objectweb.asm.tree.LabelNode;
@@ -46,7 +47,7 @@ public boolean isCellEditable(int row, int column) {
4647
}
4748
add(new JScrollPane(jTable), BorderLayout.CENTER);
4849
add(new JPanel() {{
49-
add(new JButton("Add") {{
50+
add(new JButton(LangUtil.i18n("button.add")) {{
5051
addActionListener(e -> {
5152
MessageUtil.confirm(new ConfirmPanel() {{
5253
JSpinner key = new JSpinner();
@@ -62,7 +63,7 @@ public boolean isCellEditable(int row, int column) {
6263
}}, "Add");
6364
});
6465
}});
65-
add(new JButton("Remove") {{
66+
add(new JButton(LangUtil.i18n("button.remove")) {{
6667
addActionListener(e -> {
6768
if (jTable.getSelectedRow() != -1) {
6869
dm.removeRow(jTable.getSelectedRow());

src/main/java/cn/enaium/joe/gui/panel/file/tabbed/tab/classes/ASMifierTablePanel.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import cn.enaium.joe.JavaOctetEditor;
2020
import cn.enaium.joe.gui.panel.CodeAreaPanel;
2121
import cn.enaium.joe.util.ASyncUtil;
22+
import cn.enaium.joe.util.LangUtil;
2223
import javassist.ClassPool;
2324
import javassist.CtClass;
2425
import javassist.CtMethod;
@@ -80,7 +81,7 @@ public void keyPressed(KeyEvent e) {
8081
ClassNode newClassNode = new ClassNode();
8182
new ClassReader(dumps).accept(newClassNode, ClassReader.EXPAND_FRAMES);
8283
JavaOctetEditor.getInstance().jar.classes.put(newClassNode.name + ".class", newClassNode);
83-
JOptionPane.showMessageDialog(null, "Save Success");
84+
JOptionPane.showMessageDialog(null, LangUtil.i18n("success"));
8485
} catch (Throwable ex) {
8586
throw new RuntimeException(ex);
8687
}

src/main/java/cn/enaium/joe/gui/panel/file/tabbed/tab/classes/ClassInfoTabPanel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public ClassInfoTabPanel(ClassNode classNode) {
129129
classNode.outerClass = null;
130130
}
131131

132-
JOptionPane.showMessageDialog(ClassInfoTabPanel.this, "Save success");
132+
JOptionPane.showMessageDialog(ClassInfoTabPanel.this, LangUtil.i18n("success"));
133133
});
134134
}}, BorderLayout.SOUTH);
135135
}

src/main/java/cn/enaium/joe/gui/panel/file/tabbed/tab/classes/FieldInfoPanel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public FieldInfoPanel(FieldNode fieldNode) {
7070
fieldNode.signature = null;
7171
}
7272

73-
JOptionPane.showMessageDialog(FieldInfoPanel.this, "Save success");
73+
JOptionPane.showMessageDialog(FieldInfoPanel.this, LangUtil.i18n("success"));
7474
});
7575
}}, BorderLayout.SOUTH);
7676
}

src/main/java/cn/enaium/joe/gui/panel/file/tabbed/tab/classes/method/MethodInfoTabPanel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public MethodInfoTabPanel(MethodNode methodNode) {
8181
methodNode.exceptions = new ArrayList<>();
8282
}
8383

84-
JOptionPane.showMessageDialog(MethodInfoTabPanel.this, "Save success");
84+
JOptionPane.showMessageDialog(MethodInfoTabPanel.this, LangUtil.i18n("success"));
8585
});
8686
}}, BorderLayout.SOUTH);
8787
}

0 commit comments

Comments
 (0)