function displayLength(m, isImperial) {
    var d = m * (isImperial ? 3.28084 : 1);
    var unit;

    if (isImperial) {
        if (d >= 5280) {
            d /= 5280;
            unit = 'miles';
        } else {
            unit = 'feet';
        }
    } else {
        if (d >= 1000) {
            d /= 1000;
            unit = 'kilometers';
        } else {
            unit = 'meters';
        }
    }

    return t('units.' + unit, {
        quantity: d.toLocaleString(localizer.localeCode(), {
            maximumSignificantDigits: 4
        })
    });
}
Returns a localized representation of the given length measurement.

@param {Number} m area in meters
@param {Boolean} isImperial true for U.S. customary units; false for metric