Author: jerome
Date: 2008-08-18 13:31:16 +0200 (Mon, 18 Aug 2008)
New Revision: 1552
Added:
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/Messages.java
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/messages.properties
Modified:
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/ConfInterface.java
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/IniFile.java
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/IniWriter.java
Log:
* Started internationalization.
Modified:
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/ConfInterface.java
===================================================================
---
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/ConfInterface.java
2008-08-18 11:14:31 UTC (rev 1551)
+++
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/ConfInterface.java
2008-08-18 11:31:16 UTC (rev 1552)
@@ -77,7 +77,7 @@
private JComboBox locutorSet;
private JComboBox tuxBody;
private JSpinner pitchSet;
- private JLabel howManyTime = new JLabel("How many time:");
+ private JLabel howManyTime = new
JLabel(Messages.getString("ConfInterface.0")); //$NON-NLS-1$
/* Parametrized values */
private JComboBox parametrized;
@@ -92,13 +92,13 @@
private JSpinner addMany;
private JTextField addTtsText;
private JTextField chatterTuxValue;
- private JLabel addHowMany = new JLabel("How many time");
+ private JLabel addHowMany = new
JLabel(Messages.getString("ConfInterface.1")); //$NON-NLS-1$
- private File iniFile = new
File("c:\\tuxdroid\\bin\\chattertux\\ChatterTux.ini");
+ private File iniFile = new
File("c:\\tuxdroid\\bin\\chattertux\\ChatterTux.ini"); //$NON-NLS-1$
//Current tts parsed action.
- public static String action = "none";
- public static String currentKey = "None";
+ public static String action = "none"; //$NON-NLS-1$
+ public static String currentKey = "None"; //$NON-NLS-1$
//** Configuration objects
Locale locale;
@@ -125,23 +125,23 @@
locale = Locale.getDefault(); //Getting language.
//Create tux api object.
- this.api = new TuxAPI("127.0.0.1", 270);
- api.event.handler.register("all", api, "onAllEvent");
+ this.api = new TuxAPI("127.0.0.1", 270); //$NON-NLS-1$
+ api.event.handler.register("all", api, "onAllEvent");
//$NON-NLS-1$ //$NON-NLS-2$
api.event.handler.register(TuxAPIConst.ST_NAME_RADIO_STATE, this,
-
"onRadioConnected", "True", null);
+
"onRadioConnected", "True", null); //$NON-NLS-1$ //$NON-NLS-2$
api.event.handler.register(TuxAPIConst.ST_NAME_RADIO_STATE, this,
-
"onRadioDisconnected", "False", null);
+
"onRadioDisconnected", "False", null); //$NON-NLS-1$ //$NON-NLS-2$
//api connection.
api.server.autoConnect(TuxAPIConst.CLIENT_LEVEL_RESTRICTED,
-
"Chatter", "work");
+
"Chatter", "work"); //$NON-NLS-1$ //$NON-NLS-2$
api.server.waitConnected(2.0);
if(api.radio.getConnected())
this.onRadioConnected(null, null);
}else{
- String message = "Unable to find configuration file";
- String paneTitle = "ChatterTux Error";
+ String message =
Messages.getString("ConfInterface.14"); //$NON-NLS-1$
+ String paneTitle =
Messages.getString("ConfInterface.15"); //$NON-NLS-1$
JOptionPane.showMessageDialog(null, message, paneTitle,
JOptionPane.ERROR_MESSAGE);
}
}
@@ -170,12 +170,12 @@
//Set Look & Feel
try {
-
javax.swing.UIManager.setLookAndFeel("com.jgoodies.looks.plastic.Plastic3DLookAndFeel");
+
javax.swing.UIManager.setLookAndFeel("com.jgoodies.looks.plastic.Plastic3DLookAndFeel");
//$NON-NLS-1$
} catch(Exception e) {
e.printStackTrace();
}
- frame = new JFrame("Chatter Tux configuration");
+ frame = new
JFrame(Messages.getString("ConfInterface.17")); //$NON-NLS-1$
frame.setSize(new Dimension(400, 550));
frame.setPreferredSize(frame.getSize());
frame.setResizable(false);
@@ -202,7 +202,7 @@
}
public String getFromIni(String key){
- Hashtable<String, String> stored =
this.properties.getProperties("VOICE CONFIGURATION");
+ Hashtable<String, String> stored =
this.properties.getProperties("VOICE CONFIGURATION"); //$NON-NLS-1$
return stored.get(key);
}
@@ -211,7 +211,7 @@
*/
public void setStoredLocutor(){
- String locutor = this.getFromIni("locutor");
+ String locutor = this.getFromIni("locutor"); //$NON-NLS-1$
//Displaying registered locutor configuration.
if(this.locutorSet.getItemCount() <= 0){
@@ -229,7 +229,7 @@
}
public void setStoredPitch(){
- String pitch = this.getFromIni("pitch");
+ String pitch = this.getFromIni("pitch"); //$NON-NLS-1$
this.pitchSet.setValue(Integer.valueOf(pitch));
}
@@ -238,7 +238,7 @@
public JPanel getVoiceConfigurationPanel(){
if(this.voiceConfigPanel == null){
this.voiceConfigPanel = new JPanel();
-
this.voiceConfigPanel.setBorder(BorderFactory.createTitledBorder("Voice
Configuration"));
+
this.voiceConfigPanel.setBorder(BorderFactory.createTitledBorder(Messages.getString("ConfInterface.21")));
//$NON-NLS-1$
this.voiceConfigPanel.setSize(new
Dimension(this.frame.getWidth() - 24, 92));
this.voiceConfigPanel.setPreferredSize(this.voiceConfigPanel.getSize());
this.voiceConfigPanel.setLayout(null);
@@ -285,7 +285,7 @@
public JPanel getActionsPanel(){
if(this.actionModifier == null){
this.actionModifier = new JPanel();
-
this.actionModifier.setBorder(BorderFactory.createTitledBorder("Registered
actions"));
+
this.actionModifier.setBorder(BorderFactory.createTitledBorder(Messages.getString("ConfInterface.22")));
//$NON-NLS-1$
this.actionModifier.setLayout(null);
Dimension d = this.voiceConfigPanel.getSize();
d.height += 20;
@@ -315,11 +315,11 @@
this.parameters.setLocation(new
Point(this.parametrized.getX(), 60));
this.actionModifier.add(this.parameters);
- this.parameters.setFont(new Font("Verdana", Font.BOLD,
12));
+ this.parameters.setFont(new Font("Verdana", Font.BOLD,
12)); //$NON-NLS-1$
this.parametrized.addActionListener(new
ActionListener(){
public void actionPerformed(ActionEvent arg0) {
-
if(arg0.getActionCommand().equalsIgnoreCase("comboboxchanged")){
+
if(arg0.getActionCommand().equalsIgnoreCase("comboboxchanged")){ //$NON-NLS-1$
try{
String key =
parametrized.getModel().getSelectedItem().toString();
setAreaValues(key);
@@ -337,7 +337,7 @@
//Gets the start server radio button.
public JRadioButton getStartServer(){
if(this.startServer == null){
- this.startServer = new JRadioButton("Start Chatter");
+ this.startServer = new
JRadioButton(Messages.getString("ConfInterface.25")); //$NON-NLS-1$
this.startServer.setSize(new Dimension(100, 25));
this.startServer.setLocation(new Point(200, 26));
this.startServer.setFocusPainted(false);
@@ -349,7 +349,7 @@
//Gets the stop server radio button.
public JRadioButton getStopServer(){
if(this.stopServer == null){
- this.stopServer = new JRadioButton("Stop Chatter");
+ this.stopServer = new
JRadioButton(Messages.getString("ConfInterface.26")); //$NON-NLS-1$
this.stopServer.setSize(new Dimension(100, 25));
this.stopServer.setLocation(new Point(200, 60));
this.stopServer.setFocusPainted(false);
@@ -362,7 +362,7 @@
//Gets confirm button.
public JButton getOkButton(){
if(this.ok == null){
- this.ok = new JButton("Ok");
+ this.ok = new
JButton(Messages.getString("ConfInterface.27")); //$NON-NLS-1$
this.ok.setSize(new Dimension(73,23));
this.ok.setLocation(new Point(215, 2));
this.ok.setFocusPainted(false);
@@ -379,7 +379,7 @@
//Gets stop button.
public JButton getCancelButton(){
if(this.cancel == null){
- this.cancel = new JButton("Cancel");
+ this.cancel = new
JButton(Messages.getString("ConfInterface.28")); //$NON-NLS-1$
cancel.setSize(new Dimension(73, 23));
cancel.setLocation(new Point(294, 2));
cancel.setFocusPainted(false);
@@ -420,11 +420,11 @@
d.height += 40;
this.editPanel.setSize(d);
this.editPanel.setPreferredSize(this.editPanel.getSize());
-
this.editPanel.setBorder(BorderFactory.createTitledBorder("Modify"));
+
this.editPanel.setBorder(BorderFactory.createTitledBorder(Messages.getString("ConfInterface.29")));
//$NON-NLS-1$
this.editPanel.setVisible(true);
//Gettin button.
- this.deleteEdition = new JButton("Delete");
+ this.deleteEdition = new
JButton(Messages.getString("ConfInterface.30")); //$NON-NLS-1$
this.deleteEdition.setSize(new Dimension(73, 23));
this.deleteEdition.setPreferredSize(this.deleteEdition.getSize());
this.deleteEdition.setFocusPainted(false);
@@ -434,7 +434,7 @@
removeFromIni(ConfInterface.currentKey);
}
});
- this.okEdition = new JButton("Save");
+ this.okEdition = new
JButton(Messages.getString("ConfInterface.31")); //$NON-NLS-1$
this.okEdition.setSize(new Dimension(73,23));
this.okEdition.setPreferredSize(this.okEdition.getSize());
this.okEdition.setFocusPainted(false);
@@ -452,7 +452,7 @@
this.editPanel.setLocation(new Point(x, y));
//Create global setting
- this.actionType = new JComboBox(new String[]{"Tux
movement", "Tux TTS"});
+ this.actionType = new JComboBox(new
String[]{Messages.getString("ConfInterface.32"),
Messages.getString("ConfInterface.33")}); //$NON-NLS-1$ //$NON-NLS-2$
this.actionType.setSize(this.locutorSet.getSize());
this.actionType.setPreferredSize(this.actionType.getSize());
this.actionType.setFocusable(false);
@@ -461,7 +461,7 @@
this.actionType.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
-
if(arg0.getActionCommand().equalsIgnoreCase("comboboxchanged")){
+
if(arg0.getActionCommand().equalsIgnoreCase("comboboxchanged")){ //$NON-NLS-1$
String selection =
actionType.getModel().getSelectedItem().toString();
if(selection.equals(actionType.getItemAt(0))){
setAPIEditComponentsVisible(true);
@@ -473,14 +473,14 @@
});
//Create api modification gfx.
this.tuxBody = new JComboBox();
- this.tuxBody.addItem("Mouth");
- this.tuxBody.addItem("Flippers");
- this.tuxBody.addItem("Eyes");
- this.tuxBody.addItem("Right led");
- this.tuxBody.addItem("Left led");
- this.tuxBody.addItem("Both leds");
- this.tuxBody.addItem("Spin left");
- this.tuxBody.addItem("Spin right");
+
this.tuxBody.addItem(Messages.getString("ConfInterface.35")); //$NON-NLS-1$
+
this.tuxBody.addItem(Messages.getString("ConfInterface.36")); //$NON-NLS-1$
+
this.tuxBody.addItem(Messages.getString("ConfInterface.37")); //$NON-NLS-1$
+
this.tuxBody.addItem(Messages.getString("ConfInterface.38")); //$NON-NLS-1$
+
this.tuxBody.addItem(Messages.getString("ConfInterface.39")); //$NON-NLS-1$
+
this.tuxBody.addItem(Messages.getString("ConfInterface.40")); //$NON-NLS-1$
+
this.tuxBody.addItem(Messages.getString("ConfInterface.41")); //$NON-NLS-1$
+
this.tuxBody.addItem(Messages.getString("ConfInterface.42")); //$NON-NLS-1$
this.tuxBody.setSize(this.actionType.getSize());
this.tuxBody.setPreferredSize(this.tuxBody.getSize());
this.tuxBody.setFocusable(false);
@@ -520,12 +520,12 @@
if(this.addPanel == null){
this.addPanel = new JPanel();
this.addPanel.setLayout(null);
-
this.addPanel.setBorder(BorderFactory.createTitledBorder("Add Chatter Tux
action"));
+
this.addPanel.setBorder(BorderFactory.createTitledBorder(Messages.getString("ConfInterface.43")));
//$NON-NLS-1$
this.addPanel.setSize(this.editPanel.getSize());
this.addPanel.setPreferredSize(this.addPanel.getSize());
//Create add button.
- this.add = new JButton("Add");
+ this.add = new
JButton(Messages.getString("ConfInterface.44")); //$NON-NLS-1$
add.setSize(this.okEdition.getSize());
add.setPreferredSize(this.add.getSize());
add.setFocusPainted(false);
@@ -543,7 +543,7 @@
this.addPanel.setLocation(new Point(x, y));
//Create components.
- this.addAction = new JComboBox(new String[]{"Tux
movement", "Tux TTS"});
+ this.addAction = new JComboBox(new
String[]{Messages.getString("ConfInterface.45"),
Messages.getString("ConfInterface.46")}); //$NON-NLS-1$ //$NON-NLS-2$
this.addAction.setSize(this.actionType.getSize());
this.addAction.setPreferredSize(this.actionType.getSize());
this.addAction.setLocation(new Point(190,
this.actionType.getY()));
@@ -554,14 +554,14 @@
this.chatterTuxValue.setLocation(this.locutorSet.getLocation());
this.addTuxBody = new JComboBox();
- this.addTuxBody.addItem("Mouth");
- this.addTuxBody.addItem("Flippers");
- this.addTuxBody.addItem("Eyes");
- this.addTuxBody.addItem("Right led");
- this.addTuxBody.addItem("Left led");
- this.addTuxBody.addItem("Both leds");
- this.addTuxBody.addItem("Spin left");
- this.addTuxBody.addItem("Spin right");
+
this.addTuxBody.addItem(Messages.getString("ConfInterface.47")); //$NON-NLS-1$
+
this.addTuxBody.addItem(Messages.getString("ConfInterface.48")); //$NON-NLS-1$
+
this.addTuxBody.addItem(Messages.getString("ConfInterface.49")); //$NON-NLS-1$
+
this.addTuxBody.addItem(Messages.getString("ConfInterface.50")); //$NON-NLS-1$
+
this.addTuxBody.addItem(Messages.getString("ConfInterface.51")); //$NON-NLS-1$
+
this.addTuxBody.addItem(Messages.getString("ConfInterface.52")); //$NON-NLS-1$
+
this.addTuxBody.addItem(Messages.getString("ConfInterface.53")); //$NON-NLS-1$
+
this.addTuxBody.addItem(Messages.getString("ConfInterface.54")); //$NON-NLS-1$
this.addTuxBody.setSize(this.actionType.getSize());
this.addTuxBody.setPreferredSize(this.tuxBody.getSize());
this.addTuxBody.setFocusable(false);
@@ -598,7 +598,7 @@
this.addAction.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
-
if(arg0.getActionCommand().equalsIgnoreCase("comboboxchanged")){
+
if(arg0.getActionCommand().equalsIgnoreCase("comboboxchanged")){ //$NON-NLS-1$
String selection =
addAction.getModel().getSelectedItem().toString();
if(selection.equals(addAction.getItemAt(0))){
setAPIAddComponentsVisible(true);
@@ -615,17 +615,17 @@
// TODO Store to ini file.
public void storeAsIni(String key){
- if((!key.equals("")) &&
(!this.ini.getHashtable().containsKey(key))){
+ if((!key.equals("")) &&
(!this.ini.getHashtable().containsKey(key))){ //$NON-NLS-1$
//then adding new value.
String action =
this.addAction.getSelectedItem().toString();
- if(action.equals("Tux TTS")){
- action = "tts";
+
if(action.equals(Messages.getString("ConfInterface.57"))){ //$NON-NLS-1$
+ action = "tts"; //$NON-NLS-1$
}
- else if(action.equals("Tux movement")){
- action = "api";
+ else
if(action.equals(Messages.getString("ConfInterface.59"))){ //$NON-NLS-1$
+ action = "api"; //$NON-NLS-1$
}
- String command = "";
+ String command = Messages.getString("ConfInterface.3");
//$NON-NLS-1$
if(this.addTtsText.isVisible()){ //then tts parameter.
command = this.addTtsText.getText();
}
@@ -635,18 +635,18 @@
command = this.revertParsedCommand(command,
this.addMany);
}
Vector<String> values = new Vector<String>();
- values.add("action = " + action);
- values.add("cmd = " + command);
- if(!command.equals("")){
+ values.add("action = " + action); //$NON-NLS-1$
+ values.add("cmd = " + command); //$NON-NLS-1$
+ if(!command.equals("")){ //$NON-NLS-1$
this.writer.add(key, values);
this.properties.updateHashTable(this.ini.getHashtable());
- this.updateValues();
+ //this.updateValues();
}else{
//TODO display error message.
}
}else{
//TODO display error message.
- System.out.println("Cannot be blank or be the same as
one entry.");
+
System.out.println(Messages.getString("ConfInterface.65")); //$NON-NLS-1$
}
}
@@ -654,14 +654,14 @@
//Store modifications.
public void storeModificationsToIni(String key){
String action = this.actionType.getSelectedItem().toString();
- if(action.equals("Tux TTS")){
- action = "tts";
+ if(action.equals(Messages.getString("ConfInterface.66"))){
//$NON-NLS-1$
+ action = "tts"; //$NON-NLS-1$
}
- else if(action.equals("Tux movement")){
- action = "api";
+ else if(action.equals(Messages.getString("ConfInterface.68"))){
//$NON-NLS-1$
+ action = "api"; //$NON-NLS-1$
}
- String command = "";
+ String command = ""; //$NON-NLS-1$
if(this.ttsSet.isVisible()){ //then tts parameter.
command = this.ttsSet.getText();
}
@@ -671,8 +671,8 @@
command = this.revertParsedCommand(command,
this.manyValue);
}
Vector<String> values = new Vector<String>();
- values.add("action = " + action);
- values.add("cmd = " + command);
+ values.add("action = " + action); //$NON-NLS-1$
+ values.add("cmd = " + command); //$NON-NLS-1$
this.writer.modify(key, values);
this.properties.updateHashTable(this.ini.getHashtable());
this.updateValues();
@@ -685,7 +685,7 @@
try {
this.writer.delete(key);
} catch (Exception e) {
- System.out.println(String.format("Problem deleting %s",
key));
+
System.out.println(String.format(Messages.getString("ConfInterface.73"), key));
//$NON-NLS-1$
e.printStackTrace();
}
this.properties.updateHashTable(this.ini.getHashtable());
@@ -698,30 +698,30 @@
* Sets values into parameters area.
*/
public void setAreaValues(String key){
- String title = "";
- String text = "";
- String action = "";
- String value = "";
+ String title = ""; //$NON-NLS-1$
+ String text = ""; //$NON-NLS-1$
+ String action = ""; //$NON-NLS-1$
+ String value = ""; //$NON-NLS-1$
Hashtable <String, String> values =
properties.getProperties(key);
- if(values.get("action").equalsIgnoreCase("tts")){
- action = "Tux say a message";
- title = "Message: ";
- value = values.get("cmd");
+ if(values.get("action").equalsIgnoreCase("tts")){ //$NON-NLS-1$
//$NON-NLS-2$
+ action = Messages.getString("ConfInterface.80");
//$NON-NLS-1$
+ title = Messages.getString("ConfInterface.81");
//$NON-NLS-1$
+ value = values.get("cmd"); //$NON-NLS-1$
this.actionType.setSelectedIndex(1);
this.setTTSEditComponentsVivible(true);
- this.setEditPanelValues("tts", value);
+ this.setEditPanelValues("tts", value); //$NON-NLS-1$
}
- else if(values.get("action").equalsIgnoreCase("api")){
- action = "Tux moves his body";
- title = "Command: ";
- value = this.parseCommand(values.get("cmd"));
+ else if(values.get("action").equalsIgnoreCase("api")){
//$NON-NLS-1$ //$NON-NLS-2$
+ action = Messages.getString("ConfInterface.86");
//$NON-NLS-1$
+ title = Messages.getString("ConfInterface.87");
//$NON-NLS-1$
+ value = this.parseCommand(values.get("cmd"));
//$NON-NLS-1$
this.actionType.setSelectedIndex(0);
this.setAPIEditComponentsVisible(true);
- this.setEditPanelValues("api", value);
+ this.setEditPanelValues("api", value); //$NON-NLS-1$
}
- text = "Action: " + action + "\n" + title + value;
+ text = Messages.getString("ConfInterface.90") + action + "\n" +
title + value; //$NON-NLS-1$ //$NON-NLS-2$
parameters.setText(text);
ConfInterface.currentKey = key;
}
@@ -731,10 +731,10 @@
* Set modify panel values.
*/
public void setEditPanelValues(String action,String arg){
- if(action.equalsIgnoreCase("api")){
+
if(action.equalsIgnoreCase(Messages.getString("ConfInterface.92"))){
//$NON-NLS-1$
this.tuxBody.setSelectedItem(ConfInterface.action);
}
- else if(action.equalsIgnoreCase("tts")){
+ else if(action.equalsIgnoreCase("tts")){ //$NON-NLS-1$
this.ttsSet.setText(arg);
}
}
@@ -776,42 +776,42 @@
*/
public String parseCommand(String command){
StringBuffer returns = new StringBuffer();
- if(command.contains("tux")) returns.append("Tux ");
- if(command.contains("eyes")){
- ConfInterface.action = "Eyes";
- returns.append("open his eyes");
+ if(command.contains("tux"))
returns.append(Messages.getString("ConfInterface.95")); //$NON-NLS-1$
//$NON-NLS-2$
+ if(command.contains("eyes")){ //$NON-NLS-1$
+ ConfInterface.action =
Messages.getString("ConfInterface.97"); //$NON-NLS-1$
+ returns.append(Messages.getString("ConfInterface.98"));
//$NON-NLS-1$
}
- else if(command.contains("mouth")){
- ConfInterface.action = "Mouth";
- returns.append("open his mouth");
+ else if(command.contains("mouth")){ //$NON-NLS-1$
+ ConfInterface.action =
Messages.getString("ConfInterface.100"); //$NON-NLS-1$
+
returns.append(Messages.getString("ConfInterface.101")); //$NON-NLS-1$
}
- else if(command.contains("flippers")){
- ConfInterface.action = "Flippers";
- returns.append("moves his flippers");
+ else if(command.contains("flippers")){ //$NON-NLS-1$
+ ConfInterface.action =
Messages.getString("ConfInterface.103"); //$NON-NLS-1$
+
returns.append(Messages.getString("ConfInterface.104")); //$NON-NLS-1$
}
- else if(command.contains("led.both")){
- ConfInterface.action = "Both leds";
- returns.append("blink his leds");
+ else if(command.contains("led.both")){ //$NON-NLS-1$
+ ConfInterface.action =
Messages.getString("ConfInterface.106"); //$NON-NLS-1$
+
returns.append(Messages.getString("ConfInterface.107")); //$NON-NLS-1$
}
- else if(command.contains("led.left")){
- ConfInterface.action = "Left led";
- returns.append("blink his left led");
+ else if(command.contains("led.left")){ //$NON-NLS-1$
+ ConfInterface.action =
Messages.getString("ConfInterface.109"); //$NON-NLS-1$
+
returns.append(Messages.getString("ConfInterface.110")); //$NON-NLS-1$
}
- else if(command.contains("left.right")){
- ConfInterface.action = "Right led";
- returns.append("blink his right led");
+ else if(command.contains("left.right")){ //$NON-NLS-1$
+ ConfInterface.action =
Messages.getString("ConfInterface.112"); //$NON-NLS-1$
+
returns.append(Messages.getString("ConfInterface.113")); //$NON-NLS-1$
}
- else if(command.contains("spinning.left")){
- ConfInterface.action = "Spin left";
- returns.append("moves to the left");
+ else if(command.contains("spinning.left")){ //$NON-NLS-1$
+ ConfInterface.action =
Messages.getString("ConfInterface.115"); //$NON-NLS-1$
+
returns.append(Messages.getString("ConfInterface.116")); //$NON-NLS-1$
}
- else if(command.contains("spinning.right")){
- ConfInterface.action = "Spin right";
- returns.append("moves to the right");
+ else if(command.contains("spinning.right")){ //$NON-NLS-1$
+ ConfInterface.action =
Messages.getString("ConfInterface.118"); //$NON-NLS-1$
+
returns.append(Messages.getString("ConfInterface.119")); //$NON-NLS-1$
}
- if(command.contains(".onAsync(")){
- int index = command.indexOf("(") + 1;
- int end = command.indexOf(", SSV_NDEF");
+ if(command.contains(".onAsync(")){ //$NON-NLS-1$
+ int index = command.indexOf("(") + 1; //$NON-NLS-1$
+ int end = command.indexOf(", SSV_NDEF"); //$NON-NLS-1$
Integer value =
Integer.valueOf(command.substring(index, end));
this.manyValue.setValue(value);
}
@@ -822,16 +822,16 @@
//Return reverted parsed command.
public String revertParsedCommand(String command, JSpinner spinner){
StringBuffer result = new StringBuffer();
- result.append("tux.");
- if(command.contains("Spin right"))
result.append("spinning.right");
- else if(command.contains("Spin left"))
result.append("spinning.left");
- else if(command.contains("Right led"))
result.append("led.right");
- else if(command.contains("Left led")) result.append("led.left");
- else if(command.contains("Both leds"))
result.append("led.both");
- else if(command.contains("Flippers")) result.append("flippers");
- else if(command.contains("Mouth")) result.append("mouth");
- else if(command.contains("Eyes")) result.append("eyes");
- result.append(String.format(".onAsync(%s, SSV_NDEF)",
spinner.getValue().toString()));
+ result.append("tux."); //$NON-NLS-1$
+ if(command.contains(Messages.getString("ConfInterface.124")))
result.append("spinning.right"); //$NON-NLS-1$ //$NON-NLS-2$
+ else
if(command.contains(Messages.getString("ConfInterface.126")))
result.append("spinning.left"); //$NON-NLS-1$ //$NON-NLS-2$
+ else
if(command.contains(Messages.getString("ConfInterface.128")))
result.append("led.right"); //$NON-NLS-1$ //$NON-NLS-2$
+ else
if(command.contains(Messages.getString("ConfInterface.130")))
result.append("led.left"); //$NON-NLS-1$ //$NON-NLS-2$
+ else
if(command.contains(Messages.getString("ConfInterface.132")))
result.append("led.both"); //$NON-NLS-1$ //$NON-NLS-2$
+ else
if(command.contains(Messages.getString("ConfInterface.134")))
result.append("flippers"); //$NON-NLS-1$ //$NON-NLS-2$
+ else
if(command.contains(Messages.getString("ConfInterface.136")))
result.append("mouth"); //$NON-NLS-1$ //$NON-NLS-2$
+ else
if(command.contains(Messages.getString("ConfInterface.138")))
result.append(Messages.getString("ConfInterface.2")); //$NON-NLS-1$
//$NON-NLS-2$
+ result.append(String.format(".onAsync(%s, SSV_NDEF)",
spinner.getValue().toString())); //$NON-NLS-1$
return result.toString();
}
Modified:
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/IniFile.java
===================================================================
---
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/IniFile.java
2008-08-18 11:14:31 UTC (rev 1551)
+++
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/IniFile.java
2008-08-18 11:31:16 UTC (rev 1552)
@@ -32,7 +32,7 @@
private File file;
private Hashtable<String, Vector<String>> keys = new Hashtable<String,
Vector<String>>();
- private Hashtable<Integer, String> indexes = new Hashtable<Integer,
String>();
+ public Hashtable<Integer, String> indexes = new Hashtable<Integer,
String>();
public IniFile(File file){
this.create(file);
@@ -93,7 +93,6 @@
* @return
*/
public Vector<String> getKeyPropertiesAtIndex(int index){
- System.out.println("Indexes size: " + this.indexes.size());
String key = this.indexes.get(index).toString();
return (Vector<String>)this.keys.get(key);
}
@@ -136,7 +135,14 @@
public void add(String key, Vector<String> values){
this.keys.put(key, values);
- this.indexes.put(Integer.valueOf(this.keys.size()), key);
+ Hashtable<Integer, String> tmp = new Hashtable<Integer,
String>();
+ int y = 0;
+ for(int i= 0; i < this.indexes.size() + 1; i++){
+ tmp.put(i, this.indexes.get(i));
+ if(i == this.indexes.size()) y = i;
+ }
+ tmp.put(y, key);
+ this.indexes = tmp;
}
Modified:
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/IniWriter.java
===================================================================
---
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/IniWriter.java
2008-08-18 11:14:31 UTC (rev 1551)
+++
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/IniWriter.java
2008-08-18 11:31:16 UTC (rev 1552)
@@ -85,9 +85,10 @@
System.out.println("File error"); //TODO displaying
errorBox instead.
return false;
}
- for(int i=0; i < this.ini.getHashtable().size(); i++){
+
+ System.out.println(this.ini.getKeyAtIndex(15));
+ for(int i=0; i < this.ini.indexes.size(); i++){
try {
- System.out.println("hashtable size: " +
this.ini.getHashtable().size());
this.writer.write("[" +
this.ini.getKeyAtIndex(i) + "]\n");
Vector<String> dat =
this.ini.getKeyPropertiesAtIndex(i);
@@ -104,7 +105,7 @@
}
System.out.println("Error writing file");
//TODO displaying errorBox instead.
e.printStackTrace();
- }
+ }catch(NullPointerException ex){
System.out.println("dtrfyughiojkl");}
}
try {
Added:
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/Messages.java
===================================================================
---
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/Messages.java
(rev 0)
+++
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/Messages.java
2008-08-18 11:31:16 UTC (rev 1552)
@@ -0,0 +1,20 @@
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class Messages {
+ private static final String BUNDLE_NAME = "messages"; //$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+ .getBundle(BUNDLE_NAME);
+
+ private Messages() {
+ }
+
+ public static String getString(String key) {
+ try {
+ return RESOURCE_BUNDLE.getString(key);
+ } catch (MissingResourceException e) {
+ return '!' + key + '!';
+ }
+ }
+}
Added:
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/messages.properties
===================================================================
---
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/messages.properties
(rev 0)
+++
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/messages.properties
2008-08-18 11:31:16 UTC (rev 1552)
@@ -0,0 +1,75 @@
+ConfInterface.0=How many time:
+ConfInterface.1=How many time
+ConfInterface.100=Mouth
+ConfInterface.101=open his mouth
+ConfInterface.103=Flippers
+ConfInterface.104=moves his flippers
+ConfInterface.106=Both leds
+ConfInterface.107=blink his leds
+ConfInterface.109=Left led
+ConfInterface.110=blink his left led
+ConfInterface.112=Right led
+ConfInterface.113=blink his right led
+ConfInterface.115=Spin left
+ConfInterface.116=moves to the left
+ConfInterface.118=Spin right
+ConfInterface.119=moves to the right
+ConfInterface.124=Spin right
+ConfInterface.126=Spin left
+ConfInterface.128=Right led
+ConfInterface.130=Left led
+ConfInterface.132=Both leds
+ConfInterface.134=Flippers
+ConfInterface.136=Mouth
+ConfInterface.138=Eyes
+ConfInterface.14=Unable to find configuration file
+ConfInterface.15=ChatterTux Error
+ConfInterface.17=Chatter Tux configuration
+ConfInterface.2=eyes
+ConfInterface.21=Voice Configuration
+ConfInterface.22=Registered actions
+ConfInterface.25=Start Chatter
+ConfInterface.26=Stop Chatter
+ConfInterface.27=Ok
+ConfInterface.28=Cancel
+ConfInterface.29=Modify
+ConfInterface.3=
+ConfInterface.30=Delete
+ConfInterface.31=Save
+ConfInterface.32=Tux movement
+ConfInterface.33=Tux TTS
+ConfInterface.35=Mouth
+ConfInterface.36=Flippers
+ConfInterface.37=Eyes
+ConfInterface.38=Right led
+ConfInterface.39=Left led
+ConfInterface.40=Both leds
+ConfInterface.41=Spin left
+ConfInterface.42=Spin right
+ConfInterface.43=Add Chatter Tux action
+ConfInterface.44=Add
+ConfInterface.45=Tux movement
+ConfInterface.46=Tux TTS
+ConfInterface.47=Mouth
+ConfInterface.48=Flippers
+ConfInterface.49=Eyes
+ConfInterface.50=Right led
+ConfInterface.51=Left led
+ConfInterface.52=Both leds
+ConfInterface.53=Spin left
+ConfInterface.54=Spin right
+ConfInterface.57=Tux TTS
+ConfInterface.59=Tux movement
+ConfInterface.65=Cannot be blank or be the same as one entry.
+ConfInterface.66=Tux TTS
+ConfInterface.68=Tux movement
+ConfInterface.73=Problem deleting %s
+ConfInterface.80=Tux say a message
+ConfInterface.81=Message:
+ConfInterface.86=Tux moves his body
+ConfInterface.87=Command:
+ConfInterface.90=Action:
+ConfInterface.92=api
+ConfInterface.95=Tux
+ConfInterface.97=Eyes
+ConfInterface.98=open his eyes
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn