Changeset 14174 in josm for trunk/src/org
- Timestamp:
- 2018-08-21T02:00:41+02:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesCellRenderer.java
r13809 r14174 10 10 import java.awt.Font; 11 11 import java.util.Collection; 12 import java.util.Locale; 12 13 import java.util.Map; 13 14 import java.util.Objects; 14 15 import java.util.Optional; 15 16 import java.util.concurrent.CopyOnWriteArrayList; 17 import java.util.regex.Matcher; 18 import java.util.regex.Pattern; 16 19 17 20 import javax.swing.JLabel; … … 40 43 private static final CachingProperty<Boolean> DISCARDABLE 41 44 = new BooleanProperty("display.discardable-keys", false).cached(); 45 46 // Matches ISO-639 two and three letters language codes 47 private static final Pattern LANGUAGE_NAMES = Pattern.compile("name:(\\p{Lower}{2,3})"); 42 48 43 49 static { … … 111 117 } 112 118 } 119 if (column == 0 && str != null) { 120 Matcher m = LANGUAGE_NAMES.matcher(str); 121 if (m.matches()) { 122 String code = m.group(1); 123 String label = new Locale(code).getDisplayLanguage(); 124 if (!code.equals(label)) { 125 str = new StringBuilder(str).append(" <").append(label).append('>').toString(); 126 } 127 } 128 } 113 129 ((JLabel) c).putClientProperty("html.disable", Boolean.TRUE); // Fix #8730 114 130 ((JLabel) c).setText(str);
Note:
See TracChangeset
for help on using the changeset viewer.