Make single-key radio fields translatable like combo fields (close #6878)

This commit is contained in:
Quincy Morgan
2019-09-24 19:27:50 +02:00
parent 8a6fa241df
commit 1371b3cfdc
8 changed files with 76 additions and 24 deletions
+21
View File
@@ -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:
+3 -3
View File
@@ -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"},
+7 -5
View File
@@ -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",
+7 -5
View File
@@ -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",
+7 -5
View File
@@ -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": [
+12 -2
View File
@@ -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)",
+18 -3
View File
@@ -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",
+1 -1
View File
@@ -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 = {};