Make preset field placeholders translatable

This commit is contained in:
John Firebaugh
2013-05-28 11:07:28 -07:00
parent 39222caac9
commit 182849cbe6
7 changed files with 19 additions and 6 deletions
+9 -2
View File
@@ -69,10 +69,17 @@ function generateFields() {
validate(file, field, fieldSchema);
translations.fields[id] = {label: field.label};
var t = translations.fields[id] = {
label: field.label
};
if (field.placeholder) {
t.placeholder = field.placeholder;
}
if (field.strings) {
for (var i in field.strings) {
translations.fields[id][i] = field.strings[i];
t[i] = field.strings[i];
}
}
+1
View File
@@ -211,6 +211,7 @@ en:
label: Type
website:
label: Website
placeholder: "http://example.com/"
wetland:
label: Type
wheelchair:
+2 -1
View File
@@ -655,7 +655,8 @@
"label": "Type"
},
"website": {
"label": "Website"
"label": "Website",
"placeholder": "http://example.com/"
},
"wetland": {
"label": "Type"
+4
View File
@@ -15,5 +15,9 @@ iD.presets.Field = function(id, field) {
return field.t('label', {'default': id});
};
field.placeholder = function() {
return field.t('placeholder', {'default': field.placeholder});
};
return field;
};
+1 -1
View File
@@ -14,7 +14,7 @@ iD.ui.preset.url = function(field) {
input.enter().append('input')
.attr('type', field.type)
.attr('id', 'preset-input-' + field.id)
.attr('placeholder', field.placeholder || '');
.attr('placeholder', field.placeholder());
input
.on('blur', change)
+1 -1
View File
@@ -12,7 +12,7 @@ iD.ui.preset.localized = function(field, context) {
.attr('type', 'text')
.attr('id', 'preset-input-' + field.id)
.attr('class', 'localized-main')
.attr('placeholder', field.placeholder || '');
.attr('placeholder', field.placeholder());
input
.on('blur', change)
+1 -1
View File
@@ -9,7 +9,7 @@ iD.ui.preset.textarea = function(field) {
input.enter().append('textarea')
.attr('id', 'preset-input-' + field.id)
.attr('placeholder', field.placeholder || '')
.attr('placeholder', field.placeholder())
.attr('maxlength', 255);
input