Changeset 104 in josm
- Timestamp:
- 2006-07-03T00:31:24+02:00 (19 years ago)
- Files:
-
- 9 added
- 1 deleted
- 72 edited
Legend:
- Unmodified
- Added
- Removed
-
.classpath
r103 r104 7 7 <classpathentry kind="lib" path="lib/MinML2.jar"/> 8 8 <classpathentry kind="lib" path="lib/metadata-extractor-2.3.1.jar"/> 9 <classpathentry kind="lib" path="lib/gettext-commons-0.9.jar"/> 9 10 <classpathentry kind="output" path="bin"/> 10 11 </classpath> -
CONTRIBUTION
r103 r104 11 11 2.0. The world image is from onearth.pl. 12 12 13 The gettext-commons-0.9.jar is from Felix Berger and Steffen Pingel (http://xnap-commons.sourceforge.net/gettext-commons/). The jar-file is licensed under LGPL. 14 15 A internationalization-patch was submited 2006 by Sven Anders <sven@anders-hamburg.de>. 13 16 14 17 All the rest are belong to me. -
src/org/openstreetmap/josm/Main.java
r103 r104 1 1 package org.openstreetmap.josm; 2 import static org.openstreetmap.josm.tools.I18n.tr; 2 3 3 4 import java.awt.BorderLayout; … … 149 150 final Action aboutAction = new AboutAction(); 150 151 151 final JMenu fileMenu = new JMenu( "Files");152 final JMenu fileMenu = new JMenu(tr("Files")); 152 153 fileMenu.setMnemonic('F'); 153 154 fileMenu.add(openAction); … … 159 160 160 161 161 final JMenu connectionMenu = new JMenu("Connection"); 162 final JMenu connectionMenu = new JMenu(tr("Connection")); 162 163 connectionMenu.setMnemonic('C'); 163 164 connectionMenu.add(downloadAction); 165 //connectionMenu.add(new DownloadIncompleteAction()); 164 166 connectionMenu.add(uploadAction); 165 167 mainMenu.add(connectionMenu); 166 168 167 layerMenu = new JMenu( "Layer");169 layerMenu = new JMenu(tr("Layer")); 168 170 layerMenu.setMnemonic('L'); 169 171 mainMenu.add(layerMenu); 170 172 layerMenu.setVisible(false); 171 173 172 final JMenu editMenu = new JMenu( "Edit");174 final JMenu editMenu = new JMenu(tr("Edit")); 173 175 editMenu.setMnemonic('E'); 174 176 editMenu.add(undoAction); … … 179 181 180 182 mainMenu.add(new JSeparator()); 181 final JMenu helpMenu = new JMenu( "Help");183 final JMenu helpMenu = new JMenu(tr("Help")); 182 184 helpMenu.setMnemonic('H'); 183 185 helpMenu.add(aboutAction); … … 220 222 public final OsmDataLayer editLayer() { 221 223 if (map == null || map.mapView.editLayer == null) 222 addLayer(new OsmDataLayer(ds, "unnamed", false)); 224 addLayer(new OsmDataLayer(ds, tr("unnamed"), false)); 223 225 return map.mapView.editLayer; 224 226 } … … 270 272 } catch (final IOException e1) { 271 273 e1.printStackTrace(); 272 errMsg = "Preferences could not be loaded. Write default preference file to '"+pref.getPreferencesDir()+"preferences'."; 274 errMsg = tr("Preferences could not be loaded. Write default preference file to '{0}'.", 275 pref.getPreferencesDir() + "preferences"); 273 276 Main.pref.resetToDefault(); 274 277 } … … 280 283 } catch (final Exception e) { 281 284 e.printStackTrace(); 282 JOptionPane.showMessageDialog(null, "The projection could not be read from preferences. Using EPSG:4263."); 285 JOptionPane.showMessageDialog(null, tr("The projection could not be read from preferences. Using EPSG:4263.")); 283 286 Main.proj = new Epsg4326(); 284 287 } … … 336 339 final Bounds b = DownloadAction.osmurl2bounds(s); 337 340 if (b == null) 338 JOptionPane.showMessageDialog(Main.parent, "Ignoring malformed url: ' "+s+"'");341 JOptionPane.showMessageDialog(Main.parent, tr("Ignoring malformed url: '{0}'", s)); 339 342 else 340 343 main.downloadAction.download(false, b.min.lat(), b.min.lon(), b.max.lat(), b.max.lon()); … … 346 349 main.openAction.openFile(new File(new URI(s))); 347 350 } catch (URISyntaxException e) { 348 JOptionPane.showMessageDialog(Main.parent, "Ignoring malformed file url: ' "+s+"'");351 JOptionPane.showMessageDialog(Main.parent, tr("Ignoring malformed file url: '{0}", s)); 349 352 } 350 353 return; -
src/org/openstreetmap/josm/actions/AboutAction.java
r98 r104 1 1 package org.openstreetmap.josm.actions; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.Dimension; … … 34 36 */ 35 37 public class AboutAction extends JosmAction { 36 38 37 39 public AboutAction() { 38 super( "About", "about",40 super(tr("About"), "about",tr("Display the about screen."), KeyEvent.VK_A); 39 41 } 40 42 … … 54 56 55 57 JPanel info = new JPanel(new GridBagLayout()); 56 info.add(new JLabel("Java OpenStreetMap Editor Version "+version), GBC.eop());57 info.add(new JLabel("last change at "+time), GBC.eop());58 info.add(new JLabel("Homepage"), GBC.std().insets(0,0,10,0)); 58 info.add(new JLabel(tr("Java OpenStreetMap Editor Version {0}",version)), GBC.eop()); 59 info.add(new JLabel(tr("last change at {0}",time)), GBC.eop()); 60 info.add(new JLabel(tr("Homepage")), GBC.std().insets(0,0,10,0)); 59 61 info.add(new UrlLabel("http://wiki.eigenheimstrasse.de/wiki/JOSM"), GBC.eol()); 62 info.add(new JLabel(tr("Bug Reports")), GBC.std().insets(0,0,10,0)); 63 info.add(new UrlLabel("http://trac.openstreetmap.org"), GBC.eol()); 60 64 61 65 62 66 63 about.addTab( "Info", info);64 about.addTab( "Readme", new JScrollPane(readme));65 about.addTab("Revision", new JScrollPane(revision)); 67 about.addTab(tr("Info"), info); 68 about.addTab(tr("Readme"), new JScrollPane(readme)); 69 about.addTab(tr("Revision"), new JScrollPane(revision)); 66 70 67 71 about.setPreferredSize(new Dimension(500,300)); 68 72 69 JOptionPane.showMessageDialog(Main.parent, about, "About JOSM...", 73 JOptionPane.showMessageDialog(Main.parent, about, tr("About JOSM..."), 70 74 JOptionPane.INFORMATION_MESSAGE, ImageProvider.get("logo")); 71 75 } … … 77 81 */ 78 82 private JTextArea loadFile(URL resource) { 79 JTextArea area = new JTextArea("File could not be found."); 83 JTextArea area = new JTextArea(tr("File could not be found.")); 80 84 area.setEditable(false); 81 85 Font font = Font.getFont("monospaced"); -
src/org/openstreetmap/josm/actions/AutoScaleAction.java
r94 r104 1 1 package org.openstreetmap.josm.actions; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.event.ActionEvent; … … 30 32 private final AutoScaleMode mode; 31 33 public Action(AutoScaleMode mode) { 32 super("Auto Scale : "+mode, ImageProvider.get("dialogs/autoscale/"+mode));33 putValue(SHORT_DESCRIPTION, "Auto zoom the view 34 super(tr("Auto Scale"+": "+tr(mode.toString())), ImageProvider.get("dialogs/autoscale/"+mode)); 35 putValue(SHORT_DESCRIPTION, tr("Auto zoom the view")+tr("(to "+mode+")")+tr(". Disabled if the view is moved.")); 34 36 this.mode = mode; 35 37 } -
src/org/openstreetmap/josm/actions/DiskAccessAction.java
r98 r104 1 1 package org.openstreetmap.josm.actions; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.io.File; … … 54 56 File file = fc.getSelectedFile(); 55 57 if (file == null || (file.exists() && JOptionPane.YES_OPTION != 56 JOptionPane.showConfirmDialog(Main.parent, "File exists. Overwrite?" ,"Overwrite", JOptionPane.YES_NO_OPTION)))58 JOptionPane.showConfirmDialog(Main.parent, tr("File exists. Overwrite?"), tr("Overwrite"), JOptionPane.YES_NO_OPTION))) 57 59 return null; 58 60 } -
src/org/openstreetmap/josm/actions/DownloadAction.java
r103 r104 1 1 package org.openstreetmap.josm.actions; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.Dimension; … … 42 44 import org.openstreetmap.josm.gui.layer.RawGpsLayer; 43 45 import org.openstreetmap.josm.gui.layer.RawGpsLayer.GpsPoint; 44 import org.openstreetmap.josm.io. OsmServerReader;46 import org.openstreetmap.josm.io.BoundingBoxDownloader; 45 47 import org.openstreetmap.josm.tools.GBC; 46 48 import org.xml.sax.SAXException; … … 55 57 */ 56 58 public class DownloadAction extends JosmAction { 57 58 59 /** 59 60 * Open the download dialog and download the data. … … 61 62 */ 62 63 private final class DownloadOsmTask extends PleaseWaitRunnable { 63 private final OsmServerReader reader;64 private final BoundingBoxDownloader reader; 64 65 private DataSet dataSet; 65 66 66 private DownloadOsmTask( OsmServerReader reader) {67 super("Downloading data"); 67 private DownloadOsmTask(BoundingBoxDownloader reader) { 68 super(tr("Downloading data")); 68 69 this.reader = reader; 69 70 reader.setProgressInformation(currentAction, progress); … … 77 78 if (dataSet == null) 78 79 return; // user cancelled download or error occoured 79 if (dataSet. nodes.isEmpty())80 errorMessage = "No data imported."; 81 Main.main.addLayer(new OsmDataLayer(dataSet, "Data Layer", false)); 80 if (dataSet.allPrimitives().isEmpty()) 81 errorMessage = tr("No data imported."); 82 Main.main.addLayer(new OsmDataLayer(dataSet, tr("Data Layer"), false)); 82 83 } 83 84 … … 89 90 90 91 private final class DownloadGpsTask extends PleaseWaitRunnable { 91 private final OsmServerReader reader;92 private final BoundingBoxDownloader reader; 92 93 private Collection<Collection<GpsPoint>> rawData; 93 94 94 private DownloadGpsTask( OsmServerReader reader) {95 super("Downloading GPS data"); 95 private DownloadGpsTask(BoundingBoxDownloader reader) { 96 super(tr("Downloading GPS data")); 96 97 this.reader = reader; 97 98 reader.setProgressInformation(currentAction, progress); … … 123 124 new JTextField(9), 124 125 new JTextField(9)}; 125 JCheckBox rawGps = new JCheckBox("Open as raw gps data", false); 126 JCheckBox rawGps = new JCheckBox(tr("Open as raw gps data"), false); 126 127 127 128 public DownloadAction() { 128 super("Download from OSM", "download", "Download map data from the OSM server." ,"Ctrl-Shift-D",129 super(tr("Download from OSM"), "download", tr("Download map data from the OSM server."), tr("Ctrl-Shift-D"), 129 130 KeyStroke.getKeyStroke(KeyEvent.VK_D, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK)); 130 131 // TODO remove when bug in Java6 is fixed … … 139 140 WorldChooser wc = new WorldChooser(); 140 141 dlg.add(wc, GBC.eop()); 141 wc.setToolTipText("Move and zoom the image like the main map. Select an area to download by dragging."); 142 wc.setToolTipText(tr("Move and zoom the image like the main map. Select an area to download by dragging.")); 142 143 143 144 // Bounding box edits 144 dlg.add(new JLabel("Bounding box"), GBC.eol()); 145 dlg.add(new JLabel("min lat"), GBC.std().insets(10,0,5,0)); 145 dlg.add(new JLabel(tr("Bounding box")), GBC.eol()); 146 dlg.add(new JLabel(tr("min lat")), GBC.std().insets(10,0,5,0)); 146 147 dlg.add(latlon[0], GBC.std()); 147 dlg.add(new JLabel("min lon"), GBC.std().insets(10,0,5,0)); 148 dlg.add(new JLabel(tr("min lon")), GBC.std().insets(10,0,5,0)); 148 149 dlg.add(latlon[1], GBC.eol()); 149 dlg.add(new JLabel("max lat"), GBC.std().insets(10,0,5,0)); 150 dlg.add(new JLabel(tr("max lat")), GBC.std().insets(10,0,5,0)); 150 151 dlg.add(latlon[2], GBC.std()); 151 dlg.add(new JLabel("max lon"), GBC.std().insets(10,0,5,0)); 152 dlg.add(new JLabel(tr("max lon")), GBC.std().insets(10,0,5,0)); 152 153 dlg.add(latlon[3], GBC.eol()); 153 154 if (Main.map != null) { … … 161 162 162 163 // OSM url edit 163 dlg.add(new JLabel("URL from www.openstreetmap.org"), GBC.eol()); 164 dlg.add(new JLabel(tr("URL from www.openstreetmap.org")), GBC.eol()); 164 165 final JTextField osmUrl = new JTextField(); 165 166 dlg.add(osmUrl, GBC.eop().fill(GBC.HORIZONTAL)); … … 214 215 215 216 // Bookmarks 216 dlg.add(new JLabel("Bookmarks"), GBC.eol()); 217 dlg.add(new JLabel(tr("Bookmarks")), GBC.eol()); 217 218 final BookmarkList bookmarks = new BookmarkList(); 218 219 bookmarks.getSelectionModel().addListSelectionListener(new ListSelectionListener(){ … … 231 232 232 233 JPanel buttons = new JPanel(new GridLayout(1,2)); 233 JButton add = new JButton( "Add");234 JButton add = new JButton(tr("Add")); 234 235 add.addActionListener(new ActionListener(){ 235 236 public void actionPerformed(ActionEvent e) { 236 237 Bookmark b = readBookmark(); 237 238 if (b == null) { 238 JOptionPane.showMessageDialog(Main.parent, "Please enter the desired coordinates first."); 239 JOptionPane.showMessageDialog(Main.parent, tr("Please enter the desired coordinates first.")); 239 240 return; 240 241 } 241 b.name = JOptionPane.showInputDialog(Main.parent, 242 b.name = JOptionPane.showInputDialog(Main.parent,tr("Please enter a name for the location.")); 242 243 if (b.name != null && !b.name.equals("")) { 243 244 ((DefaultListModel)bookmarks.getModel()).addElement(b); … … 247 248 }); 248 249 buttons.add(add); 249 JButton remove = new JButton( "Remove");250 JButton remove = new JButton(tr("Remove")); 250 251 remove.addActionListener(new ActionListener(){ 251 252 public void actionPerformed(ActionEvent e) { 252 253 Object sel = bookmarks.getSelectedValue(); 253 254 if (sel == null) { 254 JOptionPane.showMessageDialog(Main.parent, 255 JOptionPane.showMessageDialog(Main.parent,tr("Select a bookmark first.")); 255 256 return; 256 257 } … … 270 271 do { 271 272 final JOptionPane pane = new JOptionPane(dlg, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION); 272 final JDialog panedlg = pane.createDialog(Main.parent, "Choose an area"); 273 final JDialog panedlg = pane.createDialog(Main.parent, tr("Choose an area")); 273 274 bookmarks.addMouseListener(new MouseAdapter(){ 274 275 @Override public void mouseClicked(MouseEvent e) { … … 285 286 b = readBookmark(); 286 287 if (b == null) 287 JOptionPane.showMessageDialog(Main.parent, 288 JOptionPane.showMessageDialog(Main.parent,tr("Please enter the desired coordinates or click on a bookmark.")); 288 289 } while (b == null); 289 290 … … 365 366 */ 366 367 public void download(boolean rawGps, double minlat, double minlon, double maxlat, double maxlon) { 367 OsmServerReader reader = newOsmServerReader(minlat, minlon, maxlat, maxlon);368 BoundingBoxDownloader reader = new BoundingBoxDownloader(minlat, minlon, maxlat, maxlon); 368 369 PleaseWaitRunnable task = rawGps ? new DownloadGpsTask(reader) : new DownloadOsmTask(reader); 369 370 Main.worker.execute(task); -
src/org/openstreetmap/josm/actions/ExitAction.java
r68 r104 1 1 package org.openstreetmap.josm.actions; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.event.ActionEvent; … … 10 12 */ 11 13 public class ExitAction extends JosmAction { 12 13 14 /** 14 15 * Construct the action with "Exit" as label 15 16 */ 16 17 public ExitAction() { 17 super( "Exit", "exit", "Exit the application.", KeyEvent.VK_X);18 super(tr("Exit"), "exit", tr("Exit the application."), KeyEvent.VK_X); 18 19 } 19 20 20 21 public void actionPerformed(ActionEvent e) { 21 // todo: check for modified windows before exiting22 22 System.exit(0); 23 23 } 24 25 24 } -
src/org/openstreetmap/josm/actions/ExtensionFileFilter.java
r86 r104 1 1 package org.openstreetmap.josm.actions; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.io.File; … … 12 14 */ 13 15 public class ExtensionFileFilter extends FileFilter { 14 15 16 private final String extension; 16 17 private final String description; … … 22 23 23 24 public static ExtensionFileFilter[] filters = { 24 new ExtensionFileFilter("osm,xml", "osm", "OSM Server Version 0.2(.osm .xml)"),25 new ExtensionFileFilter("gpx", "gpx", "GPX Files Version 0.1 (.gpx)"),26 new ExtensionFileFilter("csv,txt", "csv", "CSV Files Version 0.1(.csv .txt)"),25 new ExtensionFileFilter("osm,xml", "osm", tr("OSM Server Files (.osm .xml)")), 26 new ExtensionFileFilter("gpx", "gpx", tr("GPX Files (.gpx)")), 27 new ExtensionFileFilter("csv,txt", "csv", tr("CSV Files (.csv .txt)")), 27 28 }; 28 29 -
src/org/openstreetmap/josm/actions/GpxExportAction.java
r103 r104 1 1 package org.openstreetmap.josm.actions; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.GridBagLayout; … … 36 38 public class GpxExportAction extends DiskAccessAction { 37 39 38 private final static String warningGpl = "<html><font color='red' size='-2'>Note: GPL is not compatible to the OSM license. Do not upload GPL licensed tracks</html>"; 40 private final static String warningGpl = tr("<html><font color='red' size='-2'>Note: GPL is not compatible to the OSM license. Do not upload GPL licensed tracks</html>"); 39 41 40 42 private final Layer layer; 41 43 42 44 public GpxExportAction(Layer layer) { 43 super("Export to GPX", "exportgpx", "Export the data to GPX file." ,"Ctrl-E", KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.CTRL_DOWN_MASK));45 super(tr("Export to GPX"), "exportgpx", tr("Export the data to GPX file."), tr("Ctrl-E"), KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.CTRL_DOWN_MASK)); 44 46 this.layer = layer; 45 47 } … … 47 49 public void actionPerformed(ActionEvent e) { 48 50 if (layer == null && Main.map == null) { 49 JOptionPane.showMessageDialog(Main.parent, "Nothing to export. Get some data first."); 51 JOptionPane.showMessageDialog(Main.parent, tr("Nothing to export. Get some data first.")); 50 52 return; 51 53 } … … 71 73 JPanel p = new JPanel(new GridBagLayout()); 72 74 73 p.add(new JLabel("gps track description"), GBC.eol()); 75 p.add(new JLabel(tr("gps track description")), GBC.eol()); 74 76 JTextArea desc = new JTextArea(3,40); 75 77 desc.setWrapStyleWord(true); … … 77 79 p.add(new JScrollPane(desc), GBC.eop().fill(GBC.BOTH)); 78 80 79 JCheckBox author = new JCheckBox("Add author information", Main.pref.getBoolean("lastAddAuthor", true)); 81 JCheckBox author = new JCheckBox(tr("Add author information"), Main.pref.getBoolean("lastAddAuthor", true)); 80 82 author.setSelected(true); 81 83 p.add(author, GBC.eol()); 82 JLabel nameLabel = new JLabel("Real name"); 84 JLabel nameLabel = new JLabel(tr("Real name")); 83 85 p.add(nameLabel, GBC.std().insets(10,0,5,0)); 84 86 JTextField authorName = new JTextField(Main.pref.get("lastAuthorName")); 85 87 p.add(authorName, GBC.eol().fill(GBC.HORIZONTAL)); 86 JLabel emailLabel = new JLabel( "Email");88 JLabel emailLabel = new JLabel(tr("Email")); 87 89 p.add(emailLabel, GBC.std().insets(10,0,5,0)); 88 90 JTextField email = new JTextField(Main.pref.get("osm-server.username")); 89 91 p.add(email, GBC.eol().fill(GBC.HORIZONTAL)); 90 JLabel copyrightLabel = new JLabel("Copyright (URL)"); 92 JLabel copyrightLabel = new JLabel(tr("Copyright (URL)")); 91 93 p.add(copyrightLabel, GBC.std().insets(10,0,5,0)); 92 94 JTextField copyright = new JTextField(); 93 95 p.add(copyright, GBC.std().fill(GBC.HORIZONTAL)); 94 JButton predefined = new JButton("Predefined"); 96 JButton predefined = new JButton(tr("Predefined")); 95 97 p.add(predefined, GBC.eol().insets(5,0,0,0)); 96 JLabel copyrightYearLabel = new JLabel("Copyright year"); 98 JLabel copyrightYearLabel = new JLabel(tr("Copyright year")); 97 99 p.add(copyrightYearLabel, GBC.std().insets(10,0,5,5)); 98 100 JTextField copyrightYear = new JTextField(""); … … 102 104 addDependencies(author, authorName, email, copyright, predefined, copyrightYear, nameLabel, emailLabel, copyrightLabel, copyrightYearLabel, warning); 103 105 104 p.add(new JLabel("Keywords"), GBC.eol()); 106 p.add(new JLabel(tr("Keywords")), GBC.eol()); 105 107 JTextField keywords = new JTextField(); 106 108 p.add(keywords, GBC.eop().fill(GBC.HORIZONTAL)); 107 109 108 int answer = JOptionPane.showConfirmDialog(Main.parent, p, "Export options", JOptionPane.OK_CANCEL_OPTION); 110 int answer = JOptionPane.showConfirmDialog(Main.parent, p, tr("Export options"), JOptionPane.OK_CANCEL_OPTION); 109 111 if (answer != JOptionPane.OK_OPTION) 110 112 return; … … 127 129 } catch (IOException x) { 128 130 x.printStackTrace(); 129 JOptionPane.showMessageDialog(Main.parent, "Error while exporting "+fn+":\n"+x.getMessage(),"Error", JOptionPane.ERROR_MESSAGE);131 JOptionPane.showMessageDialog(Main.parent, tr("Error while exporting {0}", fn)+":\n"+x.getMessage(), tr("Error"), JOptionPane.ERROR_MESSAGE); 130 132 } 131 133 } … … 178 180 predefined.addActionListener(new ActionListener(){ 179 181 public void actionPerformed(ActionEvent e) { 180 JList l = new JList(new String[]{"Creative Commons By-SA", "public domain", "GNU Lesser Public License (LGPL)", "BSD License ( same asMIT/X11)"});182 JList l = new JList(new String[]{"Creative Commons By-SA", "public domain", "GNU Lesser Public License (LGPL)", "BSD License (MIT/X11)"}); 181 183 l.setVisibleRowCount(4); 182 184 l.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); 183 int answer = JOptionPane.showConfirmDialog(Main.parent, new JScrollPane(l), 185 int answer = JOptionPane.showConfirmDialog(Main.parent, new JScrollPane(l),tr("Choose a predefined license"), JOptionPane.OK_CANCEL_OPTION); 184 186 if (answer != JOptionPane.OK_OPTION || l.getSelectedIndex() == -1) 185 187 return; -
src/org/openstreetmap/josm/actions/OpenAction.java
r103 r104 1 1 package org.openstreetmap.josm.actions; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.event.ActionEvent; … … 32 34 */ 33 35 public class OpenAction extends DiskAccessAction { 34 36 35 37 /** 36 38 * Create an open action. The name is "Open a file". 37 39 */ 38 40 public OpenAction() { 39 super( "Open", "open", "Open a file.","Ctrl-O", KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK));41 super(tr("Open"), "open", tr("Open a file."), tr("Ctrl-O"), KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK)); 40 42 } 41 43 … … 70 72 dataSet = OsmReader.parseDataSet(new FileInputStream(filename), null, null); 71 73 } else if (ExtensionFileFilter.filters[ExtensionFileFilter.CSV].acceptName(fn)) { 72 JOptionPane.showMessageDialog(Main.parent, fn+": CSV Data import for non-GPS data is not implemented yet."); 74 JOptionPane.showMessageDialog(Main.parent, fn+": "+tr("CSV Data import for non-GPS data is not implemented yet.")); 73 75 return; 74 76 } else { 75 JOptionPane.showMessageDialog(Main.parent, fn+": Unknown file extension: "+fn.substring(filename.getName().lastIndexOf('.')+1));77 JOptionPane.showMessageDialog(Main.parent, fn+": "+tr("Unknown file extension: {0}", fn.substring(filename.getName().lastIndexOf('.')+1))); 76 78 return; 77 79 } 78 Main.main.addLayer(new OsmDataLayer(dataSet, "Data Layer", true)); 80 Main.main.addLayer(new OsmDataLayer(dataSet, tr("Data Layer"), true)); 79 81 } 80 82 } catch (SAXException x) { 81 83 x.printStackTrace(); 82 JOptionPane.showMessageDialog(Main.parent, "Error while parsing "+fn+": "+x.getMessage());84 JOptionPane.showMessageDialog(Main.parent, tr("Error while parsing {0}",fn)+": "+x.getMessage()); 83 85 } catch (IOException x) { 84 86 x.printStackTrace(); 85 JOptionPane.showMessageDialog(Main.parent, "Could not read ' "+fn+"'\n"+x.getMessage());87 JOptionPane.showMessageDialog(Main.parent, tr("Could not read '{0}'",fn)+"\n"+x.getMessage()); 86 88 } 87 89 } -
src/org/openstreetmap/josm/actions/PreferencesAction.java
r68 r104 1 1 package org.openstreetmap.josm.actions; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.event.ActionEvent; … … 19 21 */ 20 22 public PreferencesAction() { 21 super("Preferences", "preference", "Open a preferences page for global settings." , "F12", KeyStroke.getKeyStroke(KeyEvent.VK_F12, 0));23 super(tr("Preferences"), "preference", tr("Open a preferences page for global settings."), tr("F12"), KeyStroke.getKeyStroke(KeyEvent.VK_F12, 0)); 22 24 } 23 25 -
src/org/openstreetmap/josm/actions/RedoAction.java
r98 r104 1 1 package org.openstreetmap.josm.actions; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.event.ActionEvent; … … 21 23 */ 22 24 public RedoAction() { 23 super( "Redo", "redo", "Redo the last undone action.","Ctrl-Shift-Z", KeyStroke.getKeyStroke(KeyEvent.VK_Z, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK));25 super(tr("Redo"), "redo", tr("Redo the last undone action."), tr("Ctrl-Shift-Z"), KeyStroke.getKeyStroke(KeyEvent.VK_Z, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK)); 24 26 setEnabled(false); 25 27 } -
src/org/openstreetmap/josm/actions/SaveAction.java
r103 r104 1 1 package org.openstreetmap.josm.actions; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.event.ActionEvent; … … 22 24 */ 23 25 public class SaveAction extends DiskAccessAction { 24 26 25 27 /** 26 28 * Construct the action with "Save" as label. … … 29 31 */ 30 32 public SaveAction() { 31 super( "Save", "save", "Save the current data.","Ctrl-S", KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_DOWN_MASK));33 super(tr("Save"), "save", tr("Save the current data."), tr("Ctrl-S"), KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_DOWN_MASK)); 32 34 } 33 35 34 36 public void actionPerformed(ActionEvent event) { 35 37 if (Main.map == null) { 36 JOptionPane.showMessageDialog(Main.parent, "No document open so nothing to save."); 38 JOptionPane.showMessageDialog(Main.parent, tr("No document open so nothing to save.")); 37 39 return; 38 40 } 39 if (isDataSetEmpty() && JOptionPane.NO_OPTION == JOptionPane.showConfirmDialog(Main.parent, ,"Empty document", JOptionPane.YES_NO_OPTION))41 if (isDataSetEmpty() && JOptionPane.NO_OPTION == JOptionPane.showConfirmDialog(Main.parent,tr("The document contains no data. Save anyway?"), tr("Empty document"), JOptionPane.YES_NO_OPTION)) 40 42 return; 41 43 if (!Main.map.conflictDialog.conflicts.isEmpty()) { 42 44 int answer = JOptionPane.showConfirmDialog(Main.parent, 43 "There are unresolved conflicts. Conflicts will not be saved and handled as if you rejected all. Continue?" ,"Conflicts", JOptionPane.YES_NO_OPTION);45 tr("There are unresolved conflicts. Conflicts will not be saved and handled as if you rejected all. Continue?"),tr("Conflicts"), JOptionPane.YES_NO_OPTION); 44 46 if (answer != JOptionPane.YES_OPTION) 45 47 return; … … 70 72 Main.main.editLayer().cleanData(null, false); 71 73 } else if (ExtensionFileFilter.filters[ExtensionFileFilter.CSV].acceptName(fn)) { 72 JOptionPane.showMessageDialog(Main.parent, "CSV output not supported yet."); 74 JOptionPane.showMessageDialog(Main.parent, tr("CSV output not supported yet.")); 73 75 return; 74 76 } else { 75 JOptionPane.showMessageDialog(Main.parent, "Unknown file extension."); 77 JOptionPane.showMessageDialog(Main.parent, tr("Unknown file extension.")); 76 78 return; 77 79 } 78 80 } catch (IOException e) { 79 81 e.printStackTrace(); 80 JOptionPane.showMessageDialog(Main.parent, "An error occoured while saving.\n"+e.getMessage()); 82 JOptionPane.showMessageDialog(Main.parent, tr("An error occoured while saving.")+"\n"+e.getMessage()); 81 83 } 82 84 } -
src/org/openstreetmap/josm/actions/UndoAction.java
r98 r104 1 1 package org.openstreetmap.josm.actions; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.event.ActionEvent; … … 21 23 */ 22 24 public UndoAction() { 23 super( "Undo", "undo", "Undo the last action.","Ctrl-Z", KeyStroke.getKeyStroke(KeyEvent.VK_Z, InputEvent.CTRL_DOWN_MASK));25 super(tr("Undo"), "undo", tr("Undo the last action."), tr("Ctrl-Z"), KeyStroke.getKeyStroke(KeyEvent.VK_Z, InputEvent.CTRL_DOWN_MASK)); 24 26 setEnabled(false); 25 27 } -
src/org/openstreetmap/josm/actions/UploadAction.java
r103 r104 1 1 package org.openstreetmap.josm.actions; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.GridBagLayout; … … 32 34 */ 33 35 public class UploadAction extends JosmAction { 34 35 36 public UploadAction() { 36 super("Upload to OSM", "upload", "Upload all changes to the OSM server." ,"Ctrl-Shift-U",37 super(tr("Upload to OSM"), "upload", tr("Upload all changes to the OSM server."), tr("Ctrl-Shift-U"), 37 38 KeyStroke.getKeyStroke(KeyEvent.VK_U, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK)); 38 39 } … … 40 41 public void actionPerformed(ActionEvent e) { 41 42 if (Main.map == null) { 42 JOptionPane.showMessageDialog(Main.parent, 43 JOptionPane.showMessageDialog(Main.parent,tr("Nothing to upload. Get some data first.")); 43 44 return; 44 45 } 45 46 46 47 if (!Main.map.conflictDialog.conflicts.isEmpty()) { 47 JOptionPane.showMessageDialog(Main.parent, 48 JOptionPane.showMessageDialog(Main.parent,tr("There are unresolved conflicts. You have to resolve these first.")); 48 49 Main.map.conflictDialog.action.button.setSelected(true); 49 50 Main.map.conflictDialog.action.actionPerformed(null); … … 72 73 all.addAll(delete); 73 74 74 PleaseWaitRunnable uploadTask = new PleaseWaitRunnable("Uploading data"){ 75 PleaseWaitRunnable uploadTask = new PleaseWaitRunnable(tr("Uploading data")){ 75 76 @Override protected void realRun() throws SAXException { 76 77 server.setProgressInformation(currentAction, progress); … … 96 97 private boolean displayUploadScreen(Collection<OsmPrimitive> add, Collection<OsmPrimitive> update, Collection<OsmPrimitive> delete) { 97 98 if (add.isEmpty() && update.isEmpty() && delete.isEmpty()) { 98 JOptionPane.showMessageDialog(Main.parent, 99 JOptionPane.showMessageDialog(Main.parent,tr("No changes to upload.")); 99 100 return false; 100 101 } … … 105 106 106 107 if (!add.isEmpty()) { 107 p.add(new JLabel("Objects to add:"), GBC.eol()); 108 p.add(new JLabel(tr("Objects to add:")), GBC.eol()); 108 109 JList l = new JList(add.toArray()); 109 110 l.setCellRenderer(renderer); … … 113 114 114 115 if (!update.isEmpty()) { 115 p.add(new JLabel("Objects to modify:"), GBC.eol()); 116 p.add(new JLabel(tr("Objects to modify:")), GBC.eol()); 116 117 JList l = new JList(update.toArray()); 117 118 l.setCellRenderer(renderer); … … 121 122 122 123 if (!delete.isEmpty()) { 123 p.add(new JLabel("Objects to delete:"), GBC.eol()); 124 p.add(new JLabel(tr("Objects to delete:")), GBC.eol()); 124 125 JList l = new JList(delete.toArray()); 125 126 l.setCellRenderer(renderer); … … 128 129 } 129 130 130 return JOptionPane.showConfirmDialog(Main.parent, p, "Upload this changes?", 131 return JOptionPane.showConfirmDialog(Main.parent, p, tr("Upload this changes?"), 131 132 JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION; 132 133 } -
src/org/openstreetmap/josm/actions/WmsServerAction.java
r98 r104 1 1 package org.openstreetmap.josm.actions; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.event.ActionEvent; … … 11 13 12 14 public WmsServerAction() { 13 super("Show background", "wmsserver", "Download and show landsat background images.", KeyEvent.VK_B); 15 super(tr("Show background"), "wmsserver", tr("Download and show landsat background images."), KeyEvent.VK_B); 14 16 } 15 17 16 18 public void actionPerformed(ActionEvent e) { 17 JOptionPane.showMessageDialog(Main.parent, "Not implemented yet."); 19 JOptionPane.showMessageDialog(Main.parent, tr("Not implemented yet.")); 18 20 } 19 21 } -
src/org/openstreetmap/josm/actions/mapmode/AddNodeAction.java
r102 r104 1 1 package org.openstreetmap.josm.actions.mapmode; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.Cursor; … … 42 44 public AddNodeGroup(MapFrame mf) { 43 45 super(KeyEvent.VK_N,0); 44 actions.add(new AddNodeAction(mf, 45 actions.add(new AddNodeAction(mf, "Add node into segment", Mode.nodesegment, "Add a node into an existing segment")); 46 actions.add(new AddNodeAction(mf,tr("Add node"), Mode.node, tr("Add a new node to the map"))); 47 actions.add(new AddNodeAction(mf, tr("Add node into segment"), Mode.nodesegment,tr( "Add a node into an existing segment"))); 46 48 setCurrent(0); 47 49 } … … 79 81 Node n = new Node(Main.map.mapView.getLatLon(e.getX(), e.getY())); 80 82 if (n.coor.isOutSideWorld()) { 81 JOptionPane.showMessageDialog(Main.parent, 83 JOptionPane.showMessageDialog(Main.parent,tr("Can not add a node outside of the world.")); 82 84 return; 83 85 } … … 128 130 } 129 131 130 c = new SequenceCommand("Add Node into Segment", cmds); 132 c = new SequenceCommand(tr("Add Node into Segment"), cmds); 131 133 } 132 134 Main.main.editLayer().add(c); -
src/org/openstreetmap/josm/actions/mapmode/AddSegmentAction.java
r101 r104 1 1 package org.openstreetmap.josm.actions.mapmode; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.Color; … … 11 13 import org.openstreetmap.josm.Main; 12 14 import org.openstreetmap.josm.command.AddCommand; 13 import org.openstreetmap.josm.data.osm.Segment;14 15 import org.openstreetmap.josm.data.osm.Node; 15 16 import org.openstreetmap.josm.data.osm.OsmPrimitive; 17 import org.openstreetmap.josm.data.osm.Segment; 16 18 import org.openstreetmap.josm.gui.MapFrame; 17 19 import org.openstreetmap.josm.tools.ImageProvider; … … 47 49 */ 48 50 public AddSegmentAction(MapFrame mapFrame) { 49 super("Add segment", 51 super(tr("Add segment"), 50 52 "addsegment", 51 "Add a segment between two nodes.", 53 tr("Add a segment between two nodes."), 52 54 "G", 53 55 KeyEvent.VK_G, -
src/org/openstreetmap/josm/actions/mapmode/AddWayAction.java
r101 r104 1 1 package org.openstreetmap.josm.actions.mapmode; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 4 import static org.openstreetmap.josm.tools.I18n.trn; 2 5 3 6 import java.awt.event.KeyEvent; … … 48 51 */ 49 52 public class AddWayAction extends MapMode implements SelectionChangedListener { 50 51 53 private Way way; 52 54 … … 57 59 */ 58 60 public AddWayAction(MapFrame mapFrame) { 59 super("Add Way", "addway", "Add a new way to the data.", "W", KeyEvent.VK_W, mapFrame, ImageProvider.getCursor("normal", "way")); 61 super(tr("Add Way"), "addway", tr("Add a new way to the data."), "W", KeyEvent.VK_W, mapFrame, ImageProvider.getCursor("normal", "way")); 60 62 61 63 Main.ds.addSelectionChangedListener(this); … … 91 93 for (Segment seg : way.segments) { 92 94 if (seg.incomplete) { 93 JOptionPane.showMessageDialog(Main.parent, 95 JOptionPane.showMessageDialog(Main.parent,tr("Warning: This way is incomplete. Try to download it, before adding segments.")); 94 96 return; 95 97 } … … 139 141 for (Segment seg : way.segments) { 140 142 if (seg.incomplete) { 141 JOptionPane.showMessageDialog(Main.parent, "Warning: This way is incomplete. Try to download it, before adding segments."); 143 JOptionPane.showMessageDialog(Main.parent, tr("Warning: This way is incomplete. Try to download it, before adding segments.")); 142 144 break; 143 145 } … … 158 160 boolean reordered = false; 159 161 if (numberOfSelectedWays > 0) { 160 String ways = "way" + (numberOfSelectedWays==1?" has":"s have"); 161 int answer = JOptionPane.showConfirmDialog(Main.parent, numberOfSelectedWays+" "+ways+" been selected.\n" + 162 "Do you wish to select all segments belonging to the "+ways+" instead?", "Add segments from ways", JOptionPane.YES_NO_OPTION); 162 int answer = JOptionPane.showConfirmDialog(Main.parent,trn("{0} way has been selected.\nDo you wish to select all segments belonging to the way instead?","{0} ways have been selected.\nDo you wish to select all segments belonging to the ways instead?",numberOfSelectedWays,numberOfSelectedWays),tr("Add segments from ways"), JOptionPane.YES_NO_OPTION); 163 163 if (answer == JOptionPane.YES_OPTION) { 164 164 for (OsmPrimitive osm : selection) … … 166 166 segmentSet.addAll(((Way)osm).segments); 167 167 } else if (numberOfSelectedWays == 1) { 168 answer = JOptionPane.showConfirmDialog(Main.parent, ,"Add segments to way?", JOptionPane.YES_NO_OPTION);168 answer = JOptionPane.showConfirmDialog(Main.parent,tr("Do you want to add all other selected segments to the one selected way?"),tr("Add segments to way?"), JOptionPane.YES_NO_OPTION); 169 169 if (answer == JOptionPane.YES_OPTION) { 170 170 for (OsmPrimitive osm : selection) { 171 171 if (osm instanceof Way) { 172 172 wayToAdd = (Way)osm; 173 answer = JOptionPane.showConfirmDialog(Main.parent, ,"Reorder?", JOptionPane.YES_NO_CANCEL_OPTION);173 answer = JOptionPane.showConfirmDialog(Main.parent,tr("Reorder all line segments?"), tr("Reorder?"), JOptionPane.YES_NO_CANCEL_OPTION); 174 174 if (answer == JOptionPane.CANCEL_OPTION) 175 175 return wayToAdd; … … 230 230 } 231 231 232 if (JOptionPane.YES_OPTION != JOptionPane.showConfirmDialog(Main.parent, "+sortedSegments.size()+" segments?","Create new way", JOptionPane.YES_NO_OPTION))232 if (JOptionPane.YES_OPTION != JOptionPane.showConfirmDialog(Main.parent,trn("Create a new way out of {0} segment?","Create a new way out of {0} segments?",sortedSegments.size(),sortedSegments.size()), tr("Create new way"), JOptionPane.YES_NO_OPTION)) 233 233 return null; 234 234 -
src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java
r101 r104 1 1 package org.openstreetmap.josm.actions.mapmode; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.event.ActionEvent; … … 51 53 */ 52 54 public DeleteAction(MapFrame mapFrame) { 53 super( "Delete",55 super(tr("Delete"), 54 56 "delete", 55 "Delete nodes, streets or segments.", 57 tr("Delete nodes, streets or segments."), 56 58 "D", 57 59 KeyEvent.VK_D, … … 146 148 String reason = deleteNodeAndJoinSegment((Node)osm); 147 149 if (reason != null && msgBox) { 148 JOptionPane.showMessageDialog(Main.parent, 150 JOptionPane.showMessageDialog(Main.parent,tr("Cannot delete node.")+" "+reason); 149 151 return; 150 152 } 151 153 } else if (msgBox) { 152 JOptionPane.showMessageDialog(Main.parent, "This object is in use."); 154 JOptionPane.showMessageDialog(Main.parent, tr("This object is in use.")); 153 155 return; 154 156 } … … 167 169 if (!s.deleted && (s.from == n || s.to == n)) { 168 170 if (segs.size() > 1) 169 return "Used by more than two segments."; 171 return tr("Used by more than two segments."); 170 172 segs.add(s); 171 173 } 172 174 } 173 175 if (segs.size() != 2) 174 return "Used by only one segment."; 176 return tr("Used by only one segment."); 175 177 Segment seg1 = segs.get(0); 176 178 Segment seg2 = segs.get(1); … … 182 184 for (Way w : Main.ds.ways) 183 185 if (!w.deleted && (w.segments.contains(seg1) || w.segments.contains(seg2))) 184 return "Used in a way."; 186 return tr("Used in a way."); 185 187 if (seg1.from == seg2.from || seg1.to == seg2.to) 186 return "Wrong direction of segments."; 188 return tr("Wrong direction of segments."); 187 189 for (Entry<String, String> e : seg1.entrySet()) 188 190 if (seg2.keySet().contains(e.getKey()) && !seg2.get(e.getKey()).equals(e.getValue())) 189 return "Conflicting keys"; 191 return tr("Conflicting keys"); 190 192 Segment s = new Segment(seg1); 191 193 s.to = seg2.to; … … 197 199 new ChangeCommand(seg1, s), 198 200 new DeleteCommand(Arrays.asList(new OsmPrimitive[]{n, seg2}))}; 199 Main.main.editLayer().add(new SequenceCommand("Delete Node", Arrays.asList(cmds))); 201 Main.main.editLayer().add(new SequenceCommand(tr("Delete Node"), Arrays.asList(cmds))); 200 202 return null; 201 203 } -
src/org/openstreetmap/josm/actions/mapmode/MapMode.java
r101 r104 23 23 */ 24 24 abstract public class MapMode extends JosmAction implements MouseListener, MouseMotionListener { 25 26 25 // private final Cursor cursor; 27 26 // private Cursor oldCursor; -
src/org/openstreetmap/josm/actions/mapmode/MoveAction.java
r101 r104 1 1 package org.openstreetmap.josm.actions.mapmode; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.Cursor; … … 18 20 import org.openstreetmap.josm.gui.MapFrame; 19 21 import org.openstreetmap.josm.tools.ImageProvider; 20 21 22 /** 22 23 * Move is an action that can move all kind of OsmPrimitives (except Keys for now). … … 29 30 */ 30 31 public class MoveAction extends MapMode { 31 32 32 /** 33 33 * The old cursor before the user pressed the mouse button. … … 49 49 */ 50 50 public MoveAction(MapFrame mapFrame) { 51 super( "Move",51 super(tr("Move"), 52 52 "move", 53 "Move selected objects around.", 53 tr("Move selected objects around."), 54 54 "M", 55 55 KeyEvent.VK_M, … … 97 97 for (OsmPrimitive osm : affectedNodes) { 98 98 if (osm instanceof Node && ((Node)osm).coor.isOutSideWorld()) { 99 JOptionPane.showMessageDialog(Main.parent, 99 JOptionPane.showMessageDialog(Main.parent,tr("Cannot move objects outside of the world.")); 100 100 return; 101 101 } -
src/org/openstreetmap/josm/actions/mapmode/SelectionAction.java
r101 r104 1 1 package org.openstreetmap.josm.actions.mapmode; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.Rectangle; 4 6 import java.awt.event.KeyEvent; 7 import java.awt.event.MouseEvent; 5 8 import java.util.Collection; 9 import java.util.HashMap; 10 import java.util.HashSet; 6 11 import java.util.LinkedList; 12 import java.util.Map; 7 13 8 14 import org.openstreetmap.josm.Main; 15 import org.openstreetmap.josm.actions.GroupAction; 16 import org.openstreetmap.josm.data.osm.Node; 9 17 import org.openstreetmap.josm.data.osm.OsmPrimitive; 18 import org.openstreetmap.josm.data.osm.Segment; 10 19 import org.openstreetmap.josm.gui.MapFrame; 11 20 import org.openstreetmap.josm.gui.SelectionManager; … … 55 64 public class SelectionAction extends MapMode implements SelectionEnded { 56 65 66 enum Mode {select, straight} 67 private final Mode mode; 68 69 public static class Group extends GroupAction { 70 public Group(MapFrame mf) { 71 super(KeyEvent.VK_S,0); 72 actions.add(new SelectionAction(mf, tr("Selection"), Mode.select, tr("Select objects by dragging or clicking."))); 73 actions.add(new SelectionAction(mf, tr("Straight line"), Mode.straight, tr("Select objects in a straight line."))); 74 setCurrent(0); 75 } 76 } 77 78 57 79 /** 58 80 * The SelectionManager that manages the selection rectangle. 59 81 */ 60 82 private SelectionManager selectionManager; 83 84 private Node straightStart = null; 85 private Node lastEnd = null; 86 private Collection<OsmPrimitive> oldSelection = null; 87 88 //TODO: Implement reverse references into data objects and remove this 89 private final Map<Node, Collection<Segment>> reverseSegmentMap = new HashMap<Node, Collection<Segment>>(); 61 90 62 91 /** … … 64 93 * @param mapFrame The frame this action belongs to 65 94 */ 66 public SelectionAction(MapFrame mapFrame) { 67 super("Selection", 68 "selection", 69 "Select objects by dragging or clicking.", 70 "S", 71 KeyEvent.VK_S, 72 mapFrame, 73 ImageProvider.getCursor("normal", "selection")); 95 public SelectionAction(MapFrame mapFrame, String name, Mode mode, String desc) { 96 super(name, "selection/"+mode, desc, "S", KeyEvent.VK_S, mapFrame, ImageProvider.getCursor("normal", "selection")); 97 this.mode = mode; 74 98 this.selectionManager = new SelectionManager(this, false, mapFrame.mapView); 75 99 } … … 77 101 @Override public void enterMode() { 78 102 super.enterMode(); 79 selectionManager.register(Main.map.mapView); 103 if (mode == Mode.select) 104 selectionManager.register(Main.map.mapView); 105 else { 106 Main.map.mapView.addMouseMotionListener(this); 107 Main.map.mapView.addMouseListener(this); 108 for (Segment s : Main.ds.segments) { 109 addBackReference(s.from, s); 110 addBackReference(s.to, s); 111 } 112 } 113 } 114 115 private void addBackReference(Node n, Segment s) { 116 Collection<Segment> c = reverseSegmentMap.get(n); 117 if (c == null) { 118 c = new HashSet<Segment>(); 119 reverseSegmentMap.put(n, c); 120 } 121 c.add(s); 80 122 } 81 123 82 124 @Override public void exitMode() { 83 125 super.exitMode(); 84 selectionManager.unregister(Main.map.mapView); 126 if (mode == Mode.select) 127 selectionManager.unregister(Main.map.mapView); 128 else { 129 Main.map.mapView.removeMouseMotionListener(this); 130 Main.map.mapView.removeMouseListener(this); 131 reverseSegmentMap.clear(); 132 } 85 133 } 86 134 … … 108 156 Main.map.mapView.repaint(); 109 157 } 158 159 @Override public void mouseDragged(MouseEvent e) { 160 Node old = lastEnd; 161 lastEnd = Main.map.mapView.getNearestNode(e.getPoint()); 162 if (straightStart == null) 163 straightStart = lastEnd; 164 if (straightStart != null && lastEnd != null && straightStart != lastEnd && old != lastEnd) { 165 Collection<OsmPrimitive> path = new HashSet<OsmPrimitive>(); 166 Collection<OsmPrimitive> sel = new HashSet<OsmPrimitive>(); 167 path.add(straightStart); 168 calculateShortestPath(path, straightStart, lastEnd); 169 if ((e.getModifiers() & MouseEvent.CTRL_MASK) != 0) { 170 sel.addAll(oldSelection); 171 sel.removeAll(path); 172 } else if ((e.getModifiers() & MouseEvent.SHIFT_MASK) != 0) { 173 sel = path; 174 sel.addAll(oldSelection); 175 } else 176 sel = path; 177 Main.ds.setSelected(sel); 178 } 179 } 180 181 @Override public void mousePressed(MouseEvent e) { 182 straightStart = Main.map.mapView.getNearestNode(e.getPoint()); 183 lastEnd = null; 184 oldSelection = Main.ds.getSelected(); 185 } 186 187 @Override public void mouseReleased(MouseEvent e) { 188 straightStart = null; 189 lastEnd = null; 190 oldSelection = null; 191 } 192 193 /** 194 * Get the shortest path by stepping through the node with a common segment with start 195 * and nearest to the end (greedy algorithm). 196 */ 197 private void calculateShortestPath(Collection<OsmPrimitive> path, Node start, Node end) { 198 for (Node pivot = start; pivot != null;) 199 pivot = addNearest(path, pivot, end); 200 } 201 202 private Node addNearest(Collection<OsmPrimitive> path, Node start, Node end) { 203 Collection<Segment> c = reverseSegmentMap.get(start); 204 double min = Double.MAX_VALUE; 205 Node next = null; 206 Segment seg = null; 207 for (Segment s : c) { 208 Node other = s.from == start ? s.to : s.from; 209 if (other == end) { 210 next = other; 211 seg = s; 212 min = 0; 213 break; 214 } 215 double distance = other.eastNorth.distance(end.eastNorth); 216 if (distance < min) { 217 min = distance; 218 next = other; 219 seg = s; 220 } 221 } 222 if (min < start.eastNorth.distance(end.eastNorth) && next != null) { 223 path.add(next); 224 path.add(seg); 225 return next; 226 } 227 return null; 228 } 110 229 } -
src/org/openstreetmap/josm/actions/mapmode/ZoomAction.java
r101 r104 1 1 package org.openstreetmap.josm.actions.mapmode; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.Rectangle; … … 42 44 */ 43 45 public ZoomAction(MapFrame mapFrame) { 44 super( "Zoom", "zoom", "Zoom in by dragging. (Ctrl+up,left,down,right,+,-)", "Z", KeyEvent.VK_Z, mapFrame, ImageProvider.getCursor("normal", "zoom"));46 super(tr("Zoom"), "zoom", tr("Zoom in by dragging. (Ctrl+up,left,down,right,+,-)"), "Z", KeyEvent.VK_Z, mapFrame, ImageProvider.getCursor("normal", "zoom")); 45 47 mv = mapFrame.mapView; 46 48 selectionManager = new SelectionManager(this, true, mv); -
src/org/openstreetmap/josm/command/AddCommand.java
r94 r104 1 1 package org.openstreetmap.josm.command; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.util.Collection; … … 48 50 NameVisitor v = new NameVisitor(); 49 51 osm.visit(v); 50 return new DefaultMutableTreeNode(new JLabel( "Add"+v.className+" "+v.name, v.icon, JLabel.HORIZONTAL));52 return new DefaultMutableTreeNode(new JLabel(tr("Add")+" "+v.className+" "+v.name, v.icon, JLabel.HORIZONTAL)); 51 53 } 52 54 } -
src/org/openstreetmap/josm/command/ChangeCommand.java
r94 r104 1 1 package org.openstreetmap.josm.command; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.util.Collection; … … 33 35 NameVisitor v = new NameVisitor(); 34 36 osm.visit(v); 35 return new DefaultMutableTreeNode(new JLabel( "Change"+v.className+" "+v.name, v.icon, JLabel.HORIZONTAL));37 return new DefaultMutableTreeNode(new JLabel(tr("Change")+" "+v.className+" "+v.name, v.icon, JLabel.HORIZONTAL)); 36 38 } 37 39 } -
src/org/openstreetmap/josm/command/ChangePropertyCommand.java
r94 r104 1 1 package org.openstreetmap.josm.command; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 4 import static org.openstreetmap.josm.tools.I18n.trn; 2 5 3 6 import java.util.Collection; … … 20 23 */ 21 24 public class ChangePropertyCommand extends Command { 22 23 25 /** 24 26 * All primitives, that are affected with this command. … … 62 64 63 65 @Override public MutableTreeNode description() { 64 String text = value == null ? "Remove '"+key+"'" : "Set '"+key+"="+value+"'"; 65 text += " for "; 66 String text = value == null ? tr( "Remove '{0}' for",key) : tr("Set {0}={1} for",key,value); 66 67 if (objects.size() == 1) { 67 68 NameVisitor v = new NameVisitor(); … … 69 70 text += v.className+" "+v.name; 70 71 } else 71 text += objects.size() +"objects";72 text += trn("{0} object","{0} objects",objects.size(),objects.size()); 72 73 DefaultMutableTreeNode root = new DefaultMutableTreeNode(new JLabel(text, ImageProvider.get("data", "key"), JLabel.HORIZONTAL)); 73 74 if (objects.size() == 1) -
src/org/openstreetmap/josm/command/ConflictResolveCommand.java
r98 r104 1 1 package org.openstreetmap.josm.command; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.util.Collection; … … 73 75 if (c.resolution != null) 74 76 i++; 75 return new DefaultMutableTreeNode(new JLabel("Resolve "+i+"conflicts in"+resolved.size()+" objects", ImageProvider.get("data", "primitive"), JLabel.HORIZONTAL));77 return new DefaultMutableTreeNode(new JLabel(tr("Resolve {0} conflicts in {1} objects",i,resolved.size()), ImageProvider.get("data", "primitive"), JLabel.HORIZONTAL)); 76 78 } 77 79 } -
src/org/openstreetmap/josm/command/DeleteCommand.java
r94 r104 1 1 package org.openstreetmap.josm.command; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 4 import static org.openstreetmap.josm.tools.I18n.trn; 2 5 3 6 import java.util.Collection; … … 41 44 if (data.size() == 1) { 42 45 data.iterator().next().visit(v); 43 return new DefaultMutableTreeNode(new JLabel( "Delete"+v.className+" "+v.name, v.icon, JLabel.HORIZONTAL));46 return new DefaultMutableTreeNode(new JLabel(tr("Delete"+" "+v.className+" "+v.name), v.icon, JLabel.HORIZONTAL)); 44 47 } 45 48 … … 52 55 cname = "primitive"; 53 56 } 54 DefaultMutableTreeNode root = new DefaultMutableTreeNode(new JLabel("Delete "+data.size()+" "+cname+(data.size()==1?"":"s"), ImageProvider.get("data", cname), JLabel.HORIZONTAL)); 57 DefaultMutableTreeNode root = new DefaultMutableTreeNode(new JLabel( 58 tr("Delete")+" "+data.size()+" "+trn(cname, cname+"s", data.size()), ImageProvider.get("data", cname), JLabel.HORIZONTAL)); 55 59 for (OsmPrimitive osm : data) { 56 60 osm.visit(v); -
src/org/openstreetmap/josm/command/MoveCommand.java
r94 r104 1 1 package org.openstreetmap.josm.command; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 4 import static org.openstreetmap.josm.tools.I18n.trn; 2 5 3 6 import java.util.Collection; … … 25 28 */ 26 29 public class MoveCommand extends Command { 27 28 30 /** 29 31 * The objects that should be moved. … … 113 115 114 116 @Override public MutableTreeNode description() { 115 return new DefaultMutableTreeNode(new JLabel( "Move"+objects.size()+"Node"+(objects.size()==1?"":"s"), ImageProvider.get("data", "node"), JLabel.HORIZONTAL));117 return new DefaultMutableTreeNode(new JLabel(tr("Move")+" "+objects.size()+" "+trn("node","nodes",objects.size()), ImageProvider.get("data", "node"), JLabel.HORIZONTAL)); 116 118 } 117 119 } -
src/org/openstreetmap/josm/command/SequenceCommand.java
r100 r104 1 1 package org.openstreetmap.josm.command; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.util.Collection; … … 47 49 48 50 @Override public MutableTreeNode description() { 49 DefaultMutableTreeNode root = new DefaultMutableTreeNode("Sequence: "+name); 51 DefaultMutableTreeNode root = new DefaultMutableTreeNode(tr("Sequence")+": "+name); 50 52 for (Command c : sequence) 51 53 root.add(c.description()); -
src/org/openstreetmap/josm/data/conflict/ConflictItem.java
r86 r104 1 1 package org.openstreetmap.josm.data.conflict; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.util.Collection; … … 29 31 value = v; 30 32 else if (!value.equals(v)) { 31 value = "<html><i><different></i></html>"; 33 value = "<html><i><"+tr("different")+"></i></html>"; 32 34 break; 33 35 } -
src/org/openstreetmap/josm/data/conflict/DeleteConflict.java
r86 r104 1 1 package org.openstreetmap.josm.data.conflict; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 10 12 11 13 @Override public String key() { 12 return "deleted| deleted";14 return "deleted|"+tr("deleted"); 13 15 } 14 16 15 17 @Override protected String str(OsmPrimitive osm) { 16 return osm.deleted ? "true" :"false";18 return osm.deleted ? tr("true") : tr("false"); 17 19 } 18 20 -
src/org/openstreetmap/josm/data/conflict/FromConflict.java
r86 r104 1 1 package org.openstreetmap.josm.data.conflict; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 15 17 16 18 @Override public String key() { 17 return "segment| from";19 return "segment|"+tr("from"); 18 20 } 19 21 -
src/org/openstreetmap/josm/data/conflict/PositionConflict.java
r86 r104 1 1 package org.openstreetmap.josm.data.conflict; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import org.openstreetmap.josm.data.osm.Node; … … 15 17 16 18 @Override public String key() { 17 return "node|position"; 19 return "node|"+tr("position"); 18 20 } 19 21 -
src/org/openstreetmap/josm/data/conflict/SegmentConflict.java
r86 r104 1 1 package org.openstreetmap.josm.data.conflict; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 17 19 for (Segment ls : ((Way)osm).segments) 18 20 s += ls.id + ","; 19 return s.equals("") ? "<html><i>< none></i></html>" : s.substring(0, s.length()-1);21 return s.equals("") ? "<html><i><"+tr("none")+"></i></html>" : s.substring(0, s.length()-1); 20 22 } 21 23 22 24 @Override public String key() { 23 return "way|segments"; 25 return "way|"+tr("segments"); 24 26 } 25 27 -
src/org/openstreetmap/josm/data/conflict/ToConflict.java
r86 r104 1 /**2 *3 */4 1 package org.openstreetmap.josm.data.conflict; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 5 4 6 5 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 18 17 19 18 @Override public String key() { 20 return "segment| to";19 return "segment|"+tr("to"); 21 20 } 22 21 -
src/org/openstreetmap/josm/data/osm/Way.java
r100 r104 50 50 return o instanceof Way ? Long.valueOf(id).compareTo(o.id) : -1; 51 51 } 52 53 public boolean isIncomplete() { 54 for (Segment s : segments) 55 if (s.incomplete) 56 return true; 57 return false; 58 } 52 59 } -
src/org/openstreetmap/josm/data/osm/visitor/NameVisitor.java
r100 r104 1 1 2 2 package org.openstreetmap.josm.data.osm.visitor; 3 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 import static org.openstreetmap.josm.tools.I18n.trn; 3 6 4 7 import java.util.HashSet; … … 8 11 import javax.swing.JLabel; 9 12 13 import org.openstreetmap.josm.data.osm.Node; 10 14 import org.openstreetmap.josm.data.osm.Segment; 11 import org.openstreetmap.josm.data.osm.Node;12 15 import org.openstreetmap.josm.data.osm.Way; 13 16 import org.openstreetmap.josm.tools.ImageProvider; … … 43 46 if (name == null) { 44 47 if (ls.incomplete) 45 name = ls.id == 0 ? "new" : ""+ls.id+"(unknown)";48 name = ls.id == 0 ? tr("new") : tr("{0} (unknown)", ls.id); 46 49 else 47 50 name = (ls.id==0?"":ls.id+" ")+"("+ls.from.coor.lat()+","+ls.from.coor.lon()+") -> ("+ls.to.coor.lat()+","+ls.to.coor.lon()+")"; … … 80 83 incomplete = true; 81 84 } 82 name = nodes.size() +" nodes";85 name = trn("{0} node", "{0} nodes", nodes.size(), nodes.size()); 83 86 if (incomplete) 84 name += " (incomplete)"; 87 name += " ("+tr("incomplete")+")"; 85 88 } 86 89 icon = ImageProvider.get("data", "way"); -
src/org/openstreetmap/josm/gui/BookmarkList.java
r98 r104 1 1 package org.openstreetmap.josm.gui; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.Component; … … 86 88 in.close(); 87 89 } catch (IOException e) { 88 JOptionPane.showMessageDialog(Main.parent, "Could not read bookmarks.\n"+e.getMessage()); 90 JOptionPane.showMessageDialog(Main.parent, tr("Could not read bookmarks.")+"\n"+e.getMessage()); 89 91 } 90 92 } … … 110 112 out.close(); 111 113 } catch (IOException e) { 112 JOptionPane.showMessageDialog(Main.parent, 114 JOptionPane.showMessageDialog(Main.parent,tr("Could not write bookmark.")+"\n"+e.getMessage()); 113 115 } 114 116 } -
src/org/openstreetmap/josm/gui/ConflictResolver.java
r102 r104 1 1 package org.openstreetmap.josm.gui; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 4 import static org.openstreetmap.josm.tools.I18n.trn; 2 5 3 6 import java.awt.Component; … … 76 79 } 77 80 78 public String getColumnName(int columnIndex) {return columnIndex == 0 ? "Key" :"Value";}81 public String getColumnName(int columnIndex) {return columnIndex == 0 ? tr("Key") : tr("Value");} 79 82 public int getColumnCount() {return 2;} 80 83 public boolean isCellEditable(int row, int column) {return false;} … … 158 161 159 162 if (this.conflicts.isEmpty()) 160 throw new RuntimeException("No conflicts but in conflict list:\n " +Arrays.toString(conflicts.entrySet().toArray()));163 throw new RuntimeException(tr("No conflicts but in conflict list:\n{0}" , Arrays.toString(conflicts.entrySet().toArray()))); 161 164 162 165 // have to initialize the JTables here and not in the declaration, because its constructor … … 227 230 resolveTable.addMouseListener(new DblClickListener(null)); 228 231 229 add(new JLabel(conflicts.size() +" object"+(conflicts.size()==1?" has":"s have")+" conflicts:"), GBC.eol().insets(0,0,0,10));232 add(new JLabel(trn("{0} object has conflicts:","{0} objects have conflicts:",conflicts.size(),conflicts.size())), GBC.eol().insets(0,0,0,10)); 230 233 231 234 JPanel p = new JPanel(new GridBagLayout()); 232 p.add(new JLabel("my version:"), GBC.eol()); 235 p.add(new JLabel(tr("my version:")), GBC.eol()); 233 236 p.add(new JScrollPane(myTable), GBC.eol().fill(GBC.BOTH)); 234 237 p.add(new JButton(new ResolveAction("down", Resolution.MY)), GBC.eol().anchor(GBC.CENTER).insets(0,5,0,0)); … … 236 239 237 240 p = new JPanel(new GridBagLayout()); 238 p.add(new JLabel("their version:"), GBC.eol()); 241 p.add(new JLabel(tr("their version:")), GBC.eol()); 239 242 p.add(new JScrollPane(theirTable), GBC.eol().fill(GBC.BOTH)); 240 243 p.add(new JButton(new ResolveAction("down", Resolution.THEIR)), GBC.eol().anchor(GBC.CENTER).insets(0,5,0,0)); … … 242 245 243 246 add(new JButton(new ResolveAction("up", null)), GBC.eol().anchor(GBC.CENTER)); 244 add(new JLabel("resolved version:"), GBC.eol().insets(0,5,0,0)); 247 add(new JLabel(tr("resolved version:")), GBC.eol().insets(0,5,0,0)); 245 248 add(new JScrollPane(resolveTable), GBC.eol().anchor(GBC.CENTER).fill(GBC.BOTH)); 246 249 } -
src/org/openstreetmap/josm/gui/MainApplet.java
r98 r104 1 1 package org.openstreetmap.josm.gui; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.GridBagLayout; … … 30 32 31 33 private final static String[][] paramInfo = { 32 {"username", "string" ,"Name of the user."},33 {"password", "string" ,"OSM Password."},34 {"geometry", "string" ,"Size the applet to the given geometry (format: WIDTHxHEIGHT)"},35 {"download", "string;string;..." ,"Download each. Can be x1,y1,x2,y2 an url containing lat=y&lon=x&zoom=z or a filename"},36 {"downloadgps", "string;string;..." ,"Download each as raw gps. Can be x1,y1,x2,y2 an url containing lat=y&lon=x&zoom=z or a filename"},37 {"selection", "string;string;..." ,"Add each to the initial selection. Can be a google-like search string or an url which returns osm-xml"},38 {"reset-preferences", "any","If specified, reset the configuration instead of reading it."}34 {"username", tr("string"), tr("Name of the user.")}, 35 {"password", tr("string"), tr("OSM Password.")}, 36 {"geometry", tr("string"), tr("Size the applet to the given geometry (format: WIDTHxHEIGHT)")}, 37 {"download", tr("string;string;..."), tr("Download each. Can be x1,y1,x2,y2 an url containing lat=y&lon=x&zoom=z or a filename")}, 38 {"downloadgps", tr("string;string;..."), tr("Download each as raw gps. Can be x1,y1,x2,y2 an url containing lat=y&lon=x&zoom=z or a filename")}, 39 {"selection", tr("string;string;..."), tr("Add each to the initial selection. Can be a google-like search string or an url which returns osm-xml")}, 40 {"reset-preferences", tr("any"),tr("If specified, reset the configuration instead of reading it.")} 39 41 }; 40 42 … … 61 63 if (username == null || password == null) { 62 64 JPanel p = new JPanel(new GridBagLayout()); 63 p.add(new JLabel("Username"), GBC.std().insets(0,0,20,0)); 65 p.add(new JLabel(tr("Username")), GBC.std().insets(0,0,20,0)); 64 66 JTextField user = new JTextField(username == null ? "" : username); 65 67 p.add(user, GBC.eol().fill(GBC.HORIZONTAL)); 66 p.add(new JLabel("Password"), GBC.std().insets(0,0,20,0)); 68 p.add(new JLabel(tr("Password")), GBC.std().insets(0,0,20,0)); 67 69 JPasswordField pass = new JPasswordField(password == null ? "" : password); 68 70 p.add(pass, GBC.eol().fill(GBC.HORIZONTAL)); -
src/org/openstreetmap/josm/gui/MainApplication.java
r98 r104 1 1 //Licence: GPL 2 2 package org.openstreetmap.josm.gui; 3 4 import static org.openstreetmap.josm.tools.I18n.tr; 3 5 4 6 import java.awt.Toolkit; … … 20 22 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 21 23 import org.openstreetmap.josm.tools.BugReportExceptionHandler; 22 23 24 /** 24 25 * Main window class application. … … 27 28 */ 28 29 public class MainApplication extends Main { 29 30 30 /** 31 31 * Construct an main frame, ready sized and operating. Does not … … 49 49 } 50 50 if (modified) { 51 final String msg = uploadedModified ? "\nHint: Some changes came from uploading new data to the server." : ""; 51 final String msg = uploadedModified ? tr("\nHint: Some changes came from uploading new data to the server.") : ""; 52 52 final int answer = JOptionPane.showConfirmDialog( 53 Main.parent, "There are unsaved changes. Really quit?"+msg, 54 "Unsaved Changes", JOptionPane.YES_NO_OPTION); 53 Main.parent, tr("There are unsaved changes. Really quit?")+msg, 54 tr("Unsaved Changes"), JOptionPane.YES_NO_OPTION); 55 55 if (answer != JOptionPane.YES_OPTION) 56 56 return; … … 72 72 List<String> argList = Arrays.asList(argArray); 73 73 if (argList.contains("--help") || argList.contains("-?") || argList.contains("-h")) { 74 System.out.println("Java OpenStreetMap Editor"); 75 System.out.println(); 76 System.out.println("usage:"); 77 System.out.println("\tjava -jar josm.jar <option> <option> <option>..."); 78 System.out.println(); 79 System.out.println("options:"); 80 System.out.println("\t--help|-?|-h Show this help"); 81 System.out.println("\t--geometry=widthxheight(+|-)x(+|-)y Standard unix geometry argument"); 82 System.out.println("\t[--download=]minlat,minlon,maxlat,maxlon Download the bounding box"); 83 System.out.println("\t[--download=]<url> Download the location at the url (with lat=x&lon=y&zoom=z)"); 84 System.out.println("\t[--download=]<filename> Open file (as raw gps, if .gpx or .csv)"); 85 System.out.println("\t--downloadgps=minlat,minlon,maxlat,maxlon Download the bounding box as raw gps"); 86 System.out.println("\t--selection=<searchstring> Select with the given search"); 87 System.out.println("\t--no-fullscreen Don't launch in fullscreen mode"); 88 System.out.println("\t--reset-preferences Reset the preferences to default"); 89 System.out.println(); 90 System.out.println("examples:"); 91 System.out.println("\tjava -jar josm.jar track1.gpx track2.gpx london.osm"); 92 System.out.println("\tjava -jar josm.jar http://www.openstreetmap.org/index.html?lat=43.2&lon=11.1&zoom=13"); 93 System.out.println("\tjava -jar josm.jar london.osm --selection=http://www.ostertag.name/osm/OSM_errors_node-duplicate.xml"); 94 System.out.println("\tjava -jar josm.jar 43.2,11.1,43.4,11.4"); 95 System.out.println(); 96 System.out.println("Parameters are read in the order they are specified, so make sure you load"); 97 System.out.println("some data before --selection"); 98 System.out.println(); 99 System.out.println("Instead of --download=<bbox> you may specify osm://<bbox>"); 74 System.out.println(tr("Java OpenStreetMap Editor\n\n"+ 75 "usage:\n"+ 76 "\tjava -jar josm.jar <option> <option> <option>...\n\n"+ 77 "options:\n"+ 78 "\t--help|-?|-h Show this help\n"+ 79 "\t--geometry=widthxheight(+|-)x(+|-)y Standard unix geometry argument\n"+ 80 "\t[--download=]minlat,minlon,maxlat,maxlon Download the bounding box\n"+ 81 "\t[--download=]<url> Download the location at the url (with lat=x&lon=y&zoom=z)\n"+ 82 "\t[--download=]<filename> Open file (as raw gps, if .gpx or .csv)\n"+ 83 "\t--downloadgps=minlat,minlon,maxlat,maxlon Download the bounding box as raw gps\n"+ 84 "\t--selection=<searchstring> Select with the given search\n"+ 85 "\t--no-fullscreen Don't launch in fullscreen mode\n"+ 86 "\t--reset-preferences Reset the preferences to default\n\n"+ 87 "examples:\n"+ 88 "\tjava -jar josm.jar track1.gpx track2.gpx london.osm\n"+ 89 "\tjava -jar josm.jar http://www.openstreetmap.org/index.html?lat=43.2&lon=11.1&zoom=13\n"+ 90 "\tjava -jar josm.jar london.osm --selection=http://www.ostertag.name/osm/OSM_errors_node-duplicate.xml\n"+ 91 "\tjava -jar josm.jar 43.2,11.1,43.4,11.4\n\n"+ 92 93 "Parameters are read in the order they are specified, so make sure you load\n"+ 94 "some data before --selection\n\n"+ 95 "Instead of --download=<bbox> you may specify osm://<bbox>\n")); 100 96 System.exit(0); 101 97 } … … 103 99 final File prefDir = new File(Main.pref.getPreferencesDir()); 104 100 if (prefDir.exists() && !prefDir.isDirectory()) { 105 JOptionPane.showMessageDialog(null, "Cannot open preferences directory: "+Main.pref.getPreferencesDir());101 JOptionPane.showMessageDialog(null, tr("Cannot open preferences directory: {0}",Main.pref.getPreferencesDir())); 106 102 return; 107 103 } … … 125 121 126 122 preConstructorInit(args); 127 JFrame mainFrame = new JFrame("Java Open Street Map - Editor"); 123 JFrame mainFrame = new JFrame(tr("Java Open Street Map - Editor")); 128 124 Main.parent = mainFrame; 129 125 Main main = new MainApplication(mainFrame); -
src/org/openstreetmap/josm/gui/MapFrame.java
r103 r104 78 78 toolBarActions.setFloatable(false); 79 79 toolBarActions.add(new IconToggleButton(new ZoomAction(this))); 80 final SelectionAction selectionAction = new SelectionAction(this);80 final Action selectionAction = new SelectionAction.Group(this); 81 81 toolBarActions.add(new IconToggleButton(selectionAction)); 82 82 toolBarActions.add(new IconToggleButton(new MoveAction(this))); -
src/org/openstreetmap/josm/gui/MapStatus.java
r103 r104 1 1 package org.openstreetmap.josm.gui; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.AWTEvent; … … 203 205 } 204 206 public void mouseMoved(MouseEvent e) { 207 if (mv.center == null) 208 return; 205 209 // Do not update the view, if ctrl is pressed. 206 210 if ((e.getModifiersEx() & MouseEvent.CTRL_DOWN_MASK) == 0) { … … 215 219 setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); 216 220 setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); 217 add(new JLabel("Lat/Lon ")); 221 add(new JLabel(tr("Lat/Lon "))); 218 222 add(positionText); 219 add(new JLabel(" Object ")); 223 add(new JLabel(tr(" Object "))); 220 224 add(nameText); 221 225 -
src/org/openstreetmap/josm/gui/MapView.java
r103 r104 1 1 package org.openstreetmap.josm.gui; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.Color; … … 155 157 dataLayer.listenerModified.add(new ModifiedChangedListener(){ 156 158 public void modifiedChanged(boolean value, OsmDataLayer source) { 157 JOptionPane.getFrameForComponent(Main.parent).setTitle( (value?"*":"")+"Java Open Street Map - Editor");159 JOptionPane.getFrameForComponent(Main.parent).setTitle(tr("{0}Java Open Street Map - Editor",(value?"*":""))); 158 160 } 159 161 }); … … 193 195 int curLayerPos = layers.indexOf(layer); 194 196 if (curLayerPos == -1) 195 throw new IllegalArgumentException("layer not in list."); 197 throw new IllegalArgumentException(tr("layer not in list.")); 196 198 if (pos == curLayerPos) 197 199 return; // already in place. … … 322 324 public void setActiveLayer(Layer layer) { 323 325 if (!layers.contains(layer)) 324 throw new IllegalArgumentException("layer must be in layerlist"); 326 throw new IllegalArgumentException(tr("layer must be in layerlist")); 325 327 Layer old = activeLayer; 326 328 activeLayer = layer; -
src/org/openstreetmap/josm/gui/NavigatableComponent.java
r99 r104 23 23 */ 24 24 public class NavigatableComponent extends JComponent { 25 25 26 26 27 public static final EastNorth world = Main.proj.latlon2eastNorth(new LatLon(Projection.MAX_LAT, Projection.MAX_LON)); -
src/org/openstreetmap/josm/gui/PleaseWaitRunnable.java
r103 r104 1 1 package org.openstreetmap.josm.gui; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.EventQueue; … … 30 32 */ 31 33 public abstract class PleaseWaitRunnable implements Runnable { 34 32 35 public final JDialog pleaseWaitDlg; 33 36 public String errorMessage; … … 36 39 private boolean closeDialogCalled = false; 37 40 38 protected final JLabel currentAction = new JLabel("Contact OSM server..."); 41 protected final JLabel currentAction = new JLabel(tr("Contact OSM server...")); 39 42 protected final BoundedRangeModel progress = progressBar.getModel(); 40 43 … … 49 52 pane.add(currentAction, GBC.eol().fill(GBC.HORIZONTAL)); 50 53 pane.add(progressBar, GBC.eop().fill(GBC.HORIZONTAL)); 51 JButton cancel = new JButton( "Cancel");54 JButton cancel = new JButton(tr(tr("Cancel"))); 52 55 pane.add(cancel, GBC.eol().anchor(GBC.CENTER)); 53 56 pleaseWaitDlg.setContentPane(pane); … … 75 78 } catch (SAXException x) { 76 79 x.printStackTrace(); 77 errorMessage = "Error while parsing: "+x.getMessage(); 80 errorMessage = tr("Error while parsing: ")+x.getMessage(); 78 81 } catch (FileNotFoundException x) { 79 82 x.printStackTrace(); 80 errorMessage = "Not found: " + x.getMessage(); 83 errorMessage = tr("Not found: ") + x.getMessage(); 81 84 } catch (IOException x) { 82 85 x.printStackTrace(); -
src/org/openstreetmap/josm/gui/PreferenceDialog.java
r100 r104 1 1 package org.openstreetmap.josm.gui; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.Color; … … 81 83 String name = (String)colors.getValueAt(i, 0); 82 84 Color col = (Color)colors.getValueAt(i, 1); 83 Main.pref.put("color."+ name, ColorHelper.color2html(col));85 Main.pref.put("color."+tr(name), ColorHelper.color2html(col)); 84 86 } 85 87 86 88 if (requiresRestart) 87 JOptionPane.showMessageDialog(PreferenceDialog.this, 89 JOptionPane.showMessageDialog(PreferenceDialog.this,tr("You have to restart JOSM for some settings to take effect.")); 88 90 Main.parent.repaint(); 89 91 setVisible(false); … … 150 152 * The checkbox stating whether nodes should be merged together. 151 153 */ 152 private JCheckBox drawRawGpsLines = new JCheckBox("Draw lines between raw gps points."); 154 private JCheckBox drawRawGpsLines = new JCheckBox(tr("Draw lines between raw gps points.")); 153 155 /** 154 156 * The checkbox stating whether raw gps lines should be forced. 155 157 */ 156 private JCheckBox forceRawGpsLines = new JCheckBox("Force lines if no segments imported."); 157 private JCheckBox directionHint = new JCheckBox("Draw Direction Arrows"); 158 private JCheckBox forceRawGpsLines = new JCheckBox(tr("Force lines if no segments imported.")); 159 private JCheckBox directionHint = new JCheckBox(tr("Draw Direction Arrows")); 158 160 private JTable colors; 159 161 … … 166 168 */ 167 169 public PreferenceDialog() { 168 super(JOptionPane.getFrameForComponent(Main.parent), "Preferences"); 170 super(JOptionPane.getFrameForComponent(Main.parent), tr("Preferences")); 169 171 170 172 // look and feel combo box … … 215 217 csvImportString.setText(Main.pref.get("csv.importstring")); 216 218 drawRawGpsLines.setSelected(Main.pref.getBoolean("draw.rawgps.lines")); 217 forceRawGpsLines.setToolTipText("Force drawing of lines if the imported data contain no line information."); 219 forceRawGpsLines.setToolTipText(tr("Force drawing of lines if the imported data contain no line information.")); 218 220 forceRawGpsLines.setSelected(Main.pref.getBoolean("draw.rawgps.lines.force")); 219 221 forceRawGpsLines.setEnabled(drawRawGpsLines.isSelected()); 220 directionHint.setToolTipText("Draw direction hints for all segments."); 222 directionHint.setToolTipText(tr("Draw direction hints for all segments.")); 221 223 directionHint.setSelected(Main.pref.getBoolean("draw.segment.direction")); 222 224 … … 255 257 colors.getColumnModel().getColumn(1).setWidth(100); 256 258 257 JButton colorEdit = new JButton( "Choose");259 JButton colorEdit = new JButton(tr("Choose")); 258 260 colorEdit.addActionListener(new ActionListener(){ 259 261 public void actionPerformed(ActionEvent e) { 260 262 if (colors.getSelectedRowCount() == 0) { 261 JOptionPane.showMessageDialog(PreferenceDialog.this, "Please select a color."); 263 JOptionPane.showMessageDialog(PreferenceDialog.this, tr("Please select a color.")); 262 264 return; 263 265 } 264 266 int sel = colors.getSelectedRow(); 265 267 JColorChooser chooser = new JColorChooser((Color)colors.getValueAt(sel, 1)); 266 int answer = JOptionPane.showConfirmDialog(PreferenceDialog.this, chooser, "Choose a color for "+colors.getValueAt(sel, 0), JOptionPane.OK_CANCEL_OPTION);268 int answer = JOptionPane.showConfirmDialog(PreferenceDialog.this, chooser, tr("Choose a color for {0}", colors.getValueAt(sel, 0)), JOptionPane.OK_CANCEL_OPTION); 267 269 if (answer == JOptionPane.OK_OPTION) 268 270 colors.setValueAt(chooser.getColor(), sel, 1); … … 271 273 272 274 // setting tooltips 273 osmDataServer.setToolTipText("The base URL to the OSM server (REST API)"); 274 osmDataUsername.setToolTipText("Login name (email) to the OSM account."); 275 osmDataPassword.setToolTipText("Login password to the OSM account. Leave blank to not store any password."); 276 wmsServerBaseUrl.setToolTipText("The base URL to the server retrieving WMS background pictures from."); 277 csvImportString.setToolTipText("<html>Import string specification. lat/lon and time are imported.<br>" + 275 osmDataServer.setToolTipText(tr("The base URL to the OSM server (REST API)")); 276 osmDataUsername.setToolTipText(tr("Login name (email) to the OSM account.")); 277 osmDataPassword.setToolTipText(tr("Login password to the OSM account. Leave blank to not store any password.")); 278 wmsServerBaseUrl.setToolTipText(tr("The base URL to the server retrieving WMS background pictures from.")); 279 csvImportString.setToolTipText(tr("<html>Import string specification. lat/lon and time are imported.<br>" + 278 280 "<b>lat</b>: The latitude coordinate<br>" + 279 281 "<b>lon</b>: The longitude coordinate<br>" + … … 281 283 "<b>ignore</b>: Skip this field<br>" + 282 284 "An example: \"ignore ignore lat lon\" will use ' ' as delimiter, skip the first two values and read then lat/lon.<br>" + 283 "Other example: \"lat,lon\" will just read lat/lon values comma seperated.</html>"); 284 drawRawGpsLines.setToolTipText("If your gps device draw to few lines, select this to draw lines along your way."); 285 colors.setToolTipText("Colors used by different objects in JOSM."); 285 "Other example: \"lat,lon\" will just read lat/lon values comma seperated.</html>")); 286 drawRawGpsLines.setToolTipText(tr("If your gps device draw to few lines, select this to draw lines along your way.")); 287 colors.setToolTipText(tr("Colors used by different objects in JOSM.")); 286 288 287 289 // creating the gui 288 290 289 291 // Display tab 290 JPanel display = createPreferenceTab("display", "Display Settings" ,"Various settings that influence the visual representation of the whole program.");291 display.add(new JLabel("Look and Feel"), GBC.std()); 292 JPanel display = createPreferenceTab("display", tr("Display Settings"), tr("Various settings that influence the visual representation of the whole program.")); 293 display.add(new JLabel(tr("Look and Feel")), GBC.std()); 292 294 display.add(GBC.glue(5,0), GBC.std().fill(GBC.HORIZONTAL)); 293 295 display.add(lafCombo, GBC.eol().fill(GBC.HORIZONTAL)); … … 295 297 display.add(forceRawGpsLines, GBC.eop().insets(40,0,0,0)); 296 298 display.add(directionHint, GBC.eop().insets(20,0,0,0)); 297 display.add(new JLabel( "Colors"), GBC.eol());299 display.add(new JLabel(tr("Colors")), GBC.eol()); 298 300 colors.setPreferredScrollableViewportSize(new Dimension(100,112)); 299 301 display.add(new JScrollPane(colors), GBC.eol().fill(GBC.BOTH)); … … 302 304 303 305 // Connection tab 304 JPanel con = createPreferenceTab("connection", "Connection Settings" ,"Connection Settings to the OSM server.");305 con.add(new JLabel("Base Server URL"), GBC.std()); 306 JPanel con = createPreferenceTab("connection", tr("Connection Settings"), tr("Connection Settings to the OSM server.")); 307 con.add(new JLabel(tr("Base Server URL")), GBC.std()); 306 308 con.add(osmDataServer, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5)); 307 con.add(new JLabel("OSM username (email)"), GBC.std()); 309 con.add(new JLabel(tr("OSM username (email)")), GBC.std()); 308 310 con.add(osmDataUsername, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5)); 309 con.add(new JLabel("OSM password"), GBC.std()); 311 con.add(new JLabel(tr("OSM password")), GBC.std()); 310 312 con.add(osmDataPassword, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,0)); 311 JLabel warning = new JLabel("<html>" + 313 JLabel warning = new JLabel(tr("<html>" + 312 314 "WARNING: The password is stored in plain text in the preferences file.<br>" + 313 315 "The password is transfered in plain text to the server, encoded in the url.<br>" + 314 "<b>Do not use a valuable Password.</b></html>"); 316 "<b>Do not use a valuable Password.</b></html>")); 315 317 warning.setFont(warning.getFont().deriveFont(Font.ITALIC)); 316 318 con.add(warning, GBC.eop().fill(GBC.HORIZONTAL)); … … 318 320 //con.add(wmsServerBaseUrl, GBC.eop().fill(GBC.HORIZONTAL)); 319 321 //con.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.VERTICAL)); 320 con.add(new JLabel("CSV import specification (empty: read from first line in data)"), GBC.eol()); 322 con.add(new JLabel(tr("CSV import specification (empty: read from first line in data)")), GBC.eol()); 321 323 con.add(csvImportString, GBC.eop().fill(GBC.HORIZONTAL)); 322 324 con.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.VERTICAL)); 323 325 324 326 // Map tab 325 JPanel map = createPreferenceTab("map", "Map Settings" ,"Settings for the map projection and data interpretation.");326 map.add(new JLabel("Projection method"), GBC.std()); 327 JPanel map = createPreferenceTab("map", tr("Map Settings"), tr("Settings for the map projection and data interpretation.")); 328 map.add(new JLabel(tr("Projection method")), GBC.std()); 327 329 map.add(GBC.glue(5,0), GBC.std().fill(GBC.HORIZONTAL)); 328 330 map.add(projectionCombo, GBC.eol().fill(GBC.HORIZONTAL).insets(0,0,0,5)); -
src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java
r100 r104 1 1 package org.openstreetmap.josm.gui.dialogs; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.BorderLayout; … … 28 30 29 31 public CommandStackDialog(final MapFrame mapFrame) { 30 super("Command Stack", "commandstack", "Open a list of all commands (undo buffer).", KeyEvent.VK_C); 32 super(tr("Command Stack"), "commandstack", tr("Open a list of all commands (undo buffer)."), KeyEvent.VK_C); 31 33 setPreferredSize(new Dimension(320,100)); 32 34 mapFrame.mapView.addLayerChangeListener(new LayerChangeListener(){ -
src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java
r100 r104 1 1 package org.openstreetmap.josm.gui.dialogs; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.BorderLayout; … … 47 49 48 50 public ConflictDialog() { 49 super("Conflict", "conflict", "Merging conflicts.", KeyEvent.VK_C); 51 super(tr("Conflict"), "conflict", tr("Merging conflicts."), KeyEvent.VK_C); 50 52 displaylist.setCellRenderer(new OsmPrimitivRenderer()); 51 53 displaylist.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); … … 59 61 60 62 JPanel buttonPanel = new JPanel(new GridLayout(1,2)); 61 JButton button = new JButton("Resolve", ImageProvider.get("dialogs", "conflict")); 62 button.setToolTipText("Open a merge dialog of all selected items in the list above."); 63 JButton button = new JButton(tr("Resolve"), ImageProvider.get("dialogs", "conflict")); 64 button.setToolTipText(tr("Open a merge dialog of all selected items in the list above.")); 63 65 button.addActionListener(new ActionListener(){ 64 66 public void actionPerformed(ActionEvent e) { … … 68 70 buttonPanel.add(button); 69 71 70 button = new JButton( "Select", ImageProvider.get("mapmode", "selection"));71 button.setToolTipText("Set the selected elements on the map to the selected items in the list above."); 72 button = new JButton(tr("Select"), ImageProvider.get("mapmode/selection/select")); 73 button.setToolTipText(tr("Set the selected elements on the map to the selected items in the list above.")); 72 74 button.addActionListener(new ActionListener(){ 73 75 public void actionPerformed(ActionEvent e) { … … 102 104 private final void resolve() { 103 105 if (displaylist.getSelectedIndex() == -1) { 104 JOptionPane.showMessageDialog(Main.parent, 106 JOptionPane.showMessageDialog(Main.parent,tr("Please select something from the conflict list.")); 105 107 return; 106 108 } … … 111 113 } 112 114 ConflictResolver resolver = new ConflictResolver(sel); 113 int answer = JOptionPane.showConfirmDialog(Main.parent, resolver, "Resolve Conflicts", JOptionPane.OK_CANCEL_OPTION); 115 int answer = JOptionPane.showConfirmDialog(Main.parent, resolver, tr("Resolve Conflicts"), JOptionPane.OK_CANCEL_OPTION); 114 116 if (answer != JOptionPane.OK_OPTION) 115 117 return; -
src/org/openstreetmap/josm/gui/dialogs/LayerList.java
r103 r104 1 1 package org.openstreetmap.josm.gui.dialogs; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.BorderLayout; … … 55 57 public DeleteLayerAction(Layer layer) { 56 58 super("Delete", ImageProvider.get("dialogs", "delete")); 57 putValue(SHORT_DESCRIPTION, "Delete the selected layer."); 59 putValue(SHORT_DESCRIPTION, tr("Delete the selected layer.")); 58 60 this.layer = layer; 59 61 } … … 76 78 77 79 public ShowHideLayerAction(Layer layer) { 78 super("Show/Hide", ImageProvider.get("dialogs", "showhide")); 79 putValue(SHORT_DESCRIPTION, "Toggle visible state of the selected layer."); 80 super(tr("Show/Hide"), ImageProvider.get("dialogs", "showhide")); 81 putValue(SHORT_DESCRIPTION, tr("Toggle visible state of the selected layer.")); 80 82 this.layer = layer; 81 83 } … … 115 117 */ 116 118 public LayerList(MapFrame mapFrame) { 117 super( "Layers", "layerlist", "Open a list of all loaded layers.", KeyEvent.VK_L);119 super(tr("Layers"), "layerlist", tr("Open a list of all loaded layers."), KeyEvent.VK_L); 118 120 instance = new JList(model); 119 121 setPreferredSize(new Dimension(320,100)); … … 188 190 }; 189 191 190 upButton.setToolTipText("Move the selected layer one row up."); 192 upButton.setToolTipText(tr("Move the selected layer one row up.")); 191 193 upButton.addActionListener(upDown); 192 194 upButton.setActionCommand("up"); 193 195 buttonPanel.add(upButton); 194 196 195 downButton.setToolTipText("Move the selected layer one row down."); 197 downButton.setToolTipText(tr("Move the selected layer one row down.")); 196 198 downButton.addActionListener(upDown); 197 199 downButton.setActionCommand("down"); … … 206 208 buttonPanel.add(deleteButton); 207 209 208 mergeButton.setToolTipText("Merge the selected layer into the layer directly below."); 210 mergeButton.setToolTipText(tr("Merge the selected layer into the layer directly below.")); 209 211 mergeButton.addActionListener(new ActionListener(){ 210 212 public void actionPerformed(ActionEvent e) { -
src/org/openstreetmap/josm/gui/dialogs/LayerListPopup.java
r103 r104 1 1 package org.openstreetmap.josm.gui.dialogs; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.Component; … … 21 23 private final Layer layer; 22 24 public InfoAction(Layer layer) { 23 super( "Info", ImageProvider.get("info"));25 super(tr("Info"), ImageProvider.get("info")); 24 26 this.layer = layer; 25 27 } -
src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java
r100 r104 1 1 package org.openstreetmap.josm.gui.dialogs; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 4 import static org.openstreetmap.josm.tools.I18n.trn; 2 5 3 6 import java.awt.BorderLayout; … … 83 86 String key = data.getValueAt(row, 0).toString(); 84 87 Collection<OsmPrimitive> sel = Main.ds.getSelected(); 85 String msg = "<html>This will change "+sel.size()+" object"+(sel.size()==1?"":"s")+".<br><br>"+ 86 "Please select a new value for '"+key+"'.<br>(Empty string deletes the key.)"; 88 String msg = "<html>"+trn("This will change {0} object.", "This will change {0} objects.", sel.size(), sel.size())+"<br><br> "+tr("Please select a new value for '{0}'.<br>(Empty string deletes the key.)</html>)", key); 87 89 final JComboBox combo = (JComboBox)data.getValueAt(row, 1); 88 90 JPanel p = new JPanel(new BorderLayout()); 89 p.add(new JLabel(msg +"</html>"), BorderLayout.NORTH);91 p.add(new JLabel(msg), BorderLayout.NORTH); 90 92 p.add(combo, BorderLayout.CENTER); 91 93 … … 96 98 } 97 99 }; 98 final JDialog dlg = optionPane.createDialog(Main.parent, "Change values?"); 100 final JDialog dlg = optionPane.createDialog(Main.parent, tr("Change values?")); 99 101 combo.getEditor().addActionListener(new ActionListener(){ 100 102 public void actionPerformed(ActionEvent e) { … … 114 116 115 117 String value = combo.getEditor().getItem().toString(); 116 if (value.equals("<different>")) 118 if (value.equals(tr("<different>"))) 117 119 return; 118 120 if (value.equals("")) … … 134 136 135 137 JPanel p = new JPanel(new BorderLayout()); 136 p.add(new JLabel("<html>This will change "+sel.size()+" object"+(sel.size()==1?"":"s")+".<br><br>"+ 137 "Please select a key"), BorderLayout.NORTH); 138 p.add(new JLabel(trn("<html>This will change {0} object.<br>br>Please select a key", 139 "<html>This will change {0} objects.<br>br>Please select a key", 140 sel.size(),sel.size())), 141 BorderLayout.NORTH); 138 142 TreeSet<String> allKeys = new TreeSet<String>(); 139 143 for (OsmPrimitive osm : Main.ds.allNonDeletedPrimitives()) … … 147 151 JPanel p2 = new JPanel(new BorderLayout()); 148 152 p.add(p2, BorderLayout.SOUTH); 149 p2.add(new JLabel("Please select a value"), BorderLayout.NORTH); 153 p2.add(new JLabel(tr("Please select a value")), BorderLayout.NORTH); 150 154 final JTextField values = new JTextField(); 151 155 p2.add(values, BorderLayout.CENTER); … … 156 160 } 157 161 }; 158 pane.createDialog(Main.parent, "Change values?").setVisible(true); 162 pane.createDialog(Main.parent, tr("Change values?")).setVisible(true); 159 163 if (!Integer.valueOf(JOptionPane.OK_OPTION).equals(pane.getValue())) 160 164 return; … … 198 202 */ 199 203 public PropertiesDialog(MapFrame mapFrame) { 200 super("Properties", "propertiesdialog", "Property for selected objects.", KeyEvent.VK_P); 204 super(tr("Properties"), "propertiesdialog", tr("Property for selected objects."), KeyEvent.VK_P); 201 205 202 206 setPreferredSize(new Dimension(320,150)); 203 207 204 data.setColumnIdentifiers(new String[]{ "Key","Value"});208 data.setColumnIdentifiers(new String[]{tr("Key"),tr("Value")}); 205 209 propertyTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 206 210 propertyTable.setDefaultRenderer(JComboBox.class, new DefaultTableCellRenderer(){ … … 210 214 String str = ((JComboBox)value).getEditor().getItem().toString(); 211 215 ((JLabel)c).setText(str); 212 if (str.equals("<different>")) 216 if (str.equals(tr("<different>"))) 213 217 c.setFont(c.getFont().deriveFont(Font.ITALIC)); 214 218 } … … 231 235 public void actionPerformed(ActionEvent e) { 232 236 int sel = propertyTable.getSelectedRow(); 233 if (e.getActionCommand().equals( "Add"))237 if (e.getActionCommand().equals(tr("Add"))) 234 238 add(); 235 else if (e.getActionCommand().equals( "Edit")) {239 else if (e.getActionCommand().equals(tr("Edit"))) { 236 240 if (sel == -1) 237 JOptionPane.showMessageDialog(Main.parent, "Please select the row to edit."); 241 JOptionPane.showMessageDialog(Main.parent, tr("Please select the row to edit.")); 238 242 else 239 243 edit(sel); 240 } else if (e.getActionCommand().equals( "Delete")) {244 } else if (e.getActionCommand().equals(tr("Delete"))) { 241 245 if (sel == -1) 242 JOptionPane.showMessageDialog(Main.parent, "Please select the row to delete."); 246 JOptionPane.showMessageDialog(Main.parent, tr("Please select the row to delete.")); 243 247 else 244 248 delete(sel); … … 246 250 } 247 251 }; 248 buttonPanel.add(createButton( "Add","Add a new key/value pair to all objects", KeyEvent.VK_A, buttonAction));249 buttonPanel.add(createButton( "Edit","Edit the value of the selected key for all objects", KeyEvent.VK_E, buttonAction));250 buttonPanel.add(createButton("Delete" ,"Delete the selected key in all objects", KeyEvent.VK_D, buttonAction));252 buttonPanel.add(createButton(tr("Add"),tr("Add a new key/value pair to all objects"), KeyEvent.VK_A, buttonAction)); 253 buttonPanel.add(createButton(tr("Edit"),tr( "Edit the value of the selected key for all objects"), KeyEvent.VK_E, buttonAction)); 254 buttonPanel.add(createButton(tr("Delete"),tr("Delete the selected key in all objects"), KeyEvent.VK_D, buttonAction)); 251 255 add(buttonPanel, BorderLayout.SOUTH); 252 256 } … … 294 298 JComboBox value = new JComboBox(e.getValue().toArray()); 295 299 value.setEditable(true); 296 value.getEditor().setItem(valueCount.get(e.getKey()) != newSelection.size() ? "<different>" : e.getValue().iterator().next()); 300 value.getEditor().setItem(valueCount.get(e.getKey()) != newSelection.size() ? tr("<different>") : e.getValue().iterator().next()); 297 301 data.addRow(new Object[]{e.getKey(), value}); 298 302 } -
src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
r103 r104 1 1 package org.openstreetmap.josm.gui.dialogs; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.BorderLayout; … … 53 55 */ 54 56 public class SelectionListDialog extends ToggleDialog implements SelectionChangedListener { 55 56 57 public static enum SearchMode {replace, add, remove} 57 58 … … 62 63 private OsmIdReader idReader = new OsmIdReader(); 63 64 public SelectionWebsiteLoader(String urlStr, SearchMode mode) { 64 super("Load Selection"); 65 super(tr("Load Selection")); 65 66 this.mode = mode; 66 67 URL u = null; … … 69 70 } 70 71 @Override protected void realRun() { 71 currentAction.setText("Contact "+url.getHost()+"...");72 currentAction.setText(tr("Contact {0}...", url.getHost())); 72 73 sel = mode != SearchMode.remove ? new LinkedList<OsmPrimitive>() : Main.ds.allNonDeletedPrimitives(); 73 74 try { 74 75 URLConnection con = url.openConnection(); 75 76 InputStream in = new ProgressReader(con, progress, currentAction); 76 currentAction.setText("Downloading..."); 77 currentAction.setText(tr("Downloading...")); 77 78 Map<Long, String> ids = idReader.parseIds(in); 78 79 for (OsmPrimitive osm : Main.ds.allNonDeletedPrimitives()) { … … 86 87 } catch (IOException e) { 87 88 e.printStackTrace(); 88 JOptionPane.showMessageDialog(Main.parent, "Could not read from url: ' "+url+"'");89 JOptionPane.showMessageDialog(Main.parent, tr("Could not read from url: '{0}'",url)); 89 90 } catch (SAXException e) { 90 91 e.printStackTrace(); 91 JOptionPane.showMessageDialog(Main.parent, "+url+"'");92 JOptionPane.showMessageDialog(Main.parent,tr("Parsing error in url: '{0}'",url)); 92 93 } 93 94 } … … 116 117 */ 117 118 public SelectionListDialog(MapFrame mapFrame) { 118 super("Current Selection", "selectionlist", "Open a selection list window.", KeyEvent.VK_E); 119 super(tr("Current Selection"), "selectionlist", tr("Open a selection list window."), KeyEvent.VK_E); 119 120 setPreferredSize(new Dimension(320,150)); 120 121 displaylist.setCellRenderer(new OsmPrimitivRenderer()); … … 132 133 JPanel buttonPanel = new JPanel(new GridLayout(1,2)); 133 134 134 JButton button = new JButton( "Select", ImageProvider.get("mapmode", "selection"));135 button.setToolTipText("Set the selected elements on the map to the selected items in the list above."); 135 JButton button = new JButton(tr("Select"), ImageProvider.get("mapmode/selection/select")); 136 button.setToolTipText(tr("Set the selected elements on the map to the selected items in the list above.")); 136 137 button.addActionListener(new ActionListener(){ 137 138 public void actionPerformed(ActionEvent e) { … … 141 142 buttonPanel.add(button); 142 143 143 button = new JButton( "Reload", ImageProvider.get("dialogs", "refresh"));144 button.setToolTipText("Refresh the selection list."); 144 button = new JButton(tr("Reload"), ImageProvider.get("dialogs", "refresh")); 145 button.setToolTipText(tr("Refresh the selection list.")); 145 146 button.addActionListener(new ActionListener(){ 146 147 public void actionPerformed(ActionEvent e) { … … 150 151 buttonPanel.add(button); 151 152 152 button = new JButton( "Search", ImageProvider.get("dialogs", "search"));153 button.setToolTipText("Search for objects."); 153 button = new JButton(tr("Search"), ImageProvider.get("dialogs", "search")); 154 button.setToolTipText(tr("Search for objects.")); 154 155 button.addActionListener(new ActionListener(){ 155 156 private String lastSearch = ""; 156 157 public void actionPerformed(ActionEvent e) { 157 JLabel label = new JLabel("Please enter a search string."); 158 JLabel label = new JLabel(tr("Please enter a search string.")); 158 159 final JTextField input = new JTextField(lastSearch); 159 input.setToolTipText("<html>Fulltext search.<ul>" + 160 input.setToolTipText(tr("<html>Fulltext search.<ul>" + 160 161 "<li><code>Baker Street</code> - 'Baker' and 'Street' in any key or name.</li>" + 161 162 "<li><code>\"Baker Street\"</code> - 'Baker Street' in any key or name.</li>" + … … 163 164 "<li><code>-name:Bak</code> - not 'Bak' in the name.</li>" + 164 165 "<li><code>foot:</code> - key=foot set to any value." + 165 "</ul></html>"); 166 167 JRadioButton replace = new JRadioButton("replace selection", true); 168 JRadioButton add = new JRadioButton("add to selection", false); 169 JRadioButton remove = new JRadioButton("remove from selection", false); 166 "</ul></html>")); 167 168 JRadioButton replace = new JRadioButton(tr("replace selection"), true); 169 JRadioButton add = new JRadioButton(tr("add to selection"), false); 170 JRadioButton remove = new JRadioButton(tr("remove from selection"), false); 170 171 ButtonGroup bg = new ButtonGroup(); 171 172 bg.add(replace); … … 184 185 } 185 186 }; 186 pane.createDialog(Main.parent, 187 pane.createDialog(Main.parent,tr("Search")).setVisible(true); 187 188 if (!Integer.valueOf(JOptionPane.OK_OPTION).equals(pane.getValue())) 188 189 return; -
src/org/openstreetmap/josm/gui/layer/GeoImageLayer.java
r103 r104 1 1 package org.openstreetmap.josm.gui.layer; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 4 import static org.openstreetmap.josm.tools.I18n.trn; 2 5 3 6 import java.awt.BorderLayout; … … 80 83 private final RawGpsLayer gpsLayer; 81 84 public Loader(Collection<File> files, RawGpsLayer gpsLayer) { 82 super( "Images");85 super(tr("Images")); 83 86 this.files = files; 84 87 this.gpsLayer = gpsLayer; 85 88 } 86 89 @Override protected void realRun() throws IOException { 87 currentAction.setText("Read GPS..."); 90 currentAction.setText(tr("Read GPS...")); 88 91 LinkedList<TimedPoint> gps = new LinkedList<TimedPoint>(); 89 92 … … 95 98 for (GpsPoint p : c) { 96 99 if (p.time == null) 97 throw new IOException("No time for point "+p.latlon.lat()+","+p.latlon.lon());100 throw new IOException(tr("No time for point {0},{1}",p.latlon.lat(),p.latlon.lon())); 98 101 Matcher m = reg.matcher(p.time); 99 102 if (!m.matches()) 100 throw new IOException("Cannot read time from point "+p.latlon.lat()+","+p.latlon.lon());103 throw new IOException(tr("Cannot read time from point {0},{1}",p.latlon.lat(),p.latlon.lon())); 101 104 Date d = DateParser.parse(m.group(1)+" "+m.group(2)); 102 105 gps.add(new TimedPoint(d, p.eastNorth)); 103 106 if (last != null && last.after(d)) 104 throw new IOException("Time loop in gps data."); 107 throw new IOException(tr("Time loop in gps data.")); 105 108 last = d; 106 109 } … … 108 111 } catch (ParseException e) { 109 112 e.printStackTrace(); 110 throw new IOException("Incorrect date information"); 113 throw new IOException(tr("Incorrect date information")); 111 114 } 112 115 113 116 if (gps.isEmpty()) { 114 errorMessage = "No images with readable timestamps found."; 117 errorMessage = tr("No images with readable timestamps found."); 115 118 return; 116 119 } … … 123 126 if (cancelled) 124 127 break; 125 currentAction.setText("Reading "+f.getName()+"...");128 currentAction.setText(tr("Reading {0}...",f.getName())); 126 129 progress.setValue(i++); 127 130 … … 183 186 184 187 private GeoImageLayer(final ArrayList<ImageEntry> data, LinkedList<TimedPoint> gps) { 185 super("Geotagged Images"); 188 super(tr("Geotagged Images")); 186 189 this.data = data; 187 190 this.gps = gps; … … 250 253 p.add(new JLabel(getToolTipText()), GBC.eop()); 251 254 252 p.add(new JLabel("GPS start: "+dateFormat.format(gps.getFirst().time)), GBC.eol());253 p.add(new JLabel("GPS end: "+dateFormat.format(gps.getLast().time)), GBC.eop());254 255 p.add(new JLabel("current delta: "+(delta/1000.0)+"s"), GBC.eol());256 p.add(new JLabel("timezone difference: "+(gpstimezone>0?"+":"")+(gpstimezone/1000/60/60)), GBC.eop()); 255 p.add(new JLabel(tr("GPS start: {0}",dateFormat.format(gps.getFirst().time))), GBC.eol()); 256 p.add(new JLabel(tr("GPS end: {0}",dateFormat.format(gps.getLast().time))), GBC.eop()); 257 258 p.add(new JLabel(tr("current delta: {0}s",(delta/1000.0))), GBC.eol()); 259 p.add(new JLabel(tr("timezone difference: ")+(gpstimezone>0?"+":"")+(gpstimezone/1000/60/60)), GBC.eop()); 257 260 258 261 JList img = new JList(data.toArray()); … … 278 281 if (e.pos != null) 279 282 i++; 280 return data.size()+" images, "+i+"within the track.";283 return trn("{0} image. {1} within the track.","{0} images. {1} within the track.",data.size(),data.size(),i); 281 284 } 282 285 … … 316 319 317 320 @Override public Component[] getMenuEntries() { 318 JMenuItem sync = new JMenuItem("Sync clock", ImageProvider.get("clock")); 321 JMenuItem sync = new JMenuItem(tr("Sync clock"), ImageProvider.get("clock")); 319 322 sync.addActionListener(new ActionListener(){ 320 323 public void actionPerformed(ActionEvent e) { … … 327 330 } 328 331 @Override public String getDescription() { 329 return "JPEG images (*.jpg)"; 332 return tr("JPEG images (*.jpg)"); 330 333 } 331 334 }); … … 369 372 Date exifDate = ExifReader.readTime(f); 370 373 JPanel p = new JPanel(new GridBagLayout()); 371 p.add(new JLabel( "Image"), GBC.eol());374 p.add(new JLabel(tr("Image")), GBC.eol()); 372 375 p.add(new JLabel(loadScaledImage(f, 300)), GBC.eop()); 373 p.add(new JLabel("Enter shown date (mm/dd/yyyy HH:MM:SS)"), GBC.eol()); 376 p.add(new JLabel(tr("Enter shown date (mm/dd/yyyy HH:MM:SS)")), GBC.eol()); 374 377 JTextField gpsText = new JTextField(dateFormat.format(new Date(exifDate.getTime()+delta))); 375 378 p.add(gpsText, GBC.eol().fill(GBC.HORIZONTAL)); 376 p.add(new JLabel("GPS unit timezome (difference to photo)"), GBC.eol()); 379 p.add(new JLabel(tr("GPS unit timezome (difference to photo)")), GBC.eol()); 377 380 String t = Main.pref.get("tagimages.gpstimezone", "0"); 378 381 if (t.charAt(0) != '-') … … 382 385 383 386 while (true) { 384 int answer = JOptionPane.showConfirmDialog(Main.parent, p, "Syncronize Time with GPS Unit", JOptionPane.OK_CANCEL_OPTION); 387 int answer = JOptionPane.showConfirmDialog(Main.parent, p, tr("Syncronize Time with GPS Unit"), JOptionPane.OK_CANCEL_OPTION); 385 388 if (answer != JOptionPane.OK_OPTION || gpsText.getText().equals("")) 386 389 return; … … 398 401 return; 399 402 } catch (ParseException x) { 400 JOptionPane.showMessageDialog(Main.parent, "Time entered could not be parsed."); 403 JOptionPane.showMessageDialog(Main.parent, tr("Time entered could not be parsed.")); 401 404 } 402 405 } -
src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r103 r104 1 1 package org.openstreetmap.josm.gui.layer; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 4 import static org.openstreetmap.josm.tools.I18n.trn; 2 5 3 6 import java.awt.Component; … … 148 151 149 152 @Override public String getToolTipText() { 150 return undeletedSize(data.nodes) +" nodes, "+151 undeletedSize(data.segments) +"segments, "+152 undeletedSize(data.ways) +" streets.";153 return trn("{0} node", "{0} nodes", undeletedSize(data.nodes), undeletedSize(data.nodes)) 154 +trn("{0} segment", "{0} segments", undeletedSize(data.segments), undeletedSize(data.segments)) 155 +trn("{0} way", "{0} ways", undeletedSize(data.ways), undeletedSize(data.ways)); 153 156 } 154 157 … … 162 165 final ConflictDialog dlg = Main.map.conflictDialog; 163 166 dlg.add(visitor.conflicts); 164 JOptionPane.showMessageDialog(Main.parent, 167 JOptionPane.showMessageDialog(Main.parent,tr("There were conflicts during import.")); 165 168 if (!dlg.isVisible()) 166 169 dlg.action.actionPerformed(new ActionEvent(this, 0, "")); … … 301 304 osm.visit(counter); 302 305 final JPanel p = new JPanel(new GridBagLayout()); 303 p.add(new JLabel( name+"consists of:"), GBC.eol());306 p.add(new JLabel(tr("{0} consists of:", name)), GBC.eol()); 304 307 for (int i = 0; i < counter.normal.length; ++i) { 305 String s = counter.normal[i]+" "+counter.names[i]+ (counter.normal[i]!= 1 ?"s":"");308 String s = counter.normal[i]+" "+trn(counter.names[i],counter.names[i]+"s",counter.normal[i]); 306 309 if (counter.deleted[i] > 0) 307 s += " ("+counter.deleted[i]+" deleted)";310 s += tr(" ({0} deleted.)",counter.deleted[i]); 308 311 p.add(new JLabel(s, ImageProvider.get("data", counter.names[i]), JLabel.HORIZONTAL), GBC.eop().insets(15,0,0,0)); 309 312 } -
src/org/openstreetmap/josm/gui/layer/RawGpsLayer.java
r103 r104 1 1 package org.openstreetmap.josm.gui.layer; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 4 import static org.openstreetmap.josm.tools.I18n.trn; 2 5 3 6 import java.awt.Color; … … 46 49 public class ConvertToDataLayerAction extends AbstractAction { 47 50 public ConvertToDataLayerAction() { 48 super("Convert to data layer", ImageProvider.get("converttoosm")); 51 super(tr("Convert to data layer"), ImageProvider.get("converttoosm")); 49 52 } 50 53 public void actionPerformed(ActionEvent e) { … … 65 68 ds.ways.add(w); 66 69 } 67 Main.main.addLayer(new OsmDataLayer(ds, "Data Layer", true)); 70 Main.main.addLayer(new OsmDataLayer(ds, tr("Data Layer"), true)); 68 71 Main.main.removeLayer(RawGpsLayer.this); 69 72 } … … 127 130 for (Collection<GpsPoint> c : data) 128 131 points += c.size(); 129 return data.size()+" tracks, "+points+" points."; 132 return trn("{0} track", "{0} tracks", data.size(), data.size()) 133 +" "+trn("{0} point", "{0} points", points, points); 130 134 } 131 135 … … 149 153 int points = 0; 150 154 for (Collection<GpsPoint> c : data) { 151 b.append(" a track with "+c.size()+" points<br>");155 b.append(" "+trn("a track with {0} point","a track with {0} points", c.size(), c.size())+"<br>"); 152 156 points += c.size(); 153 157 } 154 158 b.append("</html>"); 155 return "<html>"+ name+"consists of "+data.size()+" tracks ("+points+"points)<br>"+b.toString();159 return "<html>"+tr("{0} consists of ")+trn("{0} track", "{0} tracks", data.size(), data.size())+" ("+trn("{0} point", "{0} points", points, points)+")<br>"+b.toString(); 156 160 } 157 161 158 162 @Override public Component[] getMenuEntries() { 159 JMenuItem color = new JMenuItem("Customize Color", ImageProvider.get("colorchooser")); 163 JMenuItem color = new JMenuItem(tr("Customize Color"), ImageProvider.get("colorchooser")); 160 164 color.addActionListener(new ActionListener(){ 161 165 public void actionPerformed(ActionEvent e) { 162 166 String col = Main.pref.get("color.layer "+name, Main.pref.get("color.gps point", ColorHelper.color2html(Color.gray))); 163 167 JColorChooser c = new JColorChooser(ColorHelper.html2color(col)); 164 Object[] options = new Object[]{ "OK","Cancel","Default"};165 int answer = JOptionPane.showOptionDialog(Main.parent, c, "Choose a color", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, options[0]); 168 Object[] options = new Object[]{tr("OK"), tr("Cancel"), tr("Default")}; 169 int answer = JOptionPane.showOptionDialog(Main.parent, c, tr("Choose a color"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, options[0]); 166 170 switch (answer) { 167 171 case 0: … … 178 182 }); 179 183 180 JMenuItem tagimage = new JMenuItem("Import images", ImageProvider.get("tagimages")); 184 JMenuItem tagimage = new JMenuItem(tr("Import images"), ImageProvider.get("tagimages")); 181 185 tagimage.addActionListener(new ActionListener(){ 182 186 public void actionPerformed(ActionEvent e) { … … 190 194 } 191 195 @Override public String getDescription() { 192 return "JPEG images (*.jpg)"; 196 return tr("JPEG images (*.jpg)"); 193 197 } 194 198 }); -
src/org/openstreetmap/josm/gui/layer/WmsServerLayer.java
r103 r104 1 1 package org.openstreetmap.josm.gui.layer; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.Component; … … 42 44 // unprojected scale. 43 45 if (Projection.MAX_LON != 180) 44 throw new IllegalArgumentException("Wrong longitude transformation for tile cache. Can't operate on "+Main.proj);46 throw new IllegalArgumentException(tr("Wrong longitude transformation for tile cache. Can't operate on {0}",Main.proj)); 45 47 46 48 this.url = url; … … 53 55 54 56 @Override public String getToolTipText() { 55 return "WMS layer: "+url;57 return tr("WMS layer: {0}", url); 56 58 } 57 59 -
src/org/openstreetmap/josm/io/OsmConnection.java
r103 r104 1 1 package org.openstreetmap.josm.io; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.Font; … … 66 68 JPanel p = new JPanel(new GridBagLayout()); 67 69 if (!username.equals("") && !password.equals("")) 68 p.add(new JLabel("Incorrect password or username."), GBC.eop()); 69 p.add(new JLabel("Username"), GBC.std().insets(0,0,10,0)); 70 p.add(new JLabel(tr("Incorrect password or username.")), GBC.eop()); 71 p.add(new JLabel(tr("Username")), GBC.std().insets(0,0,10,0)); 70 72 JTextField usernameField = new JTextField(username, 20); 71 73 p.add(usernameField, GBC.eol()); 72 p.add(new JLabel("Password"), GBC.std().insets(0,0,10,0)); 74 p.add(new JLabel(tr("Password")), GBC.std().insets(0,0,10,0)); 73 75 JPasswordField passwordField = new JPasswordField(password, 20); 74 76 p.add(passwordField, GBC.eol()); 75 JLabel warning = new JLabel("Warning: The password is transferred unencrypted."); 77 JLabel warning = new JLabel(tr("Warning: The password is transferred unencrypted.")); 76 78 warning.setFont(warning.getFont().deriveFont(Font.ITALIC)); 77 79 p.add(warning, GBC.eop()); 78 80 79 JCheckBox savePassword = new JCheckBox("Save user and password (unencrypted)", !username.equals("") && !password.equals("")); 81 JCheckBox savePassword = new JCheckBox(tr("Save user and password (unencrypted)"), !username.equals("") && !password.equals("")); 80 82 p.add(savePassword, GBC.eop()); 81 83 82 int choice = JOptionPane.showConfirmDialog(Main.parent, p, "Enter Password", JOptionPane.OK_CANCEL_OPTION); 84 int choice = JOptionPane.showConfirmDialog(Main.parent, p, tr("Enter Password"), JOptionPane.OK_CANCEL_OPTION); 83 85 if (choice == JOptionPane.CANCEL_OPTION) { 84 86 authCancelled = true; … … 120 122 121 123 public void cancel() { 122 currentAction.setText("Aborting..."); 124 currentAction.setText(tr("Aborting...")); 123 125 cancel = true; 124 126 if (activeConnection != null) { -
src/org/openstreetmap/josm/io/OsmIdReader.java
r103 r104 1 1 package org.openstreetmap.josm.io; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.io.IOException; … … 30 32 } catch (Exception e) { 31 33 e.printStackTrace(); 32 throw new SAXException("Error during parse."); 34 throw new SAXException(tr("Error during parse.")); 33 35 } 34 36 } -
src/org/openstreetmap/josm/io/OsmReader.java
r103 r104 1 1 package org.openstreetmap.josm.io; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.io.IOException; … … 93 95 if (qName.equals("osm")) { 94 96 if (atts == null) 95 throw new SAXException("Unknown version."); 97 throw new SAXException(tr("Unknown version.")); 96 98 if (!"0.3".equals(atts.getValue("version"))) 97 throw new SAXException("Unknown version "+atts.getValue("version"));99 throw new SAXException(tr("Unknown version {0}",atts.getValue("version"))); 98 100 } else if (qName.equals("node")) { 99 101 current = new Node(new LatLon(getDouble(atts, "lat"), getDouble(atts, "lon"))); … … 111 113 Collection<Long> list = ways.get(current); 112 114 if (list == null) 113 throw new SAXException("Found <seg> tag on non-way."); 115 throw new SAXException(tr("Found <seg> tag on non-way.")); 114 116 long id = getLong(atts, "id"); 115 117 if (id == 0) 116 throw new SAXException("Incomplete segment with id=0"); 118 throw new SAXException(tr("Incomplete segment with id=0")); 117 119 list.add(id); 118 120 } else if (qName.equals("tag")) … … 123 125 } catch (NullPointerException x) { 124 126 x.printStackTrace(); // SAXException does not chain correctly 125 throw new SAXException("NullPointerException. Possible some missing tags.", x); 127 throw new SAXException(tr("NullPointerException. Possible some missing tags."), x); 126 128 } 127 129 } … … 138 140 current.id = getLong(atts, "id"); 139 141 if (current.id == 0) 140 throw new SAXException("Illegal object with id=0"); 142 throw new SAXException(tr("Illegal object with id=0")); 141 143 142 144 String time = atts.getValue("timestamp"); … … 147 149 } catch (ParseException e) { 148 150 e.printStackTrace(); 149 throw new SAXException("Couldn't read time format ' "+time+"'.");151 throw new SAXException(tr("Couldn't read time format '{0}'.",time)); 150 152 } 151 153 } … … 162 164 String s = atts.getValue(value); 163 165 if (s == null) 164 throw new SAXException("Missing required attirbute ' "+value+"'");166 throw new SAXException(tr("Missing required attirbute '{0}'.",value)); 165 167 return Long.parseLong(s); 166 168 } … … 209 211 progress.setValue(0); 210 212 if (currentAction != null) 211 currentAction.setText("Preparing data..."); 213 currentAction.setText(tr("Preparing data...")); 212 214 for (Node n : osm.nodes.values()) 213 215 osm.adder.visit(n); … … 218 220 } catch (NumberFormatException e) { 219 221 e.printStackTrace(); 220 throw new SAXException("Illformed Node id"); 222 throw new SAXException(tr("Illformed Node id")); 221 223 } 222 224 -
src/org/openstreetmap/josm/io/OsmServerReader.java
r103 r104 5 5 import java.net.HttpURLConnection; 6 6 import java.net.URL; 7 import java.util.Collection;8 import java.util.LinkedList;9 7 10 8 import org.openstreetmap.josm.Main; 11 import org.openstreetmap.josm.data.osm.DataSet;12 import org.openstreetmap.josm.gui.layer.RawGpsLayer.GpsPoint;13 import org.xml.sax.SAXException;14 9 15 10 /** … … 18 13 * @author imi 19 14 */ 20 public class OsmServerReader extends OsmConnection { 21 22 /** 23 * The boundings of the desired map data. 24 */ 25 private final double lat1; 26 private final double lon1; 27 private final double lat2; 28 private final double lon2; 29 30 /** 31 * Construct the reader and store the information for attaching 32 */ 33 public OsmServerReader(double lat1, double lon1, double lat2, double lon2) { 34 this.lon2 = lon2; 35 this.lat2 = lat2; 36 this.lon1 = lon1; 37 this.lat1 = lat1; 38 } 39 40 41 /** 42 * Retrieve raw gps waypoints from the server API. 43 * @return A list of all primitives retrieved. Currently, the list of lists 44 * contain only one list, since the server cannot distinguish between 45 * ways. 46 */ 47 public Collection<Collection<GpsPoint>> parseRawGps() throws IOException, SAXException { 48 try { 49 String url = Main.pref.get("osm-server.url")+"/0.3/trackpoints?bbox="+lon1+","+lat1+","+lon2+","+lat2+"&page="; 50 Collection<Collection<GpsPoint>> data = new LinkedList<Collection<GpsPoint>>(); 51 Collection<GpsPoint> list = new LinkedList<GpsPoint>(); 52 53 for (int i = 0;;++i) { 54 currentAction.setText("Downloading points "+(i*5000)+" to "+((i+1)*5000)+"..."); 55 InputStream in = getInputStream(url+i); 56 if (in == null) 57 break; 58 Collection<Collection<GpsPoint>> allWays = RawGpsReader.parse(in); 59 boolean foundSomething = false; 60 for (Collection<GpsPoint> t : allWays) { 61 if (!t.isEmpty()) { 62 foundSomething = true; 63 list.addAll(t); 64 } 65 } 66 if (!foundSomething) 67 break; 68 in.close(); 69 activeConnection = null; 70 } 71 72 data.add(list); 73 return data; 74 } catch (IOException e) { 75 if (cancel) 76 return null; 77 throw e; 78 } catch (SAXException e) { 79 throw e; 80 } catch (Exception e) { 81 if (cancel) 82 return null; 83 if (e instanceof RuntimeException) 84 throw (RuntimeException)e; 85 throw new RuntimeException(e); 86 } 87 } 88 89 90 /** 91 * Read the data from the osm server address. 92 * @return A data set containing all data retrieved from that url 93 */ 94 public DataSet parseOsm() throws SAXException, IOException { 95 try { 96 final InputStream in = getInputStream(Main.pref.get("osm-server.url")+"/0.3/map?bbox="+lon1+","+lat1+","+lon2+","+lat2); 97 if (in == null) 98 return null; 99 currentAction.setText("Downloading OSM data..."); 100 final DataSet data = OsmReader.parseDataSet(in, currentAction, progress); 101 in.close(); 102 activeConnection = null; 103 return data; 104 } catch (IOException e) { 105 if (cancel) 106 return null; 107 throw e; 108 } catch (SAXException e) { 109 throw e; 110 } catch (Exception e) { 111 if (cancel) 112 return null; 113 if (e instanceof RuntimeException) 114 throw (RuntimeException)e; 115 throw new RuntimeException(e); 116 } 117 } 118 119 15 abstract class OsmServerReader extends OsmConnection { 120 16 /** 121 17 * Open a connection to the given url and return a reader on the input stream … … 124 20 * @return An reader reading the input stream (servers answer) or <code>null</code>. 125 21 */ 126 private InputStream getInputStream(String urlStr) throws IOException { 22 protected InputStream getInputStream(String urlStr) throws IOException { 23 urlStr = Main.pref.get("osm-server.url")+"/0.3/" + urlStr; 127 24 System.out.println("download: "+urlStr); 128 25 initAuthentication(); 129 26 URL url = new URL(urlStr); 130 27 activeConnection = (HttpURLConnection)url.openConnection(); 28 System.out.println("got return: "+activeConnection.getResponseCode()); 131 29 activeConnection.setConnectTimeout(15000); 132 30 if (isAuthCancelled() && activeConnection.getResponseCode() == 401) -
src/org/openstreetmap/josm/io/OsmServerWriter.java
r103 r104 1 1 package org.openstreetmap.josm.io; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.io.BufferedReader; … … 67 69 return; 68 70 osm.visit(v); 69 currentAction.setText("Upload "+v.className+" "+v.name+" ("+osm.id+")...");71 currentAction.setText(tr("Upload {0} {1} ({2})...", v.className, v.name, osm.id)); 70 72 osm.visit(this); 71 73 progress.setValue(progress.getValue()+1); … … 152 154 try { 153 155 URL url = new URL(Main.pref.get("osm-server.url") + "/0.3/" + urlSuffix + "/" + osm.id); 154 System.out.println("upload to: "+url);156 System.out.println(tr("upload to: {0}")); 155 157 activeConnection = (HttpURLConnection) url.openConnection(); 156 158 activeConnection.setConnectTimeout(15000); … … 169 171 if (retCode == 200 && osm.id == 0) 170 172 osm.id = readId(activeConnection.getInputStream()); 171 System.out.println("got return: "+retCode+"with id"+osm.id);173 System.out.println(tr("got return: {0} with id {1}",retCode,osm.id)); 172 174 String retMsg = activeConnection.getResponseMessage(); 173 175 activeConnection.disconnect(); … … 181 183 } 182 184 } catch (UnknownHostException e) { 183 throw new RuntimeException("Unknown host: "+e.getMessage(), e); 185 throw new RuntimeException(tr("Unknown host: ")+e.getMessage(), e); 184 186 } catch (Exception e) { 185 187 if (cancel) -
src/org/openstreetmap/josm/io/RawCsvReader.java
r103 r104 1 1 package org.openstreetmap.josm.io; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.io.BufferedReader; … … 35 37 formatStr = in.readLine(); 36 38 if (formatStr == null) 37 throw new SAXException("Could not detect data format string."); 39 throw new SAXException(tr("Could not detect data format string.")); 38 40 39 41 // get delimiter … … 58 60 if (!format.contains("lat") || !format.contains("lon")) { 59 61 if (Main.pref.get("csv.importstring").equals("")) 60 throw new SAXException("Format string in data is incomplete or not found. Try setting an manual format string in Preferences."); 61 throw new SAXException("Format string is incomplete. Need at least 'lat' and 'lon' specification"); 62 throw new SAXException(tr("Format string in data is incomplete or not found. Try setting an manual format string in Preferences.")); 63 throw new SAXException(tr("Format string is incomplete. Need at least 'lat' and 'lon' specification")); 62 64 } 63 65 … … 79 81 st.nextToken(); 80 82 else 81 throw new SAXException("Unknown data type: ' "+token+"'."+(Main.pref.get("csv.importstring").equals("") ?"Maybe add an format string in preferences.": ""));83 throw new SAXException(tr("Unknown data type: '{0}'.{1}",token,(Main.pref.get("csv.importstring").equals("") ? (" "+tr("Maybe add an format string in preferences.")) : ""))); 82 84 } 83 85 data.add(new GpsPoint(new LatLon(lat, lon), time)); 84 86 } 85 87 } catch (RuntimeException e) { 86 throw new SAXException("Parsing error in line "+lineNo, e);88 throw new SAXException(tr("Parsing error in line {0}",lineNo), e); 87 89 } 88 90 return data; -
src/org/openstreetmap/josm/io/RawGpsReader.java
r103 r104 1 1 package org.openstreetmap.josm.io; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.io.IOException; … … 37 39 double lon = Double.parseDouble(atts.getValue("lon")); 38 40 if (Math.abs(lat) > 90) 39 throw new SAXException("Data error: lat value ' "+lat+"' is out of bound.");41 throw new SAXException(tr("Data error: lat value '{0}' is out of bound.", lat)); 40 42 if (Math.abs(lon) > 180) 41 throw new SAXException("Data error: lon value ' "+lon+"' is out of bound.");43 throw new SAXException(tr("Data error: lon value '{0}' is out of bound.", lon)); 42 44 currentLatLon = new LatLon(lat, lon); 43 45 } catch (NumberFormatException e) { -
src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java
r103 r104 1 1 package org.openstreetmap.josm.tools; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.GridBagLayout; … … 25 27 * @author imi 26 28 */ 27 public final class BugReportExceptionHandler implements Thread.UncaughtExceptionHandler { 29 public final class BugReportExceptionHandler implements Thread.UncaughtExceptionHandler { 30 28 31 public void uncaughtException(Thread t, Throwable e) { 29 32 e.printStackTrace(); … … 34 37 } 35 38 36 Object[] options = new String[]{"Do nothing" ,"Report Bug"};37 int answer = JOptionPane.showOptionDialog(Main.parent, "An unexpected exception occoured.\n\n" + 39 Object[] options = new String[]{tr("Do nothing"), tr("Report Bug")}; 40 int answer = JOptionPane.showOptionDialog(Main.parent, tr("An unexpected exception occoured.\n\n" + 38 41 "This is always a coding error. If you are running the latest\n" + 39 "version of JOSM, please consider be kind and file a bug report.", 40 "Unexpected Exception", JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, 42 "version of JOSM, please consider be kind and file a bug report."), 43 tr("Unexpected Exception"), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, 41 44 null, options, options[0]); 42 45 if (answer == 1) { -
src/org/openstreetmap/josm/tools/DateParser.java
r102 r104 1 1 package org.openstreetmap.josm.tools; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.text.ParseException; … … 25 27 try {return sdf.parse(d);} catch (ParseException pe) {} 26 28 } 27 throw new ParseException("No applicable parse format", 0); 29 throw new ParseException(tr("No applicable parse format"), 0); 28 30 } 29 31 } -
src/org/openstreetmap/josm/tools/ExifReader.java
r99 r104 2 2 3 3 import java.io.File; 4 import java.text.SimpleDateFormat;5 4 import java.util.Date; 6 5 import java.util.Iterator; … … 24 23 Tag tag = tagIt.next(); 25 24 if (tag.getTagType() == 0x132 || tag.getTagType() == 0x9003 || tag.getTagType() == 0x9004) 26 return new SimpleDateFormat("yyyy:MM:dd HH:mm:ss").parse(tag.getDescription());25 return DateParser.parse(tag.getDescription()); 27 26 } 28 27 } -
src/org/openstreetmap/josm/tools/ShortCutLabel.java
r94 r104 1 1 package org.openstreetmap.josm.tools; 2 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 4 3 5 import java.awt.event.KeyEvent; 6 4 7 5 8 public class ShortCutLabel { … … 7 10 String s = ""; 8 11 if ((modifiers & KeyEvent.CTRL_MASK) != 0) 9 s += "Ctrl-";12 s += tr("Ctrl-"); 10 13 if ((modifiers & KeyEvent.ALT_MASK) != 0) 11 s += "Alt-";14 s += tr("Alt-"); 12 15 if ((modifiers & KeyEvent.ALT_GRAPH_MASK) != 0) 13 s += "AltGr-";16 s += tr("AltGr-"); 14 17 if ((modifiers & KeyEvent.SHIFT_MASK) != 0) 15 s += "Shift-";18 s += tr("Shift-"); 16 19 s += Character.toUpperCase((char)shortCut); 17 20 return s; -
src/org/openstreetmap/josm/tools/UrlLabel.java
r69 r104 11 11 public class UrlLabel extends JEditorPane implements HyperlinkListener { 12 12 13 private final String url; 14 13 15 public UrlLabel(String url) { 16 this.url = url; 14 17 setContentType("text/html"); 15 18 setText("<html><a href=\""+url+"\">"+url+"</a></html>"); … … 21 24 public void hyperlinkUpdate(HyperlinkEvent e) { 22 25 if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { 23 OpenBrowser.displayUrl( "http://wiki.eigenheimstrasse.de/wiki/JOSM");26 OpenBrowser.displayUrl(url); 24 27 } 25 28 }
Note:
See TracChangeset
for help on using the changeset viewer.