mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-23 08:39:56 +02:00
Revert t function to returning the plain string by default
Add `t.html` function for getting the string with the `lang` attribute
This commit is contained in:
@@ -40,7 +40,7 @@ export function uiFieldAccess(field, context) {
|
||||
.append('span')
|
||||
.attr('class', 'label preset-label-access')
|
||||
.attr('for', function(d) { return 'preset-input-access-' + d; })
|
||||
.html(function(d) { return field.t('types.' + d); });
|
||||
.html(function(d) { return field.t.html('types.' + d); });
|
||||
|
||||
enter
|
||||
.append('div')
|
||||
@@ -217,7 +217,7 @@ export function uiFieldAccess(field, context) {
|
||||
})
|
||||
.attr('placeholder', function(d) {
|
||||
if (tags[d] && Array.isArray(tags[d])) {
|
||||
return t('inspector.multiple_values', { html: false });
|
||||
return t('inspector.multiple_values');
|
||||
}
|
||||
if (d === 'access') {
|
||||
return 'yes';
|
||||
|
||||
@@ -274,12 +274,12 @@ export function uiFieldAddress(field, context) {
|
||||
function updatePlaceholder(inputSelection) {
|
||||
return inputSelection.attr('placeholder', function(subfield) {
|
||||
if (_tags && Array.isArray(_tags[field.key + ':' + subfield.id])) {
|
||||
return t('inspector.multiple_values', { html: false });
|
||||
return t('inspector.multiple_values');
|
||||
}
|
||||
if (_countryCode) {
|
||||
var localkey = subfield.id + '!' + _countryCode;
|
||||
var tkey = addrField.strings.placeholders[localkey] ? localkey : subfield.id;
|
||||
return addrField.t('placeholders.' + tkey, { html: false });
|
||||
return addrField.t('placeholders.' + tkey);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ export function uiFieldCheck(field, context) {
|
||||
var icon = pseudoDirection ? '#iD-icon-forward' : '#iD-icon-backward';
|
||||
|
||||
selection.selectAll('.reverser-span')
|
||||
.html(t('inspector.check.reverser'))
|
||||
.html(t.html('inspector.check.reverser'))
|
||||
.call(svgIcon(icon, 'inline'));
|
||||
|
||||
return selection;
|
||||
@@ -212,7 +212,7 @@ export function uiFieldCheck(field, context) {
|
||||
.property('checked', isChecked(_value));
|
||||
|
||||
text
|
||||
.html(isMixed ? t('inspector.multiple_values') : textFor(_value))
|
||||
.html(isMixed ? t.html('inspector.multiple_values') : textFor(_value))
|
||||
.classed('mixed', isMixed);
|
||||
|
||||
label
|
||||
|
||||
@@ -147,7 +147,7 @@ export function uiFieldCombo(field, context) {
|
||||
|
||||
if (_optstrings) {
|
||||
_comboData = Object.keys(_optstrings).map(function(k) {
|
||||
var v = field.t('options.' + k, { 'default': _optstrings[k], html: false });
|
||||
var v = field.t('options.' + k, { 'default': _optstrings[k] });
|
||||
return {
|
||||
key: k,
|
||||
value: v,
|
||||
@@ -240,7 +240,7 @@ export function uiFieldCombo(field, context) {
|
||||
function setPlaceholder(values) {
|
||||
|
||||
if (_isMulti || _isSemi) {
|
||||
_staticPlaceholder = field.placeholder() || t('inspector.add', { html: false });
|
||||
_staticPlaceholder = field.placeholder() || t('inspector.add');
|
||||
} else {
|
||||
var vals = values
|
||||
.map(function(d) { return d.value; })
|
||||
@@ -256,7 +256,7 @@ export function uiFieldCombo(field, context) {
|
||||
|
||||
var ph;
|
||||
if (!_isMulti && !_isSemi && _tags && Array.isArray(_tags[field.key])) {
|
||||
ph = t('inspector.multiple_values', { html: false });
|
||||
ph = t('inspector.multiple_values');
|
||||
} else {
|
||||
ph = _staticPlaceholder;
|
||||
}
|
||||
@@ -530,7 +530,7 @@ export function uiFieldCombo(field, context) {
|
||||
return d.isMixed;
|
||||
})
|
||||
.attr('title', function(d) {
|
||||
return d.isMixed ? t('inspector.unshared_value_tooltip', { html: false }) : null;
|
||||
return d.isMixed ? t('inspector.unshared_value_tooltip') : null;
|
||||
});
|
||||
|
||||
if (allowDragAndDrop) {
|
||||
@@ -554,7 +554,7 @@ export function uiFieldCombo(field, context) {
|
||||
|
||||
utilGetSetValue(_input, !isMixed ? displayValue(tags[field.key]) : '')
|
||||
.attr('title', isMixed ? mixedValues.join('\n') : undefined)
|
||||
.attr('placeholder', isMixed ? t('inspector.multiple_values', { html: false }) : _staticPlaceholder || '')
|
||||
.attr('placeholder', isMixed ? t('inspector.multiple_values') : _staticPlaceholder || '')
|
||||
.classed('mixed', isMixed);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -49,7 +49,7 @@ export function uiFieldCycleway(field, context) {
|
||||
.append('span')
|
||||
.attr('class', 'label preset-label-cycleway')
|
||||
.attr('for', function(d) { return 'preset-input-cycleway-' + stripcolon(d); })
|
||||
.html(function(d) { return field.t('types.' + d); });
|
||||
.html(function(d) { return field.t.html('types.' + d); });
|
||||
|
||||
enter
|
||||
.append('div')
|
||||
@@ -149,7 +149,7 @@ export function uiFieldCycleway(field, context) {
|
||||
})
|
||||
.attr('placeholder', function(d) {
|
||||
if (Array.isArray(tags.cycleway) || Array.isArray(tags[d])) {
|
||||
return t('inspector.multiple_values', { html: false });
|
||||
return t('inspector.multiple_values');
|
||||
}
|
||||
return field.placeholder();
|
||||
})
|
||||
|
||||
@@ -111,7 +111,7 @@ export function uiFieldText(field, context) {
|
||||
var domainResults = /^https?:\/\/(.{1,}?)\//.exec(field.urlFormat);
|
||||
if (domainResults.length >= 2 && domainResults[1]) {
|
||||
var domain = domainResults[1];
|
||||
return t('icons.view_on', { domain: domain, html: false });
|
||||
return t('icons.view_on', { domain: domain });
|
||||
}
|
||||
return '';
|
||||
})
|
||||
@@ -200,7 +200,7 @@ export function uiFieldText(field, context) {
|
||||
|
||||
utilGetSetValue(input, !isMixed && tags[field.key] ? tags[field.key] : '')
|
||||
.attr('title', isMixed ? tags[field.key].filter(Boolean).join('\n') : undefined)
|
||||
.attr('placeholder', isMixed ? t('inspector.multiple_values', { html: false }) : (field.placeholder() || t('inspector.unknown', { html: false })))
|
||||
.attr('placeholder', isMixed ? t('inspector.multiple_values') : (field.placeholder() || t('inspector.unknown')))
|
||||
.classed('mixed', isMixed);
|
||||
|
||||
if (outlinkButton && !outlinkButton.empty()) {
|
||||
|
||||
@@ -512,7 +512,7 @@ export function uiFieldLocalized(field, context) {
|
||||
text
|
||||
.append('span')
|
||||
.attr('class', 'label-textvalue')
|
||||
.html(t('translate.localized_translation_label'));
|
||||
.html(t.html('translate.localized_translation_label'));
|
||||
|
||||
text
|
||||
.append('span')
|
||||
@@ -543,7 +543,7 @@ export function uiFieldLocalized(field, context) {
|
||||
.attr('class', 'localized-lang')
|
||||
.attr('id', domId)
|
||||
.attr('type', 'text')
|
||||
.attr('placeholder', t('translate.localized_translation_language', { html: false }))
|
||||
.attr('placeholder', t('translate.localized_translation_language'))
|
||||
.on('blur', changeLang)
|
||||
.on('change', changeLang)
|
||||
.call(langCombo);
|
||||
@@ -590,7 +590,7 @@ export function uiFieldLocalized(field, context) {
|
||||
return Array.isArray(d.value) ? d.value.filter(Boolean).join('\n') : null;
|
||||
})
|
||||
.attr('placeholder', function(d) {
|
||||
return Array.isArray(d.value) ? t('inspector.multiple_values', { html: false }) : t('translate.localized_translation_name', { html: false });
|
||||
return Array.isArray(d.value) ? t('inspector.multiple_values') : t('translate.localized_translation_name');
|
||||
})
|
||||
.classed('mixed', function(d) {
|
||||
return Array.isArray(d.value);
|
||||
@@ -617,7 +617,7 @@ export function uiFieldLocalized(field, context) {
|
||||
|
||||
utilGetSetValue(input, typeof tags[field.key] === 'string' ? tags[field.key] : '')
|
||||
.attr('title', isMixed ? tags[field.key].filter(Boolean).join('\n') : undefined)
|
||||
.attr('placeholder', isMixed ? t('inspector.multiple_values', { html: false }) : field.placeholder())
|
||||
.attr('placeholder', isMixed ? t('inspector.multiple_values') : field.placeholder())
|
||||
.classed('mixed', isMixed);
|
||||
|
||||
calcMultilingual(tags);
|
||||
|
||||
@@ -129,7 +129,7 @@ export function uiFieldMaxspeed(field, context) {
|
||||
|
||||
utilGetSetValue(input, typeof value === 'string' ? value : '')
|
||||
.attr('title', isMixed ? value.filter(Boolean).join('\n') : null)
|
||||
.attr('placeholder', isMixed ? t('inspector.multiple_values', { html: false }) : field.placeholder())
|
||||
.attr('placeholder', isMixed ? t('inspector.multiple_values') : field.placeholder())
|
||||
.classed('mixed', isMixed);
|
||||
};
|
||||
|
||||
|
||||
@@ -59,12 +59,12 @@ export function uiFieldRadio(field, context) {
|
||||
.append('input')
|
||||
.attr('type', 'radio')
|
||||
.attr('name', field.id)
|
||||
.attr('value', function(d) { return field.t('options.' + d, { 'default': d, html: false }); })
|
||||
.attr('value', function(d) { return field.t('options.' + d, { 'default': d }); })
|
||||
.attr('checked', false);
|
||||
|
||||
enter
|
||||
.append('span')
|
||||
.html(function(d) { return field.t('options.' + d, { 'default': d }); });
|
||||
.html(function(d) { return field.t.html('options.' + d, { 'default': d }); });
|
||||
|
||||
labels = labels
|
||||
.merge(enter);
|
||||
@@ -129,7 +129,7 @@ export function uiFieldRadio(field, context) {
|
||||
.append('span')
|
||||
.attr('class', 'label structure-label-type')
|
||||
.attr('for', 'preset-input-' + selected)
|
||||
.html(t('inspector.radio.structure.type'));
|
||||
.html(t.html('inspector.radio.structure.type'));
|
||||
|
||||
typeEnter
|
||||
.append('div')
|
||||
@@ -174,7 +174,7 @@ export function uiFieldRadio(field, context) {
|
||||
.append('span')
|
||||
.attr('class', 'label structure-label-layer')
|
||||
.attr('for', 'preset-input-layer')
|
||||
.html(t('inspector.radio.structure.layer'));
|
||||
.html(t.html('inspector.radio.structure.layer'));
|
||||
|
||||
layerEnter
|
||||
.append('div')
|
||||
@@ -290,14 +290,14 @@ export function uiFieldRadio(field, context) {
|
||||
})
|
||||
.classed('mixed', isMixed)
|
||||
.attr('title', function(d) {
|
||||
return isMixed(d) ? t('inspector.unshared_value_tooltip', { html: false }) : null;
|
||||
return isMixed(d) ? t('inspector.unshared_value_tooltip') : null;
|
||||
});
|
||||
|
||||
|
||||
var selection = radios.filter(function() { return this.checked; });
|
||||
|
||||
if (selection.empty()) {
|
||||
placeholder.html(t('inspector.none'));
|
||||
placeholder.html(t.html('inspector.none'));
|
||||
} else {
|
||||
placeholder.html(selection.attr('value'));
|
||||
_oldType[selection.datum()] = tags[selection.datum()];
|
||||
|
||||
@@ -124,7 +124,7 @@ export function uiFieldRestrictions(field, context) {
|
||||
distControlEnter
|
||||
.append('span')
|
||||
.attr('class', 'restriction-control-label restriction-distance-label')
|
||||
.html(t('restriction.controls.distance') + ':');
|
||||
.html(t.html('restriction.controls.distance') + ':');
|
||||
|
||||
distControlEnter
|
||||
.append('input')
|
||||
@@ -167,7 +167,7 @@ export function uiFieldRestrictions(field, context) {
|
||||
viaControlEnter
|
||||
.append('span')
|
||||
.attr('class', 'restriction-control-label restriction-via-way-label')
|
||||
.html(t('restriction.controls.via') + ':');
|
||||
.html(t.html('restriction.controls.via') + ':');
|
||||
|
||||
viaControlEnter
|
||||
.append('input')
|
||||
@@ -487,7 +487,7 @@ export function uiFieldRestrictions(field, context) {
|
||||
var clickSelect = (!_fromWayID || _fromWayID !== way.id);
|
||||
help
|
||||
.append('div') // "Click to select FROM {fromName}." / "FROM {fromName}"
|
||||
.html(t('restriction.help.' + (clickSelect ? 'select_from_name' : 'from_name'), {
|
||||
.html(t.html('restriction.help.' + (clickSelect ? 'select_from_name' : 'from_name'), {
|
||||
from: placeholders.from,
|
||||
fromName: displayName(way.id, vgraph)
|
||||
}));
|
||||
@@ -521,7 +521,7 @@ export function uiFieldRestrictions(field, context) {
|
||||
|
||||
help
|
||||
.append('div') // "FROM {fromName} TO {toName}"
|
||||
.html(t('restriction.help.from_name_to_name', {
|
||||
.html(t.html('restriction.help.from_name_to_name', {
|
||||
from: placeholders.from,
|
||||
fromName: displayName(datum.from.way, vgraph),
|
||||
to: placeholders.to,
|
||||
@@ -539,7 +539,7 @@ export function uiFieldRestrictions(field, context) {
|
||||
|
||||
help
|
||||
.append('div') // "VIA {viaNames}"
|
||||
.html(t('restriction.help.via_names', {
|
||||
.html(t.html('restriction.help.via_names', {
|
||||
via: placeholders.via,
|
||||
viaNames: names.join(', ')
|
||||
}));
|
||||
@@ -548,7 +548,7 @@ export function uiFieldRestrictions(field, context) {
|
||||
if (!indirect) {
|
||||
help
|
||||
.append('div') // Click for "No Right Turn"
|
||||
.html(t('restriction.help.toggle', { turn: nextText.trim() }));
|
||||
.html(t.html('restriction.help.toggle', { turn: nextText.trim() }));
|
||||
}
|
||||
|
||||
highlightPathsFrom(null);
|
||||
@@ -566,7 +566,7 @@ export function uiFieldRestrictions(field, context) {
|
||||
if (_fromWayID) {
|
||||
help
|
||||
.append('div') // "FROM {fromName}"
|
||||
.html(t('restriction.help.from_name', {
|
||||
.html(t.html('restriction.help.from_name', {
|
||||
from: placeholders.from,
|
||||
fromName: displayName(_fromWayID, vgraph)
|
||||
}));
|
||||
@@ -574,7 +574,7 @@ export function uiFieldRestrictions(field, context) {
|
||||
} else {
|
||||
help
|
||||
.append('div') // "Click to select a FROM segment."
|
||||
.html(t('restriction.help.select_from', {
|
||||
.html(t.html('restriction.help.select_from', {
|
||||
from: placeholders.from
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ export function uiFieldTextarea(field, context) {
|
||||
|
||||
utilGetSetValue(input, !isMixed && tags[field.key] ? tags[field.key] : '')
|
||||
.attr('title', isMixed ? tags[field.key].filter(Boolean).join('\n') : undefined)
|
||||
.attr('placeholder', isMixed ? t('inspector.multiple_values', { html: false }) : (field.placeholder() || t('inspector.unknown', { html: false })))
|
||||
.attr('placeholder', isMixed ? t('inspector.multiple_values') : (field.placeholder() || t('inspector.unknown')))
|
||||
.classed('mixed', isMixed);
|
||||
};
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ export function uiFieldWikidata(field, context) {
|
||||
searchRowEnter
|
||||
.append('button')
|
||||
.attr('class', 'form-field-button wiki-link')
|
||||
.attr('title', t('icons.view_on', { domain: 'wikidata.org', html: false }))
|
||||
.attr('title', t('icons.view_on', { domain: 'wikidata.org' }))
|
||||
.call(svgIcon('#iD-icon-out-link'))
|
||||
.on('click', function() {
|
||||
d3_event.preventDefault();
|
||||
@@ -117,7 +117,7 @@ export function uiFieldWikidata(field, context) {
|
||||
enter
|
||||
.append('span')
|
||||
.attr('class', 'label')
|
||||
.html(function(d) { return t('wikidata.' + d); });
|
||||
.html(function(d) { return t.html('wikidata.' + d); });
|
||||
|
||||
enter
|
||||
.append('input')
|
||||
@@ -129,7 +129,7 @@ export function uiFieldWikidata(field, context) {
|
||||
enter
|
||||
.append('button')
|
||||
.attr('class', 'form-field-button')
|
||||
.attr('title', t('icons.copy', { html: false }))
|
||||
.attr('title', t('icons.copy'))
|
||||
.call(svgIcon('#iD-operation-copy'))
|
||||
.on('click', function() {
|
||||
d3_event.preventDefault();
|
||||
@@ -290,7 +290,7 @@ export function uiFieldWikidata(field, context) {
|
||||
var isMixed = Array.isArray(tags[field.key]);
|
||||
_searchInput
|
||||
.attr('title', isMixed ? tags[field.key].filter(Boolean).join('\n') : null)
|
||||
.attr('placeholder', isMixed ? t('inspector.multiple_values', { html: false }) : '')
|
||||
.attr('placeholder', isMixed ? t('inspector.multiple_values') : '')
|
||||
.classed('mixed', isMixed);
|
||||
|
||||
_qid = typeof tags[field.key] === 'string' && tags[field.key] || '';
|
||||
|
||||
@@ -87,7 +87,7 @@ export function uiFieldWikipedia(field, context) {
|
||||
.append('input')
|
||||
.attr('type', 'text')
|
||||
.attr('class', 'wiki-lang')
|
||||
.attr('placeholder', t('translate.localized_translation_language', { html: false }))
|
||||
.attr('placeholder', t('translate.localized_translation_language'))
|
||||
.call(utilNoAuto)
|
||||
.call(langCombo)
|
||||
.merge(_langInput);
|
||||
@@ -128,7 +128,7 @@ export function uiFieldWikipedia(field, context) {
|
||||
link = link.enter()
|
||||
.append('button')
|
||||
.attr('class', 'form-field-button wiki-link')
|
||||
.attr('title', t('icons.view_on', { domain: 'wikipedia.org', html: false }))
|
||||
.attr('title', t('icons.view_on', { domain: 'wikipedia.org' }))
|
||||
.call(svgIcon('#iD-icon-out-link'))
|
||||
.merge(link);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user