diff --git a/data/presets.yaml b/data/presets.yaml index fb3fe21d3..28892c216 100644 --- a/data/presets.yaml +++ b/data/presets.yaml @@ -280,6 +280,13 @@ en: blind: # blind=* label: Blind Person Access + options: + # blind=limited + limited: Limited + # blind=no + 'no': 'No' + # blind=yes + 'yes': 'Yes' # 'terms: sight impairment,vision impairment' terms: '[translate with synonyms or related terms for ''Blind Person Access'', separated by commas]' blood_components: @@ -2150,6 +2157,13 @@ en: stroller: # stroller=* label: Stroller Access + options: + # stroller=limited + limited: Limited + # stroller=no + 'no': 'No' + # stroller=yes + 'yes': 'Yes' # 'terms: baby carriage,perambulator,pram,pushchair' terms: '[translate with synonyms or related terms for ''Stroller Access'', separated by commas]' structure: @@ -2508,6 +2522,13 @@ en: wheelchair: # wheelchair=* label: Wheelchair Access + options: + # wheelchair=limited + limited: Limited + # wheelchair=no + 'no': 'No' + # wheelchair=yes + 'yes': 'Yes' # 'terms: handicap access' terms: '[translate with synonyms or related terms for ''Wheelchair Access'', separated by commas]' wholesale: diff --git a/data/presets/fields.json b/data/presets/fields.json index 30c3a969a..cb149b798 100644 --- a/data/presets/fields.json +++ b/data/presets/fields.json @@ -38,7 +38,7 @@ "bench": {"key": "bench", "type": "check", "label": "Bench", "terms": ["seating"]}, "bicycle_parking": {"key": "bicycle_parking", "type": "combo", "label": "Type"}, "bin": {"key": "bin", "type": "check", "label": "Waste Bin", "terms": ["garbage can", "trash can"]}, - "blind": {"key": "blind", "type": "radio", "options": ["yes", "limited", "no"], "label": "Blind Person Access", "terms": ["sight impairment", "vision impairment"]}, + "blind": {"key": "blind", "type": "radio", "strings": {"options": {"yes": "Yes", "limited": "Limited", "no": "No"}}, "label": "Blind Person Access", "terms": ["sight impairment", "vision impairment"]}, "blood_components": {"key": "blood:", "type": "multiCombo", "label": "Blood Components", "strings": {"options": {"whole": "whole blood", "plasma": "plasma", "platelets": "platelets", "stemcells": "stem cell samples"}}}, "board_type": {"key": "board_type", "type": "typeCombo", "label": "Type"}, "bollard": {"key": "bollard", "type": "combo", "label": "Type"}, @@ -366,7 +366,7 @@ "stile": {"key": "stile", "type": "combo", "label": "Type"}, "stop": {"key": "stop", "type": "combo", "label": "Stop Type", "strings": {"options": {"all": "All Ways", "minor": "Minor Road"}}}, "street_cabinet": {"key": "street_cabinet", "type": "combo", "label": "Type"}, - "stroller": {"key": "stroller", "type": "radio", "options": ["yes", "limited", "no"], "label": "Stroller Access", "terms": ["baby carriage", "perambulator", "pram", "pushchair"]}, + "stroller": {"key": "stroller", "type": "radio", "strings": {"options": {"yes": "Yes", "limited": "Limited", "no": "No"}}, "label": "Stroller Access", "terms": ["baby carriage", "perambulator", "pram", "pushchair"]}, "structure_waterway": {"type": "structureRadio", "keys": ["tunnel"], "label": "Structure", "placeholder": "Unknown", "strings": {"options": {"tunnel": "Tunnel"}}}, "structure": {"type": "structureRadio", "keys": ["bridge", "tunnel", "embankment", "cutting", "ford"], "label": "Structure", "placeholder": "Unknown", "strings": {"options": {"bridge": "Bridge", "tunnel": "Tunnel", "embankment": "Embankment", "cutting": "Cutting", "ford": "Ford"}}}, "studio": {"key": "studio", "type": "combo", "label": "Type"}, @@ -427,7 +427,7 @@ "waterway": {"key": "waterway", "type": "typeCombo", "label": "Type"}, "website": {"key": "website", "type": "url", "icon": "website", "placeholder": "https://example.com", "label": "Website", "terms": ["internet presence", "uri", "url", "webpage"]}, "wetland": {"key": "wetland", "type": "combo", "label": "Type"}, - "wheelchair": {"key": "wheelchair", "type": "radio", "options": ["yes", "limited", "no"], "icon": "maki-wheelchair", "label": "Wheelchair Access", "terms": ["handicap access"]}, + "wheelchair": {"key": "wheelchair", "type": "radio", "strings": {"options": {"yes": "Yes", "limited": "Limited", "no": "No"}}, "icon": "maki-wheelchair", "label": "Wheelchair Access", "terms": ["handicap access"]}, "wholesale": {"key": "wholesale", "type": "typeCombo", "label": "Wholesale"}, "width": {"key": "width", "type": "number", "minValue": 0, "label": "Width (Meters)"}, "wikidata": {"key": "wikidata", "keys": ["wikidata", "wikipedia"], "type": "wikidata", "icon": "wikipedia", "universal": true, "label": "Wikidata"}, diff --git a/data/presets/fields/blind.json b/data/presets/fields/blind.json index f8d168218..0aa46adc8 100644 --- a/data/presets/fields/blind.json +++ b/data/presets/fields/blind.json @@ -1,11 +1,13 @@ { "key": "blind", "type": "radio", - "options": [ - "yes", - "limited", - "no" - ], + "strings": { + "options": { + "yes": "Yes", + "limited": "Limited", + "no": "No" + } + }, "label": "Blind Person Access", "terms": [ "sight impairment", diff --git a/data/presets/fields/stroller.json b/data/presets/fields/stroller.json index cc3535769..122ca4c05 100644 --- a/data/presets/fields/stroller.json +++ b/data/presets/fields/stroller.json @@ -1,11 +1,13 @@ { "key": "stroller", "type": "radio", - "options": [ - "yes", - "limited", - "no" - ], + "strings": { + "options": { + "yes": "Yes", + "limited": "Limited", + "no": "No" + } + }, "label": "Stroller Access", "terms": [ "baby carriage", diff --git a/data/presets/fields/wheelchair.json b/data/presets/fields/wheelchair.json index 8bdf49aae..127042d86 100644 --- a/data/presets/fields/wheelchair.json +++ b/data/presets/fields/wheelchair.json @@ -1,11 +1,13 @@ { "key": "wheelchair", "type": "radio", - "options": [ - "yes", - "limited", - "no" - ], + "strings": { + "options": { + "yes": "Yes", + "limited": "Limited", + "no": "No" + } + }, "icon": "maki-wheelchair", "label": "Wheelchair Access", "terms": [ diff --git a/data/presets/schema/field.json b/data/presets/schema/field.json index f47f55a9c..82dc4e34a 100644 --- a/data/presets/schema/field.json +++ b/data/presets/schema/field.json @@ -109,8 +109,18 @@ "type": "string" }, "strings": { - "description": "Translatable strings options (combo fields)", - "type": "object" + "description": "Strings sent to transifex for translation", + "type": "object", + "properties": { + "options": { + "description": "Translatable options (combo fields)", + "type": "object" + } + }, + "additionalProperties": { + "description": "Specialized fields can request translation of arbitrary strings", + "type": "object" + } }, "snake_case": { "description": "If true, replace spaces with underscores in the tag value (combo fields only)", diff --git a/dist/locales/en.json b/dist/locales/en.json index fd32e03ec..0ea5a681e 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -2694,7 +2694,12 @@ }, "blind": { "label": "Blind Person Access", - "terms": "sight impairment,vision impairment" + "terms": "sight impairment,vision impairment", + "options": { + "yes": "Yes", + "limited": "Limited", + "no": "No" + } }, "blood_components": { "label": "Blood Components", @@ -4486,7 +4491,12 @@ }, "stroller": { "label": "Stroller Access", - "terms": "baby carriage,perambulator,pram,pushchair" + "terms": "baby carriage,perambulator,pram,pushchair", + "options": { + "yes": "Yes", + "limited": "Limited", + "no": "No" + } }, "structure_waterway": { "label": "Structure", @@ -4828,7 +4838,12 @@ }, "wheelchair": { "label": "Wheelchair Access", - "terms": "handicap access" + "terms": "handicap access", + "options": { + "yes": "Yes", + "limited": "Limited", + "no": "No" + } }, "wholesale": { "label": "Wholesale", diff --git a/modules/ui/fields/radio.js b/modules/ui/fields/radio.js index 96d4fdade..3b8bc5a86 100644 --- a/modules/ui/fields/radio.js +++ b/modules/ui/fields/radio.js @@ -15,7 +15,7 @@ export function uiFieldRadio(field, context) { var wrap = d3_select(null); var labels = d3_select(null); var radios = d3_select(null); - var radioData = (field.options || field.keys).slice(); // shallow copy + var radioData = (field.options || (field.strings && field.strings.options && Object.keys(field.strings.options)) || field.keys).slice(); // shallow copy var typeField; var layerField; var _oldType = {};