Implement a schema for the measurement field #198
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #15
Here's a concrete proposal for the
measurementfield. Every measurement field needs to definedimension,usage, andunits. See discussion in #15.For
units, the keys are the IDs used by CLDR. The value(s) are the the units that are used in the OSM tag.{ "key": "maxspeed", "label": "Speed Limit", "placeholder": "40, 50, 60...", "type": "measurement", "measurement": { "dimension": "speed", "usage": "default", "units": { "kilometer-per-hour": [""], "mile-per-hour": ["mph"], "knot": ["kt", "kn"] } } }This implementation is a bit complicated because:
dimension,usage, and the keys ofunitsare valid, usingcldr-corecldr-units-full.The generated
dist/translations/*.jsonfiles now contain a new property calledunits:// es.min.json { "presets": { … }, + "units": { + "speed": { + "kilometer-per-hour": { "long": "kilómetros por hora", "narrow": "km/h" }, + "mile-per-hour": { "long": "millas por hora", "narrow": "mi/h" }, + "knot": { "long": "nudos", "narrow": "kn" } + } + } }The PR does not implement any logic to extract the default values per region, because it's not yet clear where this data should be stored.