translations: merge in my older work on the translation tool
git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@662 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
parent
30a5b6d53c
commit
99756b5d0a
3 changed files with 12 additions and 21 deletions
|
@ -23,6 +23,7 @@ import javax.swing.Timer;
|
||||||
import javax.swing.filechooser.FileNameExtensionFilter;
|
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||||
|
|
||||||
import micropolisj.engine.*;
|
import micropolisj.engine.*;
|
||||||
|
import micropolisj.util.TranslationTool;
|
||||||
|
|
||||||
public class MainWindow extends JFrame
|
public class MainWindow extends JFrame
|
||||||
implements Micropolis.Listener, EarthquakeListener
|
implements Micropolis.Listener, EarthquakeListener
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
package micropolisj.gui;
|
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
import javax.swing.*;
|
|
||||||
|
|
||||||
public class TranslationTool extends JFrame
|
|
||||||
{
|
|
||||||
public TranslationTool()
|
|
||||||
{
|
|
||||||
JButton btn = new JButton("Hello World!");
|
|
||||||
add(btn, BorderLayout.CENTER);
|
|
||||||
|
|
||||||
pack();
|
|
||||||
setLocationRelativeTo(null);
|
|
||||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -16,13 +16,20 @@ public class TranslationTool extends JFrame
|
||||||
String lastVariant;
|
String lastVariant;
|
||||||
|
|
||||||
public TranslationTool()
|
public TranslationTool()
|
||||||
throws IOException
|
|
||||||
{
|
{
|
||||||
setTitle("MicropolisJ Translation Tool");
|
setTitle("MicropolisJ Translation Tool");
|
||||||
|
|
||||||
|
try {
|
||||||
stringsModel = new StringsModel();
|
stringsModel = new StringsModel();
|
||||||
stringsModel.addLocale(null);
|
stringsModel.addLocale(null);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (IOException e) {
|
||||||
|
JOptionPane.showMessageDialog(this,
|
||||||
|
e, "Error", JOptionPane.ERROR_MESSAGE);
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
stringsTable = new JTable(stringsModel);
|
stringsTable = new JTable(stringsModel);
|
||||||
stringsTable.setDefaultEditor(String.class, new DefaultCellEditor(new JTextField()));
|
stringsTable.setDefaultEditor(String.class, new DefaultCellEditor(new JTextField()));
|
||||||
JScrollPane scrollPane = new JScrollPane(stringsTable);
|
JScrollPane scrollPane = new JScrollPane(stringsTable);
|
||||||
|
@ -167,12 +174,12 @@ public class TranslationTool extends JFrame
|
||||||
static class StringsModel extends AbstractTableModel
|
static class StringsModel extends AbstractTableModel
|
||||||
{
|
{
|
||||||
StringInfo [] strings;
|
StringInfo [] strings;
|
||||||
ArrayList<MyLocaleInfo> locales = new ArrayList<>();
|
ArrayList<MyLocaleInfo> locales = new ArrayList<MyLocaleInfo>();
|
||||||
|
|
||||||
static class MyLocaleInfo
|
static class MyLocaleInfo
|
||||||
{
|
{
|
||||||
String code;
|
String code;
|
||||||
HashMap<String,Properties> propsMap = new HashMap<>();
|
HashMap<String,Properties> propsMap = new HashMap<String,Properties>();
|
||||||
boolean dirty;
|
boolean dirty;
|
||||||
|
|
||||||
MyLocaleInfo(String code) {
|
MyLocaleInfo(String code) {
|
||||||
|
@ -201,7 +208,7 @@ public class TranslationTool extends JFrame
|
||||||
|
|
||||||
StringsModel() throws IOException
|
StringsModel() throws IOException
|
||||||
{
|
{
|
||||||
ArrayList<StringInfo> ss = new ArrayList<>();
|
ArrayList<StringInfo> ss = new ArrayList<StringInfo>();
|
||||||
for (String f : FILES) {
|
for (String f : FILES) {
|
||||||
loadStrings(f, ss);
|
loadStrings(f, ss);
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue