mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-18 06:35:20 +02:00
Make preset field placeholders translatable
This commit is contained in:
@@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -211,6 +211,7 @@ en:
|
||||
label: Type
|
||||
website:
|
||||
label: Website
|
||||
placeholder: "http://example.com/"
|
||||
wetland:
|
||||
label: Type
|
||||
wheelchair:
|
||||
|
||||
Vendored
+2
-1
@@ -655,7 +655,8 @@
|
||||
"label": "Type"
|
||||
},
|
||||
"website": {
|
||||
"label": "Website"
|
||||
"label": "Website",
|
||||
"placeholder": "http://example.com/"
|
||||
},
|
||||
"wetland": {
|
||||
"label": "Type"
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user