Ignore:
Timestamp:
2009-08-23T22:37:39+02:00 (15 years ago)
Author:
Gubaer
Message:

fixed #3261: Use the "name:$CURRENT_LOCALE" name in the JOSM UI instead of "name" when it exists
new: new checkbox in LAF preferences for enabling/disabling localized names for primitives

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/Node.java

    r1814 r1990  
    22package org.openstreetmap.josm.data.osm;
    33
    4 import static org.openstreetmap.josm.tools.I18n.tr;
     4import java.util.Locale;
    55
    6 import org.openstreetmap.josm.Main;
    76import org.openstreetmap.josm.data.coor.CachedLatLon;
    87import org.openstreetmap.josm.data.coor.EastNorth;
    98import org.openstreetmap.josm.data.coor.LatLon;
    10 import org.openstreetmap.josm.data.coor.LatLon.CoordinateFormat;
    119import org.openstreetmap.josm.data.osm.visitor.Visitor;
     10import static org.openstreetmap.josm.tools.I18n.tr;
    1211
    1312/**
     
    5049    }
    5150
    52     private static CoordinateFormat mCord;
    5351
    54     static public CoordinateFormat getCoordinateFormat()
    55     {
    56         return mCord;
    57     }
    58 
    59     static public void setCoordinateFormat()
    60     {
    61         try {
    62             mCord = LatLon.CoordinateFormat.valueOf(Main.pref.get("coordinates"));
    63         } catch (IllegalArgumentException iae) {
    64             mCord = LatLon.CoordinateFormat.DECIMAL_DEGREES;
    65         }
    66     }
    67 
    68     static {
    69         setCoordinateFormat();
    70     }
    7152
    7253    /**
     
    127108
    128109    @Override
     110    public String getDisplayName(NameFormatter formatter) {
     111        return formatter.format(this);
     112    }
     113
     114    @Override
    129115    public String getName() {
    130         String name;
    131         if (incomplete) {
    132             name = tr("incomplete");
    133         } else {
    134             name = get("name");
    135             if (name == null) {
    136                 name = id == 0 ? tr("node") : ""+id;
    137             }
    138             name += " (" + coor.latToString(mCord) + ", " + coor.lonToString(mCord) + ")";
    139         }
    140         return name;
     116        String name = super.getName();
     117        if (name != null)
     118            return name;
     119        // no translation
     120        return "node " + id;
     121    }
     122
     123    @Override
     124    public String getLocalName(){
     125        String name = super.getLocalName();
     126        if (name != null)
     127            return name;
     128        return tr("node {0}",id);
    141129    }
    142130}
Note: See TracChangeset for help on using the changeset viewer.