[tiled] r590 - in branches/bjorn/src/tiled/mapeditor: . dialogs resources

svn@biggeruniverse.com svn at biggeruniverse.com
Mon Feb 27 12:11:28 PST 2006


Author: bjorn
Date: 2006-02-27 14:11:27 -0600 (Mon, 27 Feb 2006)
New Revision: 590

Modified:
   branches/bjorn/src/tiled/mapeditor/MapEditor.java
   branches/bjorn/src/tiled/mapeditor/dialogs/ConfigurationDialog.java
   branches/bjorn/src/tiled/mapeditor/dialogs/NewMapDialog.java
   branches/bjorn/src/tiled/mapeditor/dialogs/PluginDialog.java
   branches/bjorn/src/tiled/mapeditor/dialogs/PropertiesDialog.java
   branches/bjorn/src/tiled/mapeditor/dialogs/TilePaletteDialog.java
   branches/bjorn/src/tiled/mapeditor/resources/gui.properties
Log:
More work on internationalization.


Modified: branches/bjorn/src/tiled/mapeditor/MapEditor.java
===================================================================
--- branches/bjorn/src/tiled/mapeditor/MapEditor.java	2006-02-26 22:20:23 UTC (rev 589)
+++ branches/bjorn/src/tiled/mapeditor/MapEditor.java	2006-02-27 20:11:27 UTC (rev 590)
@@ -334,12 +334,13 @@
         mapEventAdapter.addListener(mapMenu);
 
 
-        layerAdd = createMenuItem("Add Layer", null, "Add a layer");
-        layerClone = createMenuItem("Duplicate Layer", null,
-                "Duplicate current layer");
-        layerDel = createMenuItem("Delete Layer", null,
-                "Delete current layer");
-        layerUp = createMenuItem("Move Layer Up", null,
+        layerAdd = createMenuItem(Resources.getString("action.layer.add.name"), null,
+                Resources.getString("action.layer.add.tooltip"));
+        layerClone = createMenuItem(Resources.getString("action.layer.duplicate.name"), null,
+                Resources.getString("action.layer.duplicate.tooltip"));
+        layerDel = createMenuItem(Resources.getString("action.layer.delete.name"), null,
+                Resources.getString("action.layer.delete.tooltip"));
+        layerUp = createMenuItem(Resources.getString("action.layer.moveup.name"), null,
                 "Move layer up one in layer stack", "shift PAGE_UP");
         layerDown = createMenuItem("Move Layer Down", null,
                 "Move layer down one in layer stack", "shift PAGE_DOWN");
@@ -542,11 +543,11 @@
                     sliderPanel.getPreferredSize().height));
 
         // Layer buttons
-        layerAddButton = createButton(imgAdd, "Add Layer", "Add Layer");
-        layerDelButton = createButton(imgDel, "Delete Layer", "Delete Layer");
-        layerCloneButton = createButton(imgDup, "Duplicate Layer",
+        layerAddButton = createButton(imgAdd, Resources.getString("action.layer.add.name"), "Add Layer");
+        layerDelButton = createButton(imgDel, Resources.getString("action.layer.delete.name"), "Delete Layer");
+        layerCloneButton = createButton(imgDup, Resources.getString("action.layer.duplicate.name"),
                 "Duplicate Layer");
-        layerUpButton = createButton(imgUp, "Move Layer Up", "Move Layer Up");
+        layerUpButton = createButton(imgUp, Resources.getString("action.layer.moveup.name"), "Move Layer Up");
         layerDownButton = createButton(imgDown, "Move Layer Down",
                 "Move Layer Down");
 
@@ -765,10 +766,10 @@
         String command = event.getActionCommand();
         Vector layersBefore = new Vector(currentMap.getLayerVector());
 
-        if (command.equals("Add Layer")) {
+        if (command.equals(Resources.getString("action.layer.add.name"))) {
             currentMap.addLayer();
             setCurrentLayer(currentMap.getTotalLayers() - 1);
-        } else if (command.equals("Duplicate Layer")) {
+        } else if (command.equals(Resources.getString("action.layer.duplicate.name"))) {
             if (currentLayer >= 0) {
                 try {
                     MapLayer clone =
@@ -780,7 +781,7 @@
                 }
                 setCurrentLayer(currentMap.getTotalLayers() - 1);
             }
-        } else if (command.equals("Move Layer Up")) {
+        } else if (command.equals(Resources.getString("action.layer.moveup.name"))) {
             if (currentLayer >= 0) {
                 try {
                     currentMap.swapLayerUp(currentLayer);
@@ -798,7 +799,7 @@
                     System.out.println(ex.toString());
                 }
             }
-        } else if (command.equals("Delete Layer")) {
+        } else if (command.equals(Resources.getString("action.layer.delete.name"))) {
             if (currentLayer >= 0) {
                 currentMap.removeLayer(currentLayer);
                 setCurrentLayer(currentLayer < 0 ? 0 : currentLayer);
@@ -1457,7 +1458,7 @@
 
     private class ZoomInAction extends AbstractAction {
         public ZoomInAction() {
-            super("Zoom In");
+            super(Resources.getString("action.zoom.in.name"));
             putValue(ACCELERATOR_KEY,
                     KeyStroke.getKeyStroke("control EQUALS"));
             putValue(SHORT_DESCRIPTION, "Zoom in one level");
@@ -1477,7 +1478,7 @@
 
     private class ZoomOutAction extends AbstractAction {
         public ZoomOutAction() {
-            super("Zoom Out");
+            super(Resources.getString("action.zoom.out.name"));
             putValue(ACCELERATOR_KEY,
                     KeyStroke.getKeyStroke("control MINUS"));
             putValue(SHORT_DESCRIPTION, "Zoom out one level");

Modified: branches/bjorn/src/tiled/mapeditor/dialogs/ConfigurationDialog.java
===================================================================
--- branches/bjorn/src/tiled/mapeditor/dialogs/ConfigurationDialog.java	2006-02-26 22:20:23 UTC (rev 589)
+++ branches/bjorn/src/tiled/mapeditor/dialogs/ConfigurationDialog.java	2006-02-27 20:11:27 UTC (rev 590)
@@ -24,6 +24,7 @@
 
 import tiled.mapeditor.widget.IntegerSpinner;
 import tiled.mapeditor.widget.VerticalStaticJPanel;
+import tiled.mapeditor.Resources;
 import tiled.util.TiledConfiguration;
 
 /**
@@ -42,8 +43,10 @@
     private final Preferences savingPrefs = prefs.node("saving");
     private final Preferences ioPrefs = prefs.node("io");
 
+    private static final String DIALOG_TITLE = Resources.getString("dialog.preferences.title");
+
     public ConfigurationDialog(JFrame parent) {
-        super(parent, "Preferences", true);
+        super(parent, DIALOG_TITLE, true);
         init();
         setLocationRelativeTo(parent);
     }

Modified: branches/bjorn/src/tiled/mapeditor/dialogs/NewMapDialog.java
===================================================================
--- branches/bjorn/src/tiled/mapeditor/dialogs/NewMapDialog.java	2006-02-26 22:20:23 UTC (rev 589)
+++ branches/bjorn/src/tiled/mapeditor/dialogs/NewMapDialog.java	2006-02-27 20:11:27 UTC (rev 590)
@@ -24,6 +24,7 @@
 import tiled.core.Map;
 import tiled.mapeditor.widget.IntegerSpinner;
 import tiled.mapeditor.widget.VerticalStaticJPanel;
+import tiled.mapeditor.Resources;
 import tiled.util.TiledConfiguration;
 
 /**
@@ -38,8 +39,22 @@
 
     private final Preferences prefs = TiledConfiguration.node("dialog/newmap");
 
+    private static final String DIALOG_TITLE = Resources.getString("dialog.newmap.title");
+    private static final String MAPSIZE_TITLE = Resources.getString("dialog.newmap.mapsize.title");
+    private static final String TILESIZE_TITLE = Resources.getString("dialog.newmap.tilesize.title");
+    private static final String WIDTH_LABEL = Resources.getString("dialog.newmap.width.label");
+    private static final String HEIGHT_LABEL = Resources.getString("dialog.newmap.height.label");
+    private static final String MAPTYPE_LABEL = Resources.getString("dialog.newmap.maptype.label");
+    private static final String OK_BUTTON = Resources.getString("general.button.ok");
+    private static final String CANCEL_BUTTON = Resources.getString("general.button.cancel");
+    private static final String ISOMETRIC_MAPTYPE = Resources.getString("general.maptype.isometric");
+    private static final String OBLIQUE_MAPTYPE = Resources.getString("general.maptype.oblique");
+    private static final String HEXAGONAL_MAPTYPE = Resources.getString("general.maptype.hexagonal");
+    private static final String SHIFTED_MAPTYPE = Resources.getString("general.maptype.shifted");
+    private static final String ORTHOGONAL_MAPTYPE = Resources.getString("general.maptype.orthogonal");
+
     public NewMapDialog(JFrame parent) {
-        super(parent, "New Map", true);
+        super(parent, DIALOG_TITLE, true);
         init();
         pack();
         setResizable(false);
@@ -66,15 +81,15 @@
         JPanel mapSize = new VerticalStaticJPanel();
         mapSize.setLayout(new GridBagLayout());
         mapSize.setBorder(BorderFactory.createCompoundBorder(
-                    BorderFactory.createTitledBorder("Map size"),
+                    BorderFactory.createTitledBorder(MAPSIZE_TITLE),
                     BorderFactory.createEmptyBorder(0, 5, 5, 5)));
         GridBagConstraints c = new GridBagConstraints();
         c.anchor = GridBagConstraints.EAST;
         c.fill = GridBagConstraints.NONE;
         c.insets = new Insets(5, 0, 0, 0);
-        mapSize.add(new JLabel("Width: "), c);
+        mapSize.add(new JLabel(WIDTH_LABEL), c);
         c.gridy = 1;
-        mapSize.add(new JLabel("Height: "), c);
+        mapSize.add(new JLabel(HEIGHT_LABEL), c);
         c.fill = GridBagConstraints.HORIZONTAL;
         c.gridx = 1; c.gridy = 0; c.weightx = 1;
         mapSize.add(mapWidth, c);
@@ -86,13 +101,13 @@
         JPanel tileSize = new VerticalStaticJPanel();
         tileSize.setLayout(new GridBagLayout());
         tileSize.setBorder(BorderFactory.createCompoundBorder(
-                    BorderFactory.createTitledBorder("Tile size"),
+                    BorderFactory.createTitledBorder(TILESIZE_TITLE),
                     BorderFactory.createEmptyBorder(0, 5, 5, 5)));
         c.gridx = 0; c.gridy = 0; c.weightx = 0;
         c.fill = GridBagConstraints.NONE;
-        tileSize.add(new JLabel("Width: "), c);
+        tileSize.add(new JLabel(WIDTH_LABEL), c);
         c.gridy = 1;
-        tileSize.add(new JLabel("Height: "), c);
+        tileSize.add(new JLabel(HEIGHT_LABEL), c);
         c.fill = GridBagConstraints.HORIZONTAL;
         c.gridx = 1; c.gridy = 0; c.weightx = 1;
         tileSize.add(tileWidth, c);
@@ -101,8 +116,8 @@
 
         // OK and Cancel buttons
 
-        JButton okButton = new JButton("OK");
-        JButton cancelButton = new JButton("Cancel");
+        JButton okButton = new JButton(OK_BUTTON);
+        JButton cancelButton = new JButton(CANCEL_BUTTON);
         okButton.addActionListener(this);
         cancelButton.addActionListener(this);
 
@@ -116,19 +131,19 @@
         // Map type and name inputs
 
         mapTypeChooser = new JComboBox();
-        mapTypeChooser.addItem("Orthogonal");
-        mapTypeChooser.addItem("Isometric");
-        mapTypeChooser.addItem("Shifted (iso and hex)");
+        mapTypeChooser.addItem(ORTHOGONAL_MAPTYPE);
+        mapTypeChooser.addItem(ISOMETRIC_MAPTYPE);
+        mapTypeChooser.addItem(SHIFTED_MAPTYPE);
         // TODO: Enable when view is implemented
-        //mapTypeChooser.addItem("Oblique");
-        mapTypeChooser.addItem("Hexagonal (experimental)");
+        mapTypeChooser.addItem(OBLIQUE_MAPTYPE);
+        mapTypeChooser.addItem(HEXAGONAL_MAPTYPE);
 
         JPanel miscPropPanel = new VerticalStaticJPanel();
         miscPropPanel.setLayout(new GridBagLayout());
         miscPropPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
         c.gridx = 0; c.gridy = 0; c.weightx = 0;
         c.fill = GridBagConstraints.NONE;
-        miscPropPanel.add(new JLabel("Map type: "), c);
+        miscPropPanel.add(new JLabel(MAPTYPE_LABEL), c);
         c.fill = GridBagConstraints.HORIZONTAL;
         c.gridx = 1; c.gridy = 0; c.weightx = 1;
         miscPropPanel.add(mapTypeChooser, c);
@@ -162,7 +177,7 @@
     }
 
     public void actionPerformed(ActionEvent e) {
-        if (e.getActionCommand().equals("OK")) {
+        if (e.getActionCommand().equals(OK_BUTTON)) {
             int w = mapWidth.intValue();
             int h = mapHeight.intValue();
             int twidth = tileWidth.intValue();
@@ -170,13 +185,13 @@
             int orientation = Map.MDO_ORTHO;
             String mapTypeString = (String)mapTypeChooser.getSelectedItem();
 
-            if (mapTypeString.equals("Isometric")) {
+            if (mapTypeString.equals(ISOMETRIC_MAPTYPE)) {
                 orientation = Map.MDO_ISO;
-            } else if (mapTypeString.equals("Oblique")) {
+            } else if (mapTypeString.equals(OBLIQUE_MAPTYPE)) {
                 orientation = Map.MDO_OBLIQUE;
-            } else if (mapTypeString.equals("Hexagonal (experimental)")) {
+            } else if (mapTypeString.equals(HEXAGONAL_MAPTYPE)) {
                 orientation = Map.MDO_HEX;
-            } else if (mapTypeString.equals("Shifted (iso and hex)")) {
+            } else if (mapTypeString.equals(SHIFTED_MAPTYPE)) {
                 orientation = Map.MDO_SHIFTED;
             }
 

Modified: branches/bjorn/src/tiled/mapeditor/dialogs/PluginDialog.java
===================================================================
--- branches/bjorn/src/tiled/mapeditor/dialogs/PluginDialog.java	2006-02-26 22:20:23 UTC (rev 589)
+++ branches/bjorn/src/tiled/mapeditor/dialogs/PluginDialog.java	2006-02-27 20:11:27 UTC (rev 590)
@@ -25,6 +25,7 @@
 import tiled.io.MapWriter;
 import tiled.mapeditor.plugin.PluginClassLoader;
 import tiled.mapeditor.widget.VerticalStaticJPanel;
+import tiled.mapeditor.Resources;
 
 /**
  * @version $Id$
@@ -36,8 +37,13 @@
     private JList pluginList;
     private JButton closeButton, infoButton, removeButton;
 
+    private static final String DIALOG_TITLE = Resources.getString("dialog.plugins.title");
+    private static final String INFO_BUTTON = Resources.getString("dialog.plugins.info.button");
+    private static final String REMOVE_BUTTON = Resources.getString("dialog.plugins.remove.button");
+    private static final String CLOSE_BUTTON = Resources.getString("dialog.plugins.close.button");
+
     public PluginDialog(JFrame parent, PluginClassLoader pluginLoader) {
-        super(parent, "Available Plugins", true);
+        super(parent, DIALOG_TITLE, true);
         this.pluginLoader = pluginLoader;
 
         init();
@@ -75,9 +81,9 @@
 
 
         /* BUTTON PANEL */
-        infoButton = new JButton("Info");
-        removeButton = new JButton("Remove");
-        closeButton = new JButton("Close");
+        infoButton = new JButton(INFO_BUTTON);
+        removeButton = new JButton(REMOVE_BUTTON);
+        closeButton = new JButton(CLOSE_BUTTON);
         infoButton.addActionListener(this);
         removeButton.addActionListener(this);
         closeButton.addActionListener(this);

Modified: branches/bjorn/src/tiled/mapeditor/dialogs/PropertiesDialog.java
===================================================================
--- branches/bjorn/src/tiled/mapeditor/dialogs/PropertiesDialog.java	2006-02-26 22:20:23 UTC (rev 589)
+++ branches/bjorn/src/tiled/mapeditor/dialogs/PropertiesDialog.java	2006-02-27 20:11:27 UTC (rev 590)
@@ -33,8 +33,12 @@
     private final Properties properties;
     private final PropertiesTableModel tableModel = new PropertiesTableModel();
 
+    private static final String DIALOG_TITLE = Resources.getString("dialog.properties.title");
+    private static final String OK_BUTTON = Resources.getString("general.button.ok");
+    private static final String CANCEL_BUTTON = Resources.getString("general.button.cancel");
+
     public PropertiesDialog(JFrame parent, Properties p) {
-        super(parent, "Properties", true);
+        super(parent, DIALOG_TITLE, true);
         properties = p;
         init();
         pack();
@@ -47,8 +51,8 @@
         JScrollPane propScrollPane = new JScrollPane(tProperties);
         propScrollPane.setPreferredSize(new Dimension(200, 150));
 
-        bOk = new JButton("OK");
-        bCancel = new JButton("Cancel");
+        bOk = new JButton(OK_BUTTON);
+        bCancel = new JButton(CANCEL_BUTTON);
         bDel = new JButton(Resources.getIcon("gnome-delete.png"));
 
         bOk.addActionListener(this);

Modified: branches/bjorn/src/tiled/mapeditor/dialogs/TilePaletteDialog.java
===================================================================
--- branches/bjorn/src/tiled/mapeditor/dialogs/TilePaletteDialog.java	2006-02-26 22:20:23 UTC (rev 589)
+++ branches/bjorn/src/tiled/mapeditor/dialogs/TilePaletteDialog.java	2006-02-27 20:11:27 UTC (rev 590)
@@ -25,6 +25,7 @@
 import tiled.core.Map;
 import tiled.core.Tile;
 import tiled.mapeditor.MapEditor;
+import tiled.mapeditor.Resources;
 import tiled.mapeditor.util.TileSelectionEvent;
 import tiled.mapeditor.util.TileSelectionListener;
 import tiled.mapeditor.widget.TilePalettePanel;
@@ -36,10 +37,11 @@
     private Map currentMap;
     private TilePalettePanel pc;
     private JList sets;
-    private Tile currentTile;
 
+    private static final String DIALOG_TITLE = Resources.getString("dialog.tilepalette.title");
+
     public TilePaletteDialog(MapEditor editor, Map map) {
-        super(editor.getAppFrame(), "Palette", false);
+        super(editor.getAppFrame(), DIALOG_TITLE, false);
         this.editor = editor;
         init();
         setMap(map);

Modified: branches/bjorn/src/tiled/mapeditor/resources/gui.properties
===================================================================
--- branches/bjorn/src/tiled/mapeditor/resources/gui.properties	2006-02-26 22:20:23 UTC (rev 589)
+++ branches/bjorn/src/tiled/mapeditor/resources/gui.properties	2006-02-27 20:11:27 UTC (rev 590)
@@ -1,13 +1,27 @@
+action.layer.add.name=Add Layer
+action.layer.add.tooltip=Add a layer
+action.layer.delete.name=Delete Layer
+action.layer.delete.tooltip=Delete current layer
+action.layer.duplicate.name=Duplicate Layer
+action.layer.duplicate.tooltip=Duplicate current layer
+action.layer.moveup.name=Move Layer Up
 action.tileset.remove.error.layer-locked.message=A layer containing tiles used by this tileset is locked,\n it needs to be unlocked before the tileset can be completely removed.
 action.tileset.remove.error.title=Error while removing tileset
+action.zoom.in.name=Zoom In
+action.zoom.out.name=Zoom Out
 dialog.brush.title=Brush Options
+dialog.newmap.height.label=Height:
+dialog.newmap.mapsize.title=Map size
+dialog.newmap.maptype.label=Map type:
+dialog.newmap.tilesize.title=Tile size
+dialog.newmap.title=New Map
+dialog.newmap.width.label=Width:
 dialog.newtileset.autotiles.label=Automatically create tiles from images
 dialog.newtileset.colorchoose.error.title=Error while choosing color
 dialog.newtileset.fromtilesetimg.title=From tileset image
 dialog.newtileset.image.label=Tile image:
 dialog.newtileset.imgload.error.message=Error while loading image:
 dialog.newtileset.import.error.message=Error while importing tileset
-dialog.newtileset.import.error=
 dialog.newtileset.name.label=Tileset name:
 dialog.newtileset.tileheight.label=Tile height:
 dialog.newtileset.tilesetimgref.label=Reference tileset image
@@ -15,6 +29,12 @@
 dialog.newtileset.tilewidth.label=Tile width:
 dialog.newtileset.title=New Tileset
 dialog.newtileset.usetransparentcolor.label=Use transparent color
+dialog.plugins.close.button=Close
+dialog.plugins.info.button=Info
+dialog.plugins.remove.button=Remove
+dialog.plugins.title=Available Plugins
+dialog.preferences.title=Preferences
+dialog.properties.title=Properties
 dialog.resizemap.currentsize.title=Current size
 dialog.resizemap.height.label=Height:
 dialog.resizemap.newsize.title=New size
@@ -23,8 +43,14 @@
 dialog.resizemap.width.label=Width:
 dialog.resizemap.x.label=X:
 dialog.resizemap.y.label=Y:
+dialog.tilepalette.title=Palette
 general.button.browse=Browse...
 general.button.cancel=Cancel
 general.button.ok=OK
 general.file.exists.message=The file already exists. Do you wish to overwrite it?
 general.file.untitled=Untitled
+general.maptype.hexagonal=Hexagonal (experimental)
+general.maptype.isometric=Isometric
+general.maptype.oblique=Oblique
+general.maptype.orthogonal=Orthogonal
+general.maptype.shifted=Shifted (iso and hex)




More information about the tiled-commit mailing list