- Timestamp:
- 2015-06-01T18:04:14+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
r8435 r8438 421 421 // try to fix common typos and check again if value is still unknown 422 422 String fixedValue = prettifyValue(prop.getValue()); 423 if (values != null && values.contains(fixedValue)) { 423 Map<String, String> possibleValues = getPossibleValues(values); 424 if (possibleValues.containsKey(fixedValue)) { 425 fixedValue = possibleValues.get(fixedValue); 424 426 // misspelled preset value 425 String i = marktr("Value ''{0}'' for key ''{1}'' looks like ''{2} }.");427 String i = marktr("Value ''{0}'' for key ''{1}'' looks like ''{2}''."); 426 428 errors.add(new FixableTestError(this, Severity.WARNING, tr("Misspelled property value"), 427 429 tr(i, prop.getValue(), key, fixedValue), MessageFormat.format(i, prop.getValue(), fixedValue), … … 449 451 } 450 452 } 453 } 454 455 private Map<String, String> getPossibleValues(Set<String> values) { 456 // generate a map with common typos 457 Map<String, String> map = new HashMap<>(); 458 if (values != null) { 459 for (String value : values) { 460 map.put(value, value); 461 if (value.contains("_")) { 462 map.put(value.replace("_", ""), value); 463 } 464 } 465 } 466 return map; 451 467 } 452 468
Note:
See TracChangeset
for help on using the changeset viewer.