Changeset 7046 in josm for trunk/src


Ignore:
Timestamp:
2014-05-02T01:40:37+02:00 (6 years ago)
Author:
Don-vip
Message:

see #9923 - update opening_hours.js + translate/shorten a bit error messages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/tests/OpeningHourTest.java

    r7033 r7046  
    205205            }
    206206            for (final Object i : getList(((Invocable) ENGINE).invokeMethod(r, "getErrors"))) {
    207                 errors.add(new OpeningHoursTestError(key + " - " + i.toString().trim(), Severity.ERROR, prettifiedValue));
     207                errors.add(new OpeningHoursTestError(getErrorMessage(key, i), Severity.ERROR, prettifiedValue));
    208208            }
    209209            for (final Object i : getList(((Invocable) ENGINE).invokeMethod(r, "getWarnings"))) {
    210                 errors.add(new OpeningHoursTestError(i.toString().trim(), Severity.WARNING, prettifiedValue));
     210                errors.add(new OpeningHoursTestError(getErrorMessage(key, i), Severity.WARNING, prettifiedValue));
    211211            }
    212212            if (!ignoreOtherSeverity && errors.isEmpty() && prettifiedValue != null && !value.equals(prettifiedValue)) {
     
    217217        }
    218218        return errors;
     219    }
     220   
     221    /**
     222     * Translates and shortens the error/warning message.
     223     */
     224    private String getErrorMessage(String key, Object o) {
     225        String msg = o.toString().trim()
     226        .replace("Unexpected token:", tr("Unexpected token:"))
     227        .replace("Unexpected token (school holiday parser):", tr("Unexpected token (school holiday parser):"))
     228        .replace("Unexpected token in number range:", tr("Unexpected token in number range:"))
     229        .replace("Unexpected token in week range:", tr("Unexpected token in week range:"))
     230        .replace("Unexpected token in weekday range:", tr("Unexpected token in weekday range:"))
     231        .replace("Unexpected token in month range:", tr("Unexpected token in month range:"))
     232        .replace("Unexpected token in year range:", tr("Unexpected token in year range:"))
     233        .replace("This means that the syntax is not valid at that point or it is currently not supported.", tr("Invalid/unsupported syntax."));
     234        return key + " - " + msg;
    219235    }
    220236
Note: See TracChangeset for help on using the changeset viewer.