render operations texts with lang attribute

This commit is contained in:
Martin Raifer
2022-06-23 19:09:10 +02:00
parent ac77289b4d
commit 85022dcc6c
19 changed files with 55 additions and 55 deletions
+1 -1
View File
@@ -327,7 +327,7 @@ export function modeSelect(context, selectedIDs) {
.duration(4000)
.iconName('#iD-operation-' + moveOp.id)
.iconClass('operation disabled')
.label(moveOp.tooltip)();
.label(moveOp.tooltip())();
} else {
context.perform(actionMove(selectedIDs, delta, context.projection), moveOp.annotation());
context.validator().validate();
+3 -3
View File
@@ -96,8 +96,8 @@ export function operationCircularize(context, selectedIDs) {
operation.tooltip = function() {
var disable = operation.disabled();
return disable ?
t('operations.circularize.' + disable + '.' + _amount) :
t('operations.circularize.description.' + _amount);
t.append('operations.circularize.' + disable + '.' + _amount) :
t.append('operations.circularize.description.' + _amount);
};
@@ -108,7 +108,7 @@ export function operationCircularize(context, selectedIDs) {
operation.id = 'circularize';
operation.keys = [t('operations.circularize.key')];
operation.title = t('operations.circularize.title');
operation.title = t.append('operations.circularize.title');
operation.behavior = behaviorOperation(context).which(operation);
return operation;
+3 -3
View File
@@ -60,8 +60,8 @@ export function operationContinue(context, selectedIDs) {
operation.tooltip = function() {
var disable = operation.disabled();
return disable ?
t('operations.continue.' + disable) :
t('operations.continue.description');
t.append('operations.continue.' + disable) :
t.append('operations.continue.description');
};
@@ -72,7 +72,7 @@ export function operationContinue(context, selectedIDs) {
operation.id = 'continue';
operation.keys = [t('operations.continue.key')];
operation.title = t('operations.continue.title');
operation.title = t.append('operations.continue.title');
operation.behavior = behaviorOperation(context).which(operation);
return operation;
+3 -3
View File
@@ -113,8 +113,8 @@ export function operationCopy(context, selectedIDs) {
operation.tooltip = function() {
var disable = operation.disabled();
return disable ?
t('operations.copy.' + disable, { n: selectedIDs.length }) :
t('operations.copy.description', { n: selectedIDs.length });
t.append('operations.copy.' + disable, { n: selectedIDs.length }) :
t.append('operations.copy.description', { n: selectedIDs.length });
};
@@ -132,7 +132,7 @@ export function operationCopy(context, selectedIDs) {
operation.id = 'copy';
operation.keys = [uiCmd('⌘C')];
operation.title = t('operations.copy.title');
operation.title = t.append('operations.copy.title');
operation.behavior = behaviorOperation(context).which(operation);
return operation;
+3 -3
View File
@@ -131,8 +131,8 @@ export function operationDelete(context, selectedIDs) {
operation.tooltip = function() {
var disable = operation.disabled();
return disable ?
t('operations.delete.' + disable + '.' + multi) :
t('operations.delete.description.' + multi);
t.append('operations.delete.' + disable + '.' + multi) :
t.append('operations.delete.description.' + multi);
};
@@ -145,7 +145,7 @@ export function operationDelete(context, selectedIDs) {
operation.id = 'delete';
operation.keys = [uiCmd('⌘⌫'), uiCmd('⌘⌦'), uiCmd('⌦')];
operation.title = t('operations.delete.title');
operation.title = t.append('operations.delete.title');
operation.behavior = behaviorOperation(context).which(operation);
return operation;
+4 -5
View File
@@ -189,10 +189,9 @@ export function operationDisconnect(context, selectedIDs) {
operation.tooltip = function() {
var disable = operation.disabled();
if (disable) {
return t('operations.disconnect.' + disable);
}
return t('operations.disconnect.description.' + _descriptionID);
return disable ?
t.append('operations.disconnect.' + disable) :
t.append('operations.disconnect.description.' + _descriptionID);
};
@@ -203,7 +202,7 @@ export function operationDisconnect(context, selectedIDs) {
operation.id = 'disconnect';
operation.keys = [t('operations.disconnect.key')];
operation.title = t('operations.disconnect.title');
operation.title = t.append('operations.disconnect.title');
operation.behavior = behaviorOperation(context).which(operation);
return operation;
+3 -3
View File
@@ -120,8 +120,8 @@ export function operationDowngrade(context, selectedIDs) {
operation.tooltip = function () {
var disable = operation.disabled();
return disable ?
t('operations.downgrade.' + disable + '.' + _multi) :
t('operations.downgrade.description.' + _downgradeType);
t.append('operations.downgrade.' + disable + '.' + _multi) :
t.append('operations.downgrade.description.' + _downgradeType);
};
@@ -138,7 +138,7 @@ export function operationDowngrade(context, selectedIDs) {
operation.id = 'downgrade';
operation.keys = [uiCmd('⌫')];
operation.title = t('operations.downgrade.title');
operation.title = t.append('operations.downgrade.title');
operation.behavior = behaviorOperation(context).which(operation);
+3 -3
View File
@@ -71,9 +71,9 @@ export function operationExtract(context, selectedIDs) {
operation.tooltip = function () {
var disableReason = operation.disabled();
if (disableReason) {
return t('operations.extract.' + disableReason + '.' + _amount);
return t.append('operations.extract.' + disableReason + '.' + _amount);
} else {
return t('operations.extract.description.' + _geometryID + '.' + _amount);
return t.append('operations.extract.description.' + _geometryID + '.' + _amount);
}
};
@@ -85,7 +85,7 @@ export function operationExtract(context, selectedIDs) {
operation.id = 'extract';
operation.keys = [t('operations.extract.key')];
operation.title = t('operations.extract.title');
operation.title = t.append('operations.extract.title');
operation.behavior = behaviorOperation(context).which(operation);
+5 -5
View File
@@ -75,15 +75,15 @@ export function operationMerge(context, selectedIDs) {
var disabled = operation.disabled();
if (disabled) {
if (disabled === 'conflicting_relations') {
return t('operations.merge.conflicting_relations');
return t.append('operations.merge.conflicting_relations');
}
if (disabled === 'restriction' || disabled === 'connectivity') {
return t('operations.merge.damage_relation',
return t.append('operations.merge.damage_relation',
{ relation: presetManager.item('type/' + disabled).name() });
}
return t('operations.merge.' + disabled);
return t.append('operations.merge.' + disabled);
}
return t('operations.merge.description');
return t.append('operations.merge.description');
};
operation.annotation = function() {
@@ -92,7 +92,7 @@ export function operationMerge(context, selectedIDs) {
operation.id = 'merge';
operation.keys = [t('operations.merge.key')];
operation.title = t('operations.merge.title');
operation.title = t.append('operations.merge.title');
operation.behavior = behaviorOperation(context).which(operation);
return operation;
+3 -3
View File
@@ -58,8 +58,8 @@ export function operationMove(context, selectedIDs) {
operation.tooltip = function() {
var disable = operation.disabled();
return disable ?
t('operations.move.' + disable + '.' + multi) :
t('operations.move.description.' + multi);
t.append('operations.move.' + disable + '.' + multi) :
t.append('operations.move.description.' + multi);
};
@@ -72,7 +72,7 @@ export function operationMove(context, selectedIDs) {
operation.id = 'move';
operation.keys = [t('operations.move.key')];
operation.title = t('operations.move.title');
operation.title = t.append('operations.move.title');
operation.behavior = behaviorOperation(context).which(operation);
operation.mouseOnly = true;
+3 -3
View File
@@ -119,8 +119,8 @@ export function operationOrthogonalize(context, selectedIDs) {
operation.tooltip = function() {
var disable = operation.disabled();
return disable ?
t('operations.orthogonalize.' + disable + '.' + _amount) :
t('operations.orthogonalize.description.' + _type + '.' + _amount);
t.append('operations.orthogonalize.' + disable + '.' + _amount) :
t.append('operations.orthogonalize.description.' + _type + '.' + _amount);
};
@@ -131,7 +131,7 @@ export function operationOrthogonalize(context, selectedIDs) {
operation.id = 'orthogonalize';
operation.keys = [t('operations.orthogonalize.key')];
operation.title = t('operations.orthogonalize.title');
operation.title = t.append('operations.orthogonalize.title');
operation.behavior = behaviorOperation(context).which(operation);
return operation;
+3 -3
View File
@@ -76,9 +76,9 @@ export function operationPaste(context) {
var oldGraph = context.copyGraph();
var ids = context.copyIDs();
if (!ids.length) {
return t('operations.paste.nothing_copied');
return t.append('operations.paste.nothing_copied');
}
return t('operations.paste.description', { feature: utilDisplayLabel(oldGraph.entity(ids[0]), oldGraph), n: ids.length });
return t.append('operations.paste.description', { feature: utilDisplayLabel(oldGraph.entity(ids[0]), oldGraph), n: ids.length });
};
operation.annotation = function() {
@@ -88,7 +88,7 @@ export function operationPaste(context) {
operation.id = 'paste';
operation.keys = [uiCmd('⌘V')];
operation.title = t('operations.paste.title');
operation.title = t.append('operations.paste.title');
return operation;
}
+3 -3
View File
@@ -77,8 +77,8 @@ export function operationReflect(context, selectedIDs, axis) {
operation.tooltip = function() {
var disable = operation.disabled();
return disable ?
t('operations.reflect.' + disable + '.' + multi) :
t('operations.reflect.description.' + axis + '.' + multi);
t.append('operations.reflect.' + disable + '.' + multi) :
t.append('operations.reflect.description.' + axis + '.' + multi);
};
@@ -89,7 +89,7 @@ export function operationReflect(context, selectedIDs, axis) {
operation.id = 'reflect-' + axis;
operation.keys = [t('operations.reflect.key.' + axis)];
operation.title = t('operations.reflect.title.' + axis);
operation.title = t.append('operations.reflect.title.' + axis);
operation.behavior = behaviorOperation(context).which(operation);
return operation;
+2 -2
View File
@@ -58,7 +58,7 @@ export function operationReverse(context, selectedIDs) {
operation.tooltip = function() {
return t('operations.reverse.description.' + reverseTypeID());
return t.append('operations.reverse.description.' + reverseTypeID());
};
@@ -70,7 +70,7 @@ export function operationReverse(context, selectedIDs) {
operation.id = 'reverse';
operation.keys = [t('operations.reverse.key')];
operation.title = t('operations.reverse.title');
operation.title = t.append('operations.reverse.title');
operation.behavior = behaviorOperation(context).which(operation);
return operation;
+3 -3
View File
@@ -59,8 +59,8 @@ export function operationRotate(context, selectedIDs) {
operation.tooltip = function() {
var disable = operation.disabled();
return disable ?
t('operations.rotate.' + disable + '.' + multi) :
t('operations.rotate.description.' + multi);
t.append('operations.rotate.' + disable + '.' + multi) :
t.append('operations.rotate.description.' + multi);
};
@@ -73,7 +73,7 @@ export function operationRotate(context, selectedIDs) {
operation.id = 'rotate';
operation.keys = [t('operations.rotate.key')];
operation.title = t('operations.rotate.title');
operation.title = t.append('operations.rotate.title');
operation.behavior = behaviorOperation(context).which(operation);
operation.mouseOnly = true;
+4 -3
View File
@@ -68,8 +68,9 @@ export function operationSplit(context, selectedIDs) {
operation.tooltip = function() {
var disable = operation.disabled();
if (disable) return t('operations.split.' + disable);
return t('operations.split.description.' + _geometry + '.' + _waysAmount + '.' + _nodesAmount + '_node');
return disable ?
t.append('operations.split.' + disable) :
t.append('operations.split.description.' + _geometry + '.' + _waysAmount + '.' + _nodesAmount + '_node');
};
@@ -89,7 +90,7 @@ export function operationSplit(context, selectedIDs) {
operation.id = 'split';
operation.keys = [t('operations.split.key')];
operation.title = t('operations.split.title');
operation.title = t.append('operations.split.title');
operation.behavior = behaviorOperation(context).which(operation);
return operation;
+3 -3
View File
@@ -124,8 +124,8 @@ export function operationStraighten(context, selectedIDs) {
operation.tooltip = function() {
var disable = operation.disabled();
return disable ?
t('operations.straighten.' + disable + '.' + _amount) :
t('operations.straighten.description.' + _geometry + (_wayIDs.length === 1 ? '' : 's'));
t.append('operations.straighten.' + disable + '.' + _amount) :
t.append('operations.straighten.description.' + _geometry + (_wayIDs.length === 1 ? '' : 's'));
};
@@ -136,7 +136,7 @@ export function operationStraighten(context, selectedIDs) {
operation.id = 'straighten';
operation.keys = [t('operations.straighten.key')];
operation.title = t('operations.straighten.title');
operation.title = t.append('operations.straighten.title');
operation.behavior = behaviorOperation(context).which(operation);
return operation;
+2 -2
View File
@@ -104,7 +104,7 @@ export function uiEditMenu(context) {
buttonsEnter.each(function(d) {
var tooltip = uiTooltip()
.heading(d.title)
.heading(() => d.title)
.title(d.tooltip)
.keys([d.keys[0]]);
@@ -164,7 +164,7 @@ export function uiEditMenu(context) {
.duration(4000)
.iconName('#iD-operation-' + operation.id)
.iconClass('operation disabled')
.label(operation.tooltip)();
.label(operation.tooltip())();
}
} else {
if (lastPointerUpType === 'touch' ||
+1 -1
View File
@@ -92,7 +92,7 @@ export function uiFlash(context) {
if (typeof _ !== 'function') {
_label = selection => selection.text(_);
} else {
_label = _;
_label = selection => s_;
}
return flash;
};