Changeset 110 in josm for src


Ignore:
Timestamp:
2006-07-15T15:57:15+02:00 (18 years ago)
Author:
imi
Message:
  • fixed some output strings that got messed up due i18n.
  • fixed timestamp parsing when reading XML
Location:
src/org/openstreetmap/josm
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • src/org/openstreetmap/josm/Main.java

    r104 r110  
    272272                } catch (final IOException e1) {
    273273                        e1.printStackTrace();
    274                         errMsg = tr("Preferences could not be loaded. Write default preference file to '{0}'.",
     274                        errMsg = tr("Preferences could not be loaded. Write default preference file to \"{0}\".",
    275275                    pref.getPreferencesDir() + "preferences");
    276276                        Main.pref.resetToDefault();
     
    339339                        final Bounds b = DownloadAction.osmurl2bounds(s);
    340340                        if (b == null)
    341                                 JOptionPane.showMessageDialog(Main.parent, tr("Ignoring malformed url: '{0}'", s));
     341                                JOptionPane.showMessageDialog(Main.parent, tr("Ignoring malformed url: \"{0}\"", s));
    342342                        else
    343343                                main.downloadAction.download(false, b.min.lat(), b.min.lon(), b.max.lat(), b.max.lon());
     
    349349                                main.openAction.openFile(new File(new URI(s)));
    350350                        } catch (URISyntaxException e) {
    351                                 JOptionPane.showMessageDialog(Main.parent, tr("Ignoring malformed file url: '{0}", s));
     351                                JOptionPane.showMessageDialog(Main.parent, tr("Ignoring malformed file url: \"{0}\"", s));
    352352                        }
    353353                        return;
  • src/org/openstreetmap/josm/actions/OpenAction.java

    r104 r110  
    8585                } catch (IOException x) {
    8686                        x.printStackTrace();
    87                         JOptionPane.showMessageDialog(Main.parent, tr("Could not read '{0}'",fn)+"\n"+x.getMessage());
     87                        JOptionPane.showMessageDialog(Main.parent, tr("Could not read \"{0}\"",fn)+"\n"+x.getMessage());
    8888                }
    8989        }
  • src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java

    r108 r110  
    8686                String key = data.getValueAt(row, 0).toString();
    8787                Collection<OsmPrimitive> sel = Main.ds.getSelected();
    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);
     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);
    8989                final JComboBox combo = (JComboBox)data.getValueAt(row, 1);
    9090                JPanel p = new JPanel(new BorderLayout());
  • src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java

    r108 r110  
    8787                } catch (IOException e) {
    8888                        e.printStackTrace();
    89                         JOptionPane.showMessageDialog(Main.parent, tr("Could not read from url: '{0}'",url));
     89                        JOptionPane.showMessageDialog(Main.parent, tr("Could not read from url: \"{0}\"",url));
    9090                } catch (SAXException e) {
    9191                        e.printStackTrace();
    92                         JOptionPane.showMessageDialog(Main.parent,tr("Parsing error in url: '{0}'",url));
     92                        JOptionPane.showMessageDialog(Main.parent,tr("Parsing error in url: \"{0}\"",url));
    9393                }
    9494        }
  • src/org/openstreetmap/josm/io/OsmReader.java

    r106 r110  
    2626import org.openstreetmap.josm.data.osm.visitor.AddVisitor;
    2727import org.openstreetmap.josm.data.osm.visitor.Visitor;
     28import org.openstreetmap.josm.tools.DateParser;
    2829import org.xml.sax.Attributes;
    2930import org.xml.sax.SAXException;
     
    145146                if (time != null && time.length() != 0) {
    146147                        try {
    147                                 DateFormat df = new SimpleDateFormat("y-M-d H:m:s");
    148                                 current.timestamp = df.parse(time);
     148                                current.timestamp = DateParser.parse(time);
    149149                        } catch (ParseException e) {
    150150                                e.printStackTrace();
    151                                 throw new SAXException(tr("Couldn't read time format '{0}'.",time));
     151                                throw new SAXException(tr("Couldn''t read time format \"{0}\".",time));
    152152                        }
    153153                }
     
    164164                String s = atts.getValue(value);
    165165                if (s == null)
    166                         throw new SAXException(tr("Missing required attirbute '{0}'.",value));
     166                        throw new SAXException(tr("Missing required attirbute \"{0}\".",value));
    167167                return Long.parseLong(s);
    168168        }
  • src/org/openstreetmap/josm/io/RawCsvReader.java

    r104 r110  
    8181                                                st.nextToken();
    8282                                        else
    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.")) : "")));
     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.")) : "")));
    8484                                }
    8585                                data.add(new GpsPoint(new LatLon(lat, lon), time));
  • src/org/openstreetmap/josm/io/RawGpsReader.java

    r106 r110  
    4141                        double lon = Double.parseDouble(atts.getValue("lon"));
    4242                                if (Math.abs(lat) > 90)
    43                                         throw new SAXException(tr("Data error: lat value '{0}' is out of bound.", lat));
     43                                        throw new SAXException(tr("Data error: lat value \"{0}\" is out of bound.", lat));
    4444                                if (Math.abs(lon) > 180)
    45                                         throw new SAXException(tr("Data error: lon value '{0}' is out of bound.", lon));
     45                                        throw new SAXException(tr("Data error: lon value \"{0}\" is out of bound.", lon));
    4646                        currentLatLon = new LatLon(lat, lon);
    4747                } catch (NumberFormatException e) {
  • src/org/openstreetmap/josm/test/DateParserTest.java

    r102 r110  
    2525                assertEquals(d2, DateParser.parse("11/23/2001T23:05:42"));
    2626                assertEquals(d2, DateParser.parse("11/23/2001T23:05:42+001"));
     27                assertEquals(d2, DateParser.parse("2001-11-23T23:05:42+01:00"));
    2728        assertEquals(d, DateParser.parse("11/23/2001T23:05:42.123"));
    2829                assertEquals(d, DateParser.parse("11/23/2001T23:05:42.123+001"));
  • src/org/openstreetmap/josm/tools/DateParser.java

    r107 r110  
    66import java.text.SimpleDateFormat;
    77import java.util.Date;
     8import java.util.regex.Matcher;
     9import java.util.regex.Pattern;
    810
    911/**
     
    1719                "yyyy-MM-dd'T'HH:mm:ss'Z'",
    1820                "yyyy-MM-dd'T'HH:mm:ssZ",
     21                "yyyy-MM-dd'T'HH:mm:ss",
     22                "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'",
    1923                "yyyy-MM-dd'T'HH:mm:ss.SSSZ",
    20                 "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'",
    2124                "yyyy-MM-dd HH:mm:ss",
    2225                "MM/dd/yyyy HH:mm:ss",
     26                "MM/dd/yyyy'T'HH:mm:ss.SSS'Z'",
    2327                "MM/dd/yyyy'T'HH:mm:ss.SSSZ",
    24                 "MM/dd/yyyy'T'HH:mm:ss.SSS'Z'",
    2528                "MM/dd/yyyy'T'HH:mm:ss.SSS",
    2629                "MM/dd/yyyy'T'HH:mm:ssZ",
     
    3033       
    3134        public static Date parse(String d) throws ParseException {
     35                // first try to fix ruby's broken xmlschema - format
     36                Matcher m = Pattern.compile("(....-..-..T..:..:..[+-]..):(..)").matcher(d);
     37                if (m.matches())
     38                        d = m.group(1) + m.group(2);
     39
    3240                for (String parse : formats) {
    3341                        SimpleDateFormat sdf = new SimpleDateFormat(parse);
Note: See TracChangeset for help on using the changeset viewer.