From 85022dcc6c9421e9f6c87068d8bfeec01a90aafd Mon Sep 17 00:00:00 2001 From: Martin Raifer Date: Thu, 23 Jun 2022 19:09:10 +0200 Subject: [PATCH] render operations texts with lang attribute --- modules/modes/select.js | 2 +- modules/operations/circularize.js | 6 +++--- modules/operations/continue.js | 6 +++--- modules/operations/copy.js | 6 +++--- modules/operations/delete.js | 6 +++--- modules/operations/disconnect.js | 9 ++++----- modules/operations/downgrade.js | 6 +++--- modules/operations/extract.js | 6 +++--- modules/operations/merge.js | 10 +++++----- modules/operations/move.js | 6 +++--- modules/operations/orthogonalize.js | 6 +++--- modules/operations/paste.js | 6 +++--- modules/operations/reflect.js | 6 +++--- modules/operations/reverse.js | 4 ++-- modules/operations/rotate.js | 6 +++--- modules/operations/split.js | 7 ++++--- modules/operations/straighten.js | 6 +++--- modules/ui/edit_menu.js | 4 ++-- modules/ui/flash.js | 2 +- 19 files changed, 55 insertions(+), 55 deletions(-) diff --git a/modules/modes/select.js b/modules/modes/select.js index 6af3acd4d..d8c75802a 100644 --- a/modules/modes/select.js +++ b/modules/modes/select.js @@ -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(); diff --git a/modules/operations/circularize.js b/modules/operations/circularize.js index b7497c045..184c85dbb 100644 --- a/modules/operations/circularize.js +++ b/modules/operations/circularize.js @@ -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; diff --git a/modules/operations/continue.js b/modules/operations/continue.js index 0f5a52941..e6d79fb39 100644 --- a/modules/operations/continue.js +++ b/modules/operations/continue.js @@ -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; diff --git a/modules/operations/copy.js b/modules/operations/copy.js index 13c456b83..7bd1f86f0 100644 --- a/modules/operations/copy.js +++ b/modules/operations/copy.js @@ -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; diff --git a/modules/operations/delete.js b/modules/operations/delete.js index 9a7bd8ce6..3f365be48 100644 --- a/modules/operations/delete.js +++ b/modules/operations/delete.js @@ -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; diff --git a/modules/operations/disconnect.js b/modules/operations/disconnect.js index 691f8fa00..ccd476e40 100644 --- a/modules/operations/disconnect.js +++ b/modules/operations/disconnect.js @@ -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; diff --git a/modules/operations/downgrade.js b/modules/operations/downgrade.js index 7177cf9af..8c5f7c326 100644 --- a/modules/operations/downgrade.js +++ b/modules/operations/downgrade.js @@ -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); diff --git a/modules/operations/extract.js b/modules/operations/extract.js index a6ea27f5f..43ddfde7a 100644 --- a/modules/operations/extract.js +++ b/modules/operations/extract.js @@ -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); diff --git a/modules/operations/merge.js b/modules/operations/merge.js index f61a016cf..60b4baed1 100644 --- a/modules/operations/merge.js +++ b/modules/operations/merge.js @@ -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; diff --git a/modules/operations/move.js b/modules/operations/move.js index 677709d92..298acb18b 100644 --- a/modules/operations/move.js +++ b/modules/operations/move.js @@ -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; diff --git a/modules/operations/orthogonalize.js b/modules/operations/orthogonalize.js index c8b89445d..a62dd6aa2 100644 --- a/modules/operations/orthogonalize.js +++ b/modules/operations/orthogonalize.js @@ -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; diff --git a/modules/operations/paste.js b/modules/operations/paste.js index 30e61d222..6c17d4f3d 100644 --- a/modules/operations/paste.js +++ b/modules/operations/paste.js @@ -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; } diff --git a/modules/operations/reflect.js b/modules/operations/reflect.js index 2a0e17271..51872b306 100644 --- a/modules/operations/reflect.js +++ b/modules/operations/reflect.js @@ -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; diff --git a/modules/operations/reverse.js b/modules/operations/reverse.js index c4a01d36d..b2b3274b3 100644 --- a/modules/operations/reverse.js +++ b/modules/operations/reverse.js @@ -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; diff --git a/modules/operations/rotate.js b/modules/operations/rotate.js index b8a4c5ea6..c9d13d7a6 100644 --- a/modules/operations/rotate.js +++ b/modules/operations/rotate.js @@ -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; diff --git a/modules/operations/split.js b/modules/operations/split.js index 583f2db47..771511428 100644 --- a/modules/operations/split.js +++ b/modules/operations/split.js @@ -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; diff --git a/modules/operations/straighten.js b/modules/operations/straighten.js index 56b5b4050..33c275700 100644 --- a/modules/operations/straighten.js +++ b/modules/operations/straighten.js @@ -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; diff --git a/modules/ui/edit_menu.js b/modules/ui/edit_menu.js index 4b199e98a..173e1144b 100644 --- a/modules/ui/edit_menu.js +++ b/modules/ui/edit_menu.js @@ -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' || diff --git a/modules/ui/flash.js b/modules/ui/flash.js index 82062025c..592f0ecb2 100644 --- a/modules/ui/flash.js +++ b/modules/ui/flash.js @@ -92,7 +92,7 @@ export function uiFlash(context) { if (typeof _ !== 'function') { _label = selection => selection.text(_); } else { - _label = _; + _label = selection => s_; } return flash; };