Skip to content

Commit

Permalink
Add international language support
Browse files Browse the repository at this point in the history
There are two languages​​, the default language is English, the other is Chinese.
Of course, the Chinese are not perfect:(
  • Loading branch information
wszf committed Feb 21, 2014
1 parent 1bea051 commit 7094de5
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 14 deletions.
26 changes: 14 additions & 12 deletions src/AndroratServer/src/gui/GUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@
import java.awt.event.MouseEvent;
import java.awt.Dimension;
import java.awt.Font;
import java.util.ResourceBundle;

public class GUI extends javax.swing.JFrame {
private static final ResourceBundle BUNDLE = ResourceBundle.getBundle("gui.messages"); //$NON-NLS-1$

private JMenuItem buttonRemoveUser;
private JMenuItem buttonUserGUI;
Expand Down Expand Up @@ -584,9 +586,9 @@ private void initComponents() {

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

jMenu1.setText("Server");
jMenu1.setText(BUNDLE.getString("Server")); //$NON-NLS-1$

buttonExit.setText("Exit application");
buttonExit.setText(BUNDLE.getString("ExitApplication")); //$NON-NLS-1$
buttonExit.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
Expand All @@ -595,15 +597,15 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
});
jMenu1.add(buttonExit);

chckbxmntmShowLogs = new JCheckBoxMenuItem("Show logs");
chckbxmntmShowLogs = new JCheckBoxMenuItem(BUNDLE.getString("ShowLogs")); //$NON-NLS-1$
chckbxmntmShowLogs.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
buttonShowLogs();
}
});

mntmPort = new JMenuItem("Select port");
mntmPort = new JMenuItem(BUNDLE.getString("SelectPort")); //$NON-NLS-1$
mntmPort.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
fireSelectPort();
Expand All @@ -615,9 +617,9 @@ public void actionPerformed(ActionEvent e) {

jMenuBar1.add(jMenu1);

jMenu2.setText("Client actions");
jMenu2.setText(BUNDLE.getString("ClientActions")); //$NON-NLS-1$

buttonUserGUI.setText("Open user interface");
buttonUserGUI.setText(BUNDLE.getString("OpenUserInterface")); //$NON-NLS-1$
buttonUserGUI.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_U, InputEvent.CTRL_MASK));
buttonUserGUI.addActionListener(new java.awt.event.ActionListener() {
@Override
Expand All @@ -627,7 +629,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
});
jMenu2.add(buttonUserGUI);

buttonRemoveUser.setText("Disconnect user");
buttonRemoveUser.setText(BUNDLE.getString("DisconnectUser")); //$NON-NLS-1$
buttonRemoveUser.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.CTRL_MASK));
buttonRemoveUser.addActionListener(new java.awt.event.ActionListener() {
@Override
Expand All @@ -641,10 +643,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {

setJMenuBar(jMenuBar1);

mnBulkActions = new JMenu("Bulk actions");
mnBulkActions = new JMenu(BUNDLE.getString("BulkActions")); //$NON-NLS-1$
jMenuBar1.add(mnBulkActions);

mntmToastit = new JMenuItem("Toast-it");
mntmToastit = new JMenuItem(BUNDLE.getString("Toast-it")); //$NON-NLS-1$
mntmToastit.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Expand All @@ -653,7 +655,7 @@ public void actionPerformed(ActionEvent e) {
});
mnBulkActions.add(mntmToastit);

mntmSendSms = new JMenuItem("Send SMS");
mntmSendSms = new JMenuItem(BUNDLE.getString("Send-SMS")); //$NON-NLS-1$
mntmSendSms.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Expand All @@ -671,12 +673,12 @@ public void actionPerformed(ActionEvent e) {
});
mnBulkActions.add(mntmGiveCall);

mnAbout = new JMenu("About");
mnAbout = new JMenu(BUNDLE.getString("About")); //$NON-NLS-1$
jMenuBar1.add(mnAbout);
buttonAbout = new javax.swing.JMenuItem();
mnAbout.add(buttonAbout);

buttonAbout.setText("About Androrat");
buttonAbout.setText(BUNDLE.getString("AboutAndrorat")); //$NON-NLS-1$
buttonAbout.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
Expand Down
6 changes: 4 additions & 2 deletions src/AndroratServer/src/gui/SMSDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
import javax.swing.JTextPane;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.util.ResourceBundle;

public class SMSDialog extends JDialog {
private static final ResourceBundle BUNDLE = ResourceBundle.getBundle("gui.messages"); //$NON-NLS-1$

private final JPanel contentPanel = new JPanel();
private JTextField textField;
Expand All @@ -34,12 +36,12 @@ public SMSDialog(Frame owner) {
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);

JLabel lblTargetCellNumber = new JLabel("Target cell number :");
JLabel lblTargetCellNumber = new JLabel(BUNDLE.getString("Target-cell-number")); //$NON-NLS-1$

textField = new JTextField();
textField.setColumns(10);

JLabel lblSmsText = new JLabel("SMS Text :");
JLabel lblSmsText = new JLabel(BUNDLE.getString("SMS-Text")); //$NON-NLS-1$

textPane = new JTextPane();
GroupLayout gl_contentPanel = new GroupLayout(contentPanel);
Expand Down
18 changes: 18 additions & 0 deletions src/AndroratServer/src/gui/messages.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#Field ResourceBundle: BUNDLE
#Fri Feb 21 15:02:00 CST 2014
ClientActions=Client Actions
Server=Server
BulkActions= Bulk actions
About=About
AboutAndrorat=About Androrat
ExitApplication=Exit application
SelectPort=Select Port
ShowLogs=Show logs
OpenUserInterface=Open user interface
DisconnectUser=Disconnect user
Toast-it=Toast-it
Send-SMS=Send SMS
Give-call=Give call
#smsdialog
Target-cell-number=Target cell number :
SMS-Text=SMS Text:
18 changes: 18 additions & 0 deletions src/AndroratServer/src/gui/messages_zh_CN.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#Field ResourceBundle: BUNDLE
#Fri Feb 21 15:58:19 CST 2014
Server=\u670D\u52A1
ClientActions=\u5BA2\u6237\u7AEF\u64CD\u4F5C
BulkActions=\u6279\u91CF\u64CD\u4F5C
About=\u5173\u4E8E
AboutAndrorat=\u5173\u4E8EAndrorat
ExitApplication=\u9000\u51FA\u7A0B\u5E8F
SelectPort=\u9009\u62E9\u7AEF\u53E3
ShowLogs=\u663E\u793A\u65E5\u5FD7
OpenUserInterface=\u7528\u6237\u8BE6\u7EC6\u4FE1\u606F
DisconnectUser=\u65AD\u5F00\u7528\u6237\u8FDE\u63A5
Toast-it=\u53D1\u9001Toast
Send-SMS=\u53D1\u9001\u77ED\u4FE1
Give-call=\u62E8\u6253\u7535\u8BDD
#smsdialog
Target-cell-number=\u76EE\u6807\u53F7\u7801:
SMS-Text=\u77ED\u4FE1\u5185\u5BB9:

0 comments on commit 7094de5

Please sign in to comment.