mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 21:48:20 +02:00
Fix field placeholders
This commit is contained in:
@@ -15,8 +15,9 @@ iD.presets.Field = function(id, field) {
|
||||
return field.t('label', {'default': id});
|
||||
};
|
||||
|
||||
var placeholder = field.placeholder;
|
||||
field.placeholder = function() {
|
||||
return field.t('placeholder', {'default': field.placeholder});
|
||||
return field.t('placeholder', {'default': placeholder});
|
||||
};
|
||||
|
||||
return field;
|
||||
|
||||
+16
-5
@@ -19,10 +19,21 @@ function t(s, o, loc) {
|
||||
if (o) for (var k in o) rep = rep.replace('{' + k + '}', o[k]);
|
||||
return rep;
|
||||
} else {
|
||||
var missing = 'Missing translation: ' + s;
|
||||
if (typeof console !== "undefined") console.error(missing);
|
||||
if (loc !== 'en') return t(s, o, 'en');
|
||||
if (o && 'default' in o) return o['default'];
|
||||
return missing;
|
||||
function missing() {
|
||||
var missing = 'Missing ' + loc + ' translation: ' + s;
|
||||
if (typeof console !== "undefined") console.error(missing);
|
||||
return missing;
|
||||
}
|
||||
|
||||
if (loc !== 'en') {
|
||||
missing();
|
||||
return t(s, o, 'en');
|
||||
}
|
||||
|
||||
if (o && 'default' in o) {
|
||||
return o['default'];
|
||||
}
|
||||
|
||||
return missing();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user