mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-20 07:25:15 +02:00
Localize preset form labels
This commit is contained in:
@@ -1 +1 @@
|
||||
{"access":{"key":"access","type":"combo"},"address":{"type":"address","title":"Address","keys":["addr:housename","addr:housenumber","addr:street","addr:city"]},"atm":{"key":"atm","type":"check"},"building":{"key":"building","type":"combo"},"building_area":{"key":"building","type":"check","default":{"area":"yes"}},"building_yes":{"key":"building","type":"combo","default":{"area":"yes"}},"capacity":{"key":"capacity","type":"text"},"cuisine":{"key":"cuisine","type":"combo","indexed":true},"denomination":{"key":"denomination","type":"combo"},"elevation":{"key":"ele","type":"number"},"emergency":{"key":"emergency","type":"check"},"fee":{"key":"fee","type":"check"},"internet_access":{"key":"internet_access","title":"Internet Access","type":"combo","options":["yes","no","wlan","wired","terminal"]},"layer":{"key":"layer","type":"combo"},"levels":{"key":"building:levels","type":"number","title":"Levels"},"maxspeed":{"key":"maxspeed","type":"combo"},"network":{"key":"network","type":"text"},"oneway":{"key":"oneway","type":"check"},"opening_hours":{"key":"opening_hours","type":"text"},"operator":{"key":"operator","type":"text"},"religion":{"key":"religion","type":"combo","options":["christian","muslim","buddhist","jewish","hindu","shinto","taoist"]},"roadtype":{"title":" ","type":"radio","options":["bridge","tunnel","embankment","cutting"]},"shelter":{"key":"shelter","type":"check"},"surface":{"key":"surface","type":"combo"}}
|
||||
{"access":{"key":"access","type":"combo"},"address":{"type":"address","keys":["addr:housename","addr:housenumber","addr:street","addr:city"]},"atm":{"key":"atm","type":"check"},"building":{"key":"building","type":"combo"},"building_area":{"key":"building","type":"check","default":{"area":"yes"}},"building_yes":{"key":"building","type":"combo","default":{"area":"yes"}},"capacity":{"key":"capacity","type":"text"},"cuisine":{"key":"cuisine","type":"combo","indexed":true},"denomination":{"key":"denomination","type":"combo"},"elevation":{"key":"ele","type":"number"},"emergency":{"key":"emergency","type":"check"},"fee":{"key":"fee","type":"check"},"internet_access":{"key":"internet_access","type":"combo","options":["yes","no","wlan","wired","terminal"]},"layer":{"key":"layer","type":"combo"},"levels":{"key":"building:levels","type":"number"},"maxspeed":{"key":"maxspeed","type":"combo"},"network":{"key":"network","type":"text"},"oneway":{"key":"oneway","type":"check"},"opening_hours":{"key":"opening_hours","type":"text"},"operator":{"key":"operator","type":"text"},"religion":{"key":"religion","type":"combo","options":["christian","muslim","buddhist","jewish","hindu","shinto","taoist"]},"roadtype":{"title":" ","type":"radio","options":["bridge","tunnel","embankment","cutting"]},"shelter":{"key":"shelter","type":"check"},"surface":{"key":"surface","type":"combo"}}
|
||||
@@ -1,6 +1,5 @@
|
||||
{
|
||||
"type": "address",
|
||||
"title": "Address",
|
||||
"keys": [
|
||||
"addr:housename",
|
||||
"addr:housenumber",
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
{
|
||||
"key": "internet_access",
|
||||
"title": "Internet Access",
|
||||
"type": "combo",
|
||||
"options": [
|
||||
"yes",
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
{
|
||||
"key": "building:levels",
|
||||
"type": "number",
|
||||
"title": "Levels"
|
||||
"type": "number"
|
||||
}
|
||||
@@ -166,6 +166,7 @@
|
||||
<script src='js/id/presets/preset.js'></script>
|
||||
<script src='js/id/presets/category.js'></script>
|
||||
<script src='js/id/presets/collection.js'></script>
|
||||
<script src='js/id/presets/form.js'></script>
|
||||
|
||||
<script src='js/id/connection.js'></script>
|
||||
<script src='js/id/validate.js'></script>
|
||||
|
||||
+3
-1
@@ -20,7 +20,9 @@ iD.presets = function(context) {
|
||||
all.load = function(d) {
|
||||
|
||||
if (d.forms) {
|
||||
forms = d.forms;
|
||||
_.forEach(d.forms, function(d, id) {
|
||||
forms[id] = iD.presets.Form(d, id);
|
||||
});
|
||||
}
|
||||
|
||||
if (d.presets) {
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
iD.presets.Form = function(form, id) {
|
||||
form = _.clone(form);
|
||||
|
||||
form.label = function() {
|
||||
return t('presets.forms.' + id + '.label', {default: form.key});
|
||||
};
|
||||
|
||||
return form;
|
||||
};
|
||||
@@ -7,7 +7,7 @@ iD.presets.Preset = function(preset, forms) {
|
||||
if (typeof f === 'string') {
|
||||
return forms[f];
|
||||
} else {
|
||||
return f;
|
||||
return iD.presets.Form(f, f.key);
|
||||
}
|
||||
}) : [];
|
||||
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ iD.ui.preset = function(context) {
|
||||
.attr('class', 'col3 preset-label')
|
||||
.append('h4')
|
||||
.attr('for', 'input-' + d.key)
|
||||
.text(d.title || d.key);
|
||||
.text(function(d) { return d.label(); });
|
||||
|
||||
input.call(wrap.append('div')
|
||||
.attr('class', 'col9 preset-input'), d);
|
||||
|
||||
@@ -18,6 +18,8 @@ function t(s, o, loc) {
|
||||
if (rep !== undefined) {
|
||||
if (o) for (var k in o) rep = rep.replace('{' + k + '}', o[k]);
|
||||
return rep;
|
||||
} else if (o.default) {
|
||||
return o.default;
|
||||
} else {
|
||||
var missing = 'Missing translation: ' + s;
|
||||
if (console) console.error(missing);
|
||||
|
||||
+100
@@ -239,5 +239,105 @@ locale.en = {
|
||||
zoom: {
|
||||
'in': "Zoom In",
|
||||
out: "Zoom Out"
|
||||
},
|
||||
|
||||
// We expect these to be extracted at some point.
|
||||
"presets": {
|
||||
"forms": {
|
||||
"access": {
|
||||
"label": "Access"
|
||||
},
|
||||
"address": {
|
||||
"label": "Address"
|
||||
},
|
||||
"atm": {
|
||||
"label": "ATM"
|
||||
},
|
||||
"building": {
|
||||
"label": "Building"
|
||||
},
|
||||
"building_area": {
|
||||
"label": "Building"
|
||||
},
|
||||
"building_yes": {
|
||||
"label": "Building"
|
||||
},
|
||||
"capacity": {
|
||||
"label": "Capacity"
|
||||
},
|
||||
"cuisine": {
|
||||
"label": "Cuisine"
|
||||
},
|
||||
"denomination": {
|
||||
"label": "Denomination"
|
||||
},
|
||||
"elevation": {
|
||||
"label": "Elevation"
|
||||
},
|
||||
"emergency": {
|
||||
"label": "Emergency"
|
||||
},
|
||||
"fee": {
|
||||
"label": "Fee"
|
||||
},
|
||||
"internet_access": {
|
||||
"label": "Internet Access",
|
||||
"options": {
|
||||
"yes": "Yes",
|
||||
"no": "No",
|
||||
"wlan": "Wifi",
|
||||
"wired": "Wired",
|
||||
"terminal": "Terminal"
|
||||
}
|
||||
},
|
||||
"layer": {
|
||||
"label": "Layer"
|
||||
},
|
||||
"levels": {
|
||||
"label": "Levels"
|
||||
},
|
||||
"maxspeed": {
|
||||
"label": "Speed Limit"
|
||||
},
|
||||
"network": {
|
||||
"label": "Network"
|
||||
},
|
||||
"oneway": {
|
||||
"label": "One Way"
|
||||
},
|
||||
"opening_hours": {
|
||||
"label": "Hours"
|
||||
},
|
||||
"operator": {
|
||||
"label": "Operator"
|
||||
},
|
||||
"religion": {
|
||||
"label": "Religion",
|
||||
"options": {
|
||||
"christian": "Christian",
|
||||
"muslim": "Muslim",
|
||||
"buddhist": "Buddhist",
|
||||
"jewish": "Jewish",
|
||||
"hindu": "Hindu",
|
||||
"shinto": "Shinto",
|
||||
"taoist": "Taoist"
|
||||
}
|
||||
},
|
||||
"roadtype": {
|
||||
"label": "Road Type",
|
||||
"options": {
|
||||
"bridge": "Bridge",
|
||||
"tunnel": "Tunnel",
|
||||
"embankment": "Embankment",
|
||||
"cutting": "Cutting"
|
||||
}
|
||||
},
|
||||
"shelter": {
|
||||
"label": "Shelter"
|
||||
},
|
||||
"surface": {
|
||||
"label": "Surface"
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user