Changeset 7305 in josm for trunk/src/org
- Timestamp:
- 2014-07-12T16:48:46+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java
r7187 r7305 7 7 import static org.openstreetmap.josm.tools.I18n.trn; 8 8 9 import java.awt.ComponentOrientation; 9 10 import java.util.ArrayList; 10 11 import java.util.Arrays; … … 15 16 import java.util.LinkedList; 16 17 import java.util.List; 18 import java.util.Locale; 17 19 import java.util.Map; 18 20 import java.util.Set; … … 220 222 public String format(Way way) { 221 223 StringBuilder name = new StringBuilder(); 224 225 char mark = 0; 226 // If current language is left-to-right (almost all languages) 227 if (ComponentOrientation.getOrientation(Locale.getDefault()).isLeftToRight()) { 228 // will insert Left-To-Right Mark to ensure proper display of text in the case when object name is right-to-left 229 mark = '\u200E'; 230 } else { 231 // otherwise will insert Right-To-Left Mark to ensure proper display in the opposite case 232 mark = '\u200F'; 233 } 234 // Initialize base direction of the string 235 name.append(mark); 236 222 237 if (way.isIncomplete()) { 223 238 name.append(tr("incomplete")); … … 235 250 } 236 251 if (n == null) { 237 n = 238 (way.get("highway") != null) ? tr("highway") : 252 n = (way.get("highway") != null) ? tr("highway") : 239 253 (way.get("railway") != null) ? tr("railway") : 240 254 (way.get("waterway") != null) ? tr("waterway") : 241 255 (way.get("landuse") != null) ? tr("landuse") : null; 242 256 } 243 if(n == null) 244 { 257 if (n == null) { 245 258 String s; 246 259 if((s = way.get("addr:housename")) != null) { … … 276 289 /* I18n: count of nodes as parameter */ 277 290 String nodes = trn("{0} node", "{0} nodes", nodesNo, nodesNo); 278 name.append( " (").append(nodes).append(")");291 name.append(mark).append(" (").append(nodes).append(")"); 279 292 } 280 293 decorateNameWithId(name, way);
Note:
See TracChangeset
for help on using the changeset viewer.