Skip to content

Commit

Permalink
Replace .html with .text in Validator strings
Browse files Browse the repository at this point in the history
(re: #1274)
  • Loading branch information
bhousel committed Jan 2, 2024
1 parent cfabf6e commit 0bc5df5
Show file tree
Hide file tree
Showing 28 changed files with 93 additions and 106 deletions.
10 changes: 5 additions & 5 deletions modules/validations/almost_junction.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ export function validationAlmostJunction(context) {
const graph = editor.staging.graph;
const entity1 = graph.hasEntity(this.entityIds[0]);
if (this.entityIds[0] === this.entityIds[2]) {
return entity1 ? l10n.tHtml('issues.almost_junction.self.message', {
return entity1 ? l10n.t('issues.almost_junction.self.message', {
feature: l10n.displayLabel(entity1, graph)
}) : '';
} else {
const entity2 = graph.hasEntity(this.entityIds[2]);
return (entity1 && entity2) ? l10n.tHtml('issues.almost_junction.message', {
return (entity1 && entity2) ? l10n.t('issues.almost_junction.message', {
feature: l10n.displayLabel(entity1, graph),
feature2: l10n.displayLabel(entity2, graph)
}) : '';
Expand Down Expand Up @@ -93,7 +93,7 @@ export function validationAlmostJunction(context) {

let fixes = [new ValidationFix({
icon: 'rapid-icon-abutment',
title: l10n.tHtml('issues.fix.connect_features.title'),
title: l10n.t('issues.fix.connect_features.title'),
onClick: function() {
const annotation = l10n.t('issues.fix.connect_almost_junction.annotation');
const [, endNodeId, crossWayId] = this.issue.entityIds;
Expand Down Expand Up @@ -144,7 +144,7 @@ export function validationAlmostJunction(context) {
// node has no descriptive tags, suggest noexit fix
fixes.push(new ValidationFix({
icon: 'maki-barrier',
title: l10n.tHtml('issues.fix.tag_as_disconnected.title'),
title: l10n.t('issues.fix.tag_as_disconnected.title'),
onClick: function() {
const nodeID = this.issue.entityIds[1];
const tags = Object.assign({}, graph.entity(nodeID).tags);
Expand All @@ -167,7 +167,7 @@ export function validationAlmostJunction(context) {
.enter()
.append('div')
.attr('class', 'issue-reference')
.html(l10n.tHtml('issues.almost_junction.highway-highway.reference'));
.text(l10n.t('issues.almost_junction.highway-highway.reference'));
}

function isExtendableCandidate(node, way) {
Expand Down
2 changes: 1 addition & 1 deletion modules/validations/ambiguous_crossing_tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ export function validationAmbiguousCrossingTags(context) {
const klass = (d.type === '+') ? 'add' : 'remove';
return `tagDiff-cell tagDiff-cell-${klass}`;
})
.html(d => d.display);
.text(d => d.display);
}
});
}
Expand Down
18 changes: 8 additions & 10 deletions modules/validations/close_nodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export function validationCloseNodes(context) {
const graph = editor.staging.graph;
const entity = graph.hasEntity(this.entityIds[0]);
const entity2 = graph.hasEntity(this.entityIds[1]);
return (entity && entity2) ? l10n.tHtml('issues.close_nodes.detached.message', {
return (entity && entity2) ? l10n.t('issues.close_nodes.detached.message', {
feature: l10n.displayLabel(entity, graph),
feature2: l10n.displayLabel(entity2, graph)
}) : '';
Expand All @@ -192,11 +192,11 @@ export function validationCloseNodes(context) {
return [
new ValidationFix({
icon: 'rapid-operation-disconnect',
title: l10n.tHtml('issues.fix.move_points_apart.title')
title: l10n.t('issues.fix.move_points_apart.title')
}),
new ValidationFix({
icon: 'rapid-icon-layers',
title: l10n.tHtml('issues.fix.use_different_layers_or_levels.title')
title: l10n.t('issues.fix.use_different_layers_or_levels.title')
})
];
}
Expand All @@ -207,13 +207,12 @@ export function validationCloseNodes(context) {
return issues;

function showReference(selection) {
const referenceText = l10n.t('issues.close_nodes.detached.reference');
selection.selectAll('.issue-reference')
.data([0])
.enter()
.append('div')
.attr('class', 'issue-reference')
.html(referenceText);
.text(l10n.t('issues.close_nodes.detached.reference'));
}
}

Expand Down Expand Up @@ -254,7 +253,7 @@ export function validationCloseNodes(context) {
message: function() {
const graph = editor.staging.graph;
const entity = graph.hasEntity(this.entityIds[0]);
return entity ? l10n.tHtml('issues.close_nodes.message', { way: l10n.displayLabel(entity, graph) }) : '';
return entity ? l10n.t('issues.close_nodes.message', { way: l10n.displayLabel(entity, graph) }) : '';
},
reference: showReference,
entityIds: [way.id, node1.id, node2.id],
Expand All @@ -267,7 +266,7 @@ export function validationCloseNodes(context) {
return [
new ValidationFix({
icon: 'rapid-icon-plus',
title: l10n.tHtml('issues.fix.merge_points.title'),
title: l10n.t('issues.fix.merge_points.title'),
onClick: function() {
const entityIds = this.issue.entityIds;
editor.perform(actionMergeNodes([entityIds[1], entityIds[2]]));
Expand All @@ -279,20 +278,19 @@ export function validationCloseNodes(context) {
}),
new ValidationFix({
icon: 'rapid-operation-disconnect',
title: l10n.tHtml('issues.fix.move_points_apart.title')
title: l10n.t('issues.fix.move_points_apart.title')
})
];
}
});

function showReference(selection) {
const referenceText = l10n.t('issues.close_nodes.reference');
selection.selectAll('.issue-reference')
.data([0])
.enter()
.append('div')
.attr('class', 'issue-reference')
.html(referenceText);
.text(l10n.t('issues.close_nodes.reference'));
}
}

Expand Down
14 changes: 7 additions & 7 deletions modules/validations/crossing_ways.js
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ export function validationCrossingWays(context) {
const graph = editor.staging.graph;
const entity1 = graph.hasEntity(this.entityIds[0]);
const entity2 = graph.hasEntity(this.entityIds[1]);
return (entity1 && entity2) ? l10n.tHtml('issues.crossing_ways.message', {
return (entity1 && entity2) ? l10n.t('issues.crossing_ways.message', {
feature: l10n.displayLabel(entity1, graph),
feature2: l10n.displayLabel(entity2, graph)
}) : '';
Expand Down Expand Up @@ -531,7 +531,7 @@ export function validationCrossingWays(context) {
if (isCrossingIndoors) {
fixes.push(new ValidationFix({
icon: 'rapid-icon-layers',
title: l10n.tHtml('issues.fix.use_different_levels.title')
title: l10n.t('issues.fix.use_different_levels.title')
}));

} else if (isCrossingTunnels || isCrossingBridges || type1 === 'building' || type2 === 'building') {
Expand All @@ -557,7 +557,7 @@ export function validationCrossingWays(context) {
// repositioning the features is always an option
fixes.push(new ValidationFix({
icon: 'rapid-operation-move',
title: l10n.tHtml('issues.fix.reposition_features.title')
title: l10n.t('issues.fix.reposition_features.title')
}));

return fixes;
Expand All @@ -570,7 +570,7 @@ export function validationCrossingWays(context) {
.enter()
.append('div')
.attr('class', 'issue-reference')
.html(l10n.tHtml(`issues.crossing_ways.${crossingTypeID}.reference`));
.text(l10n.t(`issues.crossing_ways.${crossingTypeID}.reference`));
}
}

Expand All @@ -585,7 +585,7 @@ export function validationCrossingWays(context) {
function makeAddBridgeOrTunnelFix(titleID, iconName, bridgeOrTunnel) {
return new ValidationFix({
icon: iconName,
title: l10n.tHtml(`issues.fix.${titleID}.title`),
title: l10n.t(`issues.fix.${titleID}.title`),
onClick: function() {
if (context.mode?.id !== 'select-osm') return;

Expand Down Expand Up @@ -854,7 +854,7 @@ export function validationCrossingWays(context) {

return new ValidationFix({
icon: iconID,
title: l10n.tHtml(`issues.fix.${titleID}.title`),
title: l10n.t(`issues.fix.${titleID}.title`),
onClick: function() {
const loc = this.issue.loc;
const edges = this.issue.data.edges;
Expand All @@ -880,7 +880,7 @@ export function validationCrossingWays(context) {
function makeChangeLayerFix(higherOrLower) {
return new ValidationFix({
icon: 'rapid-icon-' + (higherOrLower === 'higher' ? 'up' : 'down'),
title: l10n.tHtml(`issues.fix.tag_this_as_${higherOrLower}.title`),
title: l10n.t(`issues.fix.tag_this_as_${higherOrLower}.title`),
onClick: function() {
if (context.mode?.id !== 'select-osm') return;

Expand Down
12 changes: 6 additions & 6 deletions modules/validations/disconnected_way.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function validationDisconnectedWay(context) {
const graph = editor.staging.graph;
const entity = this.entityIds.length && graph.hasEntity(this.entityIds[0]);
const label = entity && l10n.displayLabel(entity, graph);
return l10n.tHtml('issues.disconnected_way.routable.message', { count: this.entityIds.length, highway: label });
return l10n.t('issues.disconnected_way.routable.message', { count: this.entityIds.length, highway: label });
},
reference: showReference,
entityIds: Array.from(routingIslandEntities).map(entity => entity.id),
Expand All @@ -51,13 +51,13 @@ export function validationDisconnectedWay(context) {
}
if (!fixes.length) {
fixes.push(new ValidationFix({
title: l10n.tHtml('issues.fix.connect_feature.title')
title: l10n.t('issues.fix.connect_feature.title')
}));
}

fixes.push(new ValidationFix({
icon: 'rapid-operation-delete',
title: l10n.tHtml('issues.fix.delete_feature.title'),
title: l10n.t('issues.fix.delete_feature.title'),
entityIds: [ singleEntity.id ],
onClick: function() {
const id = this.issue.entityIds[0];
Expand All @@ -69,7 +69,7 @@ export function validationDisconnectedWay(context) {
}));
} else {
fixes.push(new ValidationFix({
title: l10n.tHtml('issues.fix.connect_features.title')
title: l10n.t('issues.fix.connect_features.title')
}));
}

Expand All @@ -83,7 +83,7 @@ export function validationDisconnectedWay(context) {
.enter()
.append('div')
.attr('class', 'issue-reference')
.html(l10n.tHtml('issues.disconnected_way.routable.reference'));
.text(l10n.t('issues.disconnected_way.routable.reference'));
}


Expand Down Expand Up @@ -178,7 +178,7 @@ export function validationDisconnectedWay(context) {

return new ValidationFix({
icon: 'rapid-operation-continue' + (useLeftContinue ? '-left' : ''),
title: l10n.tHtml(`issues.fix.continue_from_${whichEnd}.title`),
title: l10n.t(`issues.fix.continue_from_${whichEnd}.title`),
entityIds: [vertexID],
onClick: function() {
const graph = editor.staging.graph;
Expand Down
10 changes: 5 additions & 5 deletions modules/validations/duplicate_way_segments.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export function validationDuplicateWaySegments(context) {
message: function() {
const graph = editor.staging.graph;
const entity = graph.hasEntity(this.entityIds[0]);
return entity ? l10n.tHtml('issues.duplicate_way_segments.message', {
return entity ? l10n.t('issues.duplicate_way_segments.message', {
way: l10n.displayLabel(entity, graph)
}) : '';
},
Expand All @@ -91,15 +91,15 @@ export function validationDuplicateWaySegments(context) {
return [
new ValidationFix({
icon: 'rapid-icon-plus',
title: l10n.tHtml('issues.fix.merge_points.title'),
title: l10n.t('issues.fix.merge_points.title'),
}),
new ValidationFix({
icon: 'rapid-operation-delete',
title: l10n.tHtml('issues.fix.remove_way_segments.title')
title: l10n.t('issues.fix.remove_way_segments.title')
}),
new ValidationFix({
icon: 'rapid-operation-disconnect',
title: l10n.tHtml('issues.fix.move_way_segments_apart.title')
title: l10n.t('issues.fix.move_way_segments_apart.title')
})
];
}
Expand All @@ -112,7 +112,7 @@ export function validationDuplicateWaySegments(context) {
.enter()
.append('div')
.attr('class', 'issue-reference')
.html(l10n.t('issues.duplicate_way_segments.reference'));
.text(l10n.t('issues.duplicate_way_segments.reference'));
}
}

Expand Down
6 changes: 3 additions & 3 deletions modules/validations/help_request.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ export function validationHelpRequest(context) {
message: function() {
const graph = editor.staging.graph;
const entity = graph.hasEntity(this.entityIds[0]);
return entity ? l10n.tHtml('issues.fixme_tag.message', {
return entity ? l10n.t('issues.fixme_tag.message', {
feature: l10n.displayLabel(entity, graph, true) // true = verbose
}) : '';
},
dynamicFixes: () => {
return [
new ValidationFix({ title: l10n.tHtml('issues.fix.address_the_concern.title') })
new ValidationFix({ title: l10n.t('issues.fix.address_the_concern.title') })
];
},
reference: showReference,
Expand All @@ -45,7 +45,7 @@ export function validationHelpRequest(context) {
.enter()
.append('div')
.attr('class', 'issue-reference')
.html(l10n.tHtml('issues.fixme_tag.reference'));
.text(l10n.t('issues.fixme_tag.reference'));
}
};

Expand Down
8 changes: 4 additions & 4 deletions modules/validations/impossible_oneway.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export function validationImpossibleOneway(context) {
message: function() {
const graph = editor.staging.graph;
const entity = graph.hasEntity(this.entityIds[0]);
return entity ? l10n.tHtml(`issues.impossible_oneway.${messageID}.message`, {
return entity ? l10n.t(`issues.impossible_oneway.${messageID}.message`, {
feature: l10n.displayLabel(entity, graph)
}) : '';
},
Expand All @@ -143,7 +143,7 @@ export function validationImpossibleOneway(context) {
if (attachedOneways.length) {
fixes.push(new ValidationFix({
icon: 'rapid-operation-reverse',
title: l10n.tHtml('issues.fix.reverse_feature.title'),
title: l10n.t('issues.fix.reverse_feature.title'),
entityIds: [way.id],
onClick: function() {
const entityID = this.issue.entityIds[0];
Expand All @@ -160,7 +160,7 @@ export function validationImpossibleOneway(context) {
const useLeftContinue = (isFirst && !isRTL) || (!isFirst && isRTL);
fixes.push(new ValidationFix({
icon: 'rapid-operation-continue' + (useLeftContinue ? '-left' : ''),
title: l10n.tHtml('issues.fix.continue_from_' + (isFirst ? 'start' : 'end') + '.title'),
title: l10n.t('issues.fix.continue_from_' + (isFirst ? 'start' : 'end') + '.title'),
onClick: function() {
const entityID = this.issue.entityIds[0];
const vertexID = this.issue.entityIds[1];
Expand All @@ -183,7 +183,7 @@ export function validationImpossibleOneway(context) {
.enter()
.append('div')
.attr('class', 'issue-reference')
.html(l10n.tHtml(`issues.impossible_oneway.${referenceID}.reference`));
.text(l10n.t(`issues.impossible_oneway.${referenceID}.reference`));
};
}
}
Expand Down
6 changes: 3 additions & 3 deletions modules/validations/incompatible_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function validationIncompatibleSource(context) {
message: () => {
const graph = editor.staging.graph;
const entity = graph.hasEntity(entityID);
return entity ? l10n.tHtml('issues.incompatible_source.feature.message', {
return entity ? l10n.t('issues.incompatible_source.feature.message', {
feature: l10n.displayLabel(entity, graph, true), // true = verbose
value: source
}) : '';
Expand All @@ -53,7 +53,7 @@ export function validationIncompatibleSource(context) {
hash: source,
dynamicFixes: () => {
return [
new ValidationFix({ title: l10n.tHtml('issues.fix.remove_proprietary_data.title') })
new ValidationFix({ title: l10n.t('issues.fix.remove_proprietary_data.title') })
];
}
});
Expand All @@ -68,7 +68,7 @@ export function validationIncompatibleSource(context) {
.enter()
.append('div')
.attr('class', 'issue-reference')
.html(l10n.tHtml(`issues.incompatible_source.reference.${id}`));
.text(l10n.t(`issues.incompatible_source.reference.${id}`));
};
}
};
Expand Down
Loading

0 comments on commit 0bc5df5

Please sign in to comment.