Add lang attribute to text in turn restriction editor (re: #7963)

This commit is contained in:
Quincy Morgan
2020-09-29 16:38:23 -04:00
parent 3c40045a9b
commit 79b6a9d863
3 changed files with 17 additions and 17 deletions
+2 -2
View File
@@ -2024,13 +2024,13 @@ a.hide-toggle {
}
.restriction-control input,
.restriction-control span {
.restriction-control > span {
display: table-cell;
text-align: start;
padding: 0px 5px;
}
.restriction-control span.restriction-control-label {
.restriction-control > span.restriction-control-label {
text-align: end;
}
+4 -4
View File
@@ -55,8 +55,8 @@ export function uiFieldHelp(context, fieldName) {
var fieldHelpHeadings = {};
var replacements = {
distField: t('restriction.controls.distance'),
viaField: t('restriction.controls.via'),
distField: t.html('restriction.controls.distance'),
viaField: t.html('restriction.controls.via'),
fromShadow: icon('#iD-turn-shadow', 'inline shadow from'),
allowShadow: icon('#iD-turn-shadow', 'inline shadow allow'),
restrictShadow: icon('#iD-turn-shadow', 'inline shadow restrict'),
@@ -74,12 +74,12 @@ export function uiFieldHelp(context, fieldName) {
var subkey = helpkey + '.' + part;
var depth = fieldHelpHeadings[subkey]; // is this subkey a heading?
var hhh = depth ? Array(depth + 1).join('#') + ' ' : ''; // if so, prepend with some ##'s
return all + hhh + t(subkey, replacements) + '\n\n';
return all + hhh + t.html(subkey, replacements) + '\n\n';
}, '');
return {
key: helpkey,
title: t(helpkey + '.title'),
title: t.html(helpkey + '.title'),
html: marked(text.trim())
};
});
+11 -11
View File
@@ -497,21 +497,21 @@ export function uiFieldRestrictions(field, context) {
} else if (datum instanceof osmTurn) {
var restrictionType = osmInferRestriction(vgraph, datum, projection);
var turnType = restrictionType.replace(/^(only|no)\_/, '');
var indirect = (datum.direct === false ? t('restriction.help.indirect') : '');
var indirect = (datum.direct === false ? t.html('restriction.help.indirect') : '');
var klass, turnText, nextText;
if (datum.no) {
klass = 'restrict';
turnText = t('restriction.help.turn.no_' + turnType, { indirect: indirect });
nextText = t('restriction.help.turn.only_' + turnType, { indirect: '' });
turnText = t.html('restriction.help.turn.no_' + turnType, { indirect: indirect });
nextText = t.html('restriction.help.turn.only_' + turnType, { indirect: '' });
} else if (datum.only) {
klass = 'only';
turnText = t('restriction.help.turn.only_' + turnType, { indirect: indirect });
nextText = t('restriction.help.turn.allowed_' + turnType, { indirect: '' });
turnText = t.html('restriction.help.turn.only_' + turnType, { indirect: indirect });
nextText = t.html('restriction.help.turn.allowed_' + turnType, { indirect: '' });
} else {
klass = 'allow';
turnText = t('restriction.help.turn.allowed_' + turnType, { indirect: indirect });
nextText = t('restriction.help.turn.no_' + turnType, { indirect: '' });
turnText = t.html('restriction.help.turn.allowed_' + turnType, { indirect: indirect });
nextText = t.html('restriction.help.turn.no_' + turnType, { indirect: '' });
}
help
@@ -596,14 +596,14 @@ export function uiFieldRestrictions(field, context) {
opts = { distance: t('units.meters', { quantity: maxDist }) };
}
return t('restriction.controls.distance_up_to', opts);
return t.html('restriction.controls.distance_up_to', opts);
}
function displayMaxVia(maxVia) {
return maxVia === 0 ? t('restriction.controls.via_node_only')
: maxVia === 1 ? t('restriction.controls.via_up_to_one')
: t('restriction.controls.via_up_to_two');
return maxVia === 0 ? t.html('restriction.controls.via_node_only')
: maxVia === 1 ? t.html('restriction.controls.via_up_to_one')
: t.html('restriction.controls.via_up_to_two');
}