diff --git a/data/core.yaml b/data/core.yaml index 7c8cd8724..3c6b030fd 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -101,8 +101,9 @@ en: multiple: Make these features circular. key: O annotation: - single: Made a feature circular. - multiple: Made features circular. + feature: + one: Made a feature circular. + other: "Made {n} features circular." multiple_blockers: multiple: These can't be made circular for multiple reasons. not_closed: @@ -132,11 +133,11 @@ en: key: Q annotation: corner: - single: Squared a corner. - multiple: Squared several corners. + one: Squared a corner. + other: "Squared {n} corners." feature: - single: Squared the corners of a feature. - multiple: Squared the corners of several features. + one: Squared the corners of a feature. + other: "Squared the corners of {n} features." multiple_blockers: multiple: These can't be squared for multiple reasons. end_vertex: @@ -165,9 +166,12 @@ en: lines: Straighten these lines. key: S annotation: - points: Straightened several points. - line: Straightened a line. - lines: Straightened several lines. + point: + one: Straightened a point. + other: "Straightened {n} points." + line: + one: Straightened a line. + other: "Straightened {n} lines." too_bendy: single: This can't be straightened because it bends too much. multiple: These can't be straightened because they bend too much. @@ -316,7 +320,9 @@ en: line: Moved a line. area: Moved an area. relation: Moved a relation. - multiple: Moved multiple features. + feature: + one: "Moved a feature." + other: "Moved {n} features." incomplete_relation: single: This feature can't be moved because it hasn't been fully downloaded. multiple: These features can't be moved because they haven't been fully downloaded. @@ -345,11 +351,13 @@ en: short: Y annotation: long: - single: Flipped a feature across its long axis. - multiple: Flipped multiple features across their long axis. + feature: + one: Flipped a feature across its long axis. + other: "Flipped {n} features across their long axis." short: - single: Flipped a feature across its short axis. - multiple: Flipped multiple features across their short axis. + feature: + one: Flipped a feature across its short axis. + other: "Flipped {n} features across their short axis." incomplete_relation: single: This feature can't be flipped because it hasn't been fully downloaded. multiple: These features can't be flipped because they haven't been fully downloaded. @@ -371,8 +379,10 @@ en: annotation: line: Rotated a line. area: Rotated an area. - multiple: Rotated multiple features. relation: Rotated a relation. + feature: + one: Rotated a feature. + other: "Rotated {n} features." incomplete_relation: single: This feature can't be rotated because it hasn't been fully downloaded. multiple: These features can't be rotated because they haven't been fully downloaded. @@ -395,11 +405,15 @@ en: features: Flip the directions of these features. key: V annotation: - point: Reversed a point. - points: Reversed multiple points. - line: Reversed a line. - lines: Reversed multiple lines. - features: Reversed multiple features. + point: + one: Reversed a point. + other: "Reversed {n} points." + line: + one: Reversed a line. + other: "Reversed {n} lines." + feature: + one: Reversed a feature. + other: "Reversed {n} features." scale: annotation: down: diff --git a/dist/locales/en.json b/dist/locales/en.json index 006ebfc49..a9ec33916 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -131,8 +131,10 @@ }, "key": "O", "annotation": { - "single": "Made a feature circular.", - "multiple": "Made features circular." + "feature": { + "one": "Made a feature circular.", + "other": "Made {n} features circular." + } }, "multiple_blockers": { "multiple": "These can't be made circular for multiple reasons." @@ -173,12 +175,12 @@ "key": "Q", "annotation": { "corner": { - "single": "Squared a corner.", - "multiple": "Squared several corners." + "one": "Squared a corner.", + "other": "Squared {n} corners." }, "feature": { - "single": "Squared the corners of a feature.", - "multiple": "Squared the corners of several features." + "one": "Squared the corners of a feature.", + "other": "Squared the corners of {n} features." } }, "multiple_blockers": { @@ -218,9 +220,14 @@ }, "key": "S", "annotation": { - "points": "Straightened several points.", - "line": "Straightened a line.", - "lines": "Straightened several lines." + "point": { + "one": "Straightened a point.", + "other": "Straightened {n} points." + }, + "line": { + "one": "Straightened a line.", + "other": "Straightened {n} lines." + } }, "too_bendy": { "single": "This can't be straightened because it bends too much.", @@ -414,7 +421,10 @@ "line": "Moved a line.", "area": "Moved an area.", "relation": "Moved a relation.", - "multiple": "Moved multiple features." + "feature": { + "one": "Moved a feature.", + "other": "Moved {n} features." + } }, "incomplete_relation": { "single": "This feature can't be moved because it hasn't been fully downloaded.", @@ -454,12 +464,16 @@ }, "annotation": { "long": { - "single": "Flipped a feature across its long axis.", - "multiple": "Flipped multiple features across their long axis." + "feature": { + "one": "Flipped a feature across its long axis.", + "other": "Flipped {n} features across their long axis." + } }, "short": { - "single": "Flipped a feature across its short axis.", - "multiple": "Flipped multiple features across their short axis." + "feature": { + "one": "Flipped a feature across its short axis.", + "other": "Flipped {n} features across their short axis." + } } }, "incomplete_relation": { @@ -489,8 +503,11 @@ "annotation": { "line": "Rotated a line.", "area": "Rotated an area.", - "multiple": "Rotated multiple features.", - "relation": "Rotated a relation." + "relation": "Rotated a relation.", + "feature": { + "one": "Rotated a feature.", + "other": "Rotated {n} features." + } }, "incomplete_relation": { "single": "This feature can't be rotated because it hasn't been fully downloaded.", @@ -520,11 +537,18 @@ }, "key": "V", "annotation": { - "point": "Reversed a point.", - "points": "Reversed multiple points.", - "line": "Reversed a line.", - "lines": "Reversed multiple lines.", - "features": "Reversed multiple features." + "point": { + "one": "Reversed a point.", + "other": "Reversed {n} points." + }, + "line": { + "one": "Reversed a line.", + "other": "Reversed {n} lines." + }, + "feature": { + "one": "Reversed a feature.", + "other": "Reversed {n} features." + } } }, "scale": { diff --git a/modules/modes/move.js b/modules/modes/move.js index 6a6a7e97a..56db93c4d 100644 --- a/modules/modes/move.js +++ b/modules/modes/move.js @@ -39,7 +39,7 @@ export function modeMove(context, entityIDs, baseGraph) { ]; var annotation = entityIDs.length === 1 ? t('operations.move.annotation.' + context.graph().geometry(entityIDs[0])) : - t('operations.move.annotation.multiple'); + t('operations.move.annotation.feature', { n: entityIDs.length }); var _prevGraph; var _cache; diff --git a/modules/modes/rotate.js b/modules/modes/rotate.js index d22bf8eee..b11e300de 100644 --- a/modules/modes/rotate.js +++ b/modules/modes/rotate.js @@ -43,7 +43,7 @@ export function modeRotate(context, entityIDs) { ]; var annotation = entityIDs.length === 1 ? t('operations.rotate.annotation.' + context.graph().geometry(entityIDs[0])) : - t('operations.rotate.annotation.multiple'); + t('operations.rotate.annotation.feature', { n: entityIDs.length }); var _prevGraph; var _prevAngle; diff --git a/modules/operations/circularize.js b/modules/operations/circularize.js index 0ecbe3d1a..b7497c045 100644 --- a/modules/operations/circularize.js +++ b/modules/operations/circularize.js @@ -102,7 +102,7 @@ export function operationCircularize(context, selectedIDs) { operation.annotation = function() { - return t('operations.circularize.annotation.' + _amount); + return t('operations.circularize.annotation.feature', { n: _actions.length }); }; diff --git a/modules/operations/move.js b/modules/operations/move.js index f8e7a3ff6..4078714c8 100644 --- a/modules/operations/move.js +++ b/modules/operations/move.js @@ -67,7 +67,7 @@ export function operationMove(context, selectedIDs) { operation.annotation = function() { return selectedIDs.length === 1 ? t('operations.move.annotation.' + context.graph().geometry(selectedIDs[0])) : - t('operations.move.annotation.multiple'); + t('operations.move.annotation.feature', { n: selectedIDs.length }); }; diff --git a/modules/operations/orthogonalize.js b/modules/operations/orthogonalize.js index cb4a1a382..c8b89445d 100644 --- a/modules/operations/orthogonalize.js +++ b/modules/operations/orthogonalize.js @@ -125,7 +125,7 @@ export function operationOrthogonalize(context, selectedIDs) { operation.annotation = function() { - return t('operations.orthogonalize.annotation.' + _type + '.' + _amount); + return t('operations.orthogonalize.annotation.' + _type, { n: _actions.length }); }; diff --git a/modules/operations/reflect.js b/modules/operations/reflect.js index 9be80cfb9..2a0e17271 100644 --- a/modules/operations/reflect.js +++ b/modules/operations/reflect.js @@ -83,7 +83,7 @@ export function operationReflect(context, selectedIDs, axis) { operation.annotation = function() { - return t('operations.reflect.annotation.' + axis + '.' + multi); + return t('operations.reflect.annotation.' + axis + '.feature', { n: selectedIDs.length }); }; diff --git a/modules/operations/reverse.js b/modules/operations/reverse.js index 16e854826..55ad14c2d 100644 --- a/modules/operations/reverse.js +++ b/modules/operations/reverse.js @@ -41,9 +41,9 @@ export function operationReverse(context, selectedIDs) { var entity = context.hasEntity(act.entityID()); return entity && entity.type === 'node'; }).length; - var typeID = nodeActionCount === 0 ? 'line' : (nodeActionCount === acts.length ? 'point' : 'features'); - if (typeID !== 'features' && acts.length > 1) typeID += 's'; - return typeID; + if (nodeActionCount === 0) return 'line'; + if (nodeActionCount === acts.length) return 'point'; + return 'feature'; } @@ -63,7 +63,8 @@ export function operationReverse(context, selectedIDs) { operation.annotation = function() { - return t('operations.reverse.annotation.' + reverseTypeID()); + var acts = actions(); + return t('operations.reverse.annotation.' + reverseTypeID(), { n: acts.length }); }; diff --git a/modules/operations/rotate.js b/modules/operations/rotate.js index 574acd99e..b8a4c5ea6 100644 --- a/modules/operations/rotate.js +++ b/modules/operations/rotate.js @@ -67,7 +67,7 @@ export function operationRotate(context, selectedIDs) { operation.annotation = function() { return selectedIDs.length === 1 ? t('operations.rotate.annotation.' + context.graph().geometry(selectedIDs[0])) : - t('operations.rotate.annotation.multiple'); + t('operations.rotate.annotation.feature', { n: selectedIDs.length }); }; diff --git a/modules/operations/straighten.js b/modules/operations/straighten.js index f1829c15d..56b5b4050 100644 --- a/modules/operations/straighten.js +++ b/modules/operations/straighten.js @@ -20,7 +20,7 @@ export function operationStraighten(context, selectedIDs) { function chooseAction() { // straighten selected nodes if (_wayIDs.length === 0 && _nodeIDs.length > 2) { - _geometry = 'points'; + _geometry = 'point'; return actionStraightenNodes(_nodeIDs, context.projection); // straighten selected ways (possibly between range of 2 selected nodes) @@ -67,7 +67,7 @@ export function operationStraighten(context, selectedIDs) { _extent = utilTotalExtent(_nodeIDs, context.graph()); } - _geometry = _wayIDs.length === 1 ? 'line' : 'lines'; + _geometry = 'line'; return actionStraightenWay(selectedIDs, context.projection); } @@ -125,12 +125,12 @@ export function operationStraighten(context, selectedIDs) { var disable = operation.disabled(); return disable ? t('operations.straighten.' + disable + '.' + _amount) : - t('operations.straighten.description.' + _geometry); + t('operations.straighten.description.' + _geometry + (_wayIDs.length === 1 ? '' : 's')); }; operation.annotation = function() { - return t('operations.straighten.annotation.' + _geometry); + return t('operations.straighten.annotation.' + _geometry, { n: _wayIDs.length ? _wayIDs.length : _nodeIDs.length }); }; diff --git a/modules/ui/fields/check.js b/modules/ui/fields/check.js index b25d28f38..37c1bb3f2 100644 --- a/modules/ui/fields/check.js +++ b/modules/ui/fields/check.js @@ -163,7 +163,7 @@ export function uiFieldCheck(field, context) { } return graph; }, - t('operations.reverse.annotation') + t('operations.reverse.annotation.line', { n: 1 }) ); // must manually revalidate since no 'change' event was called diff --git a/modules/ui/intro/building.js b/modules/ui/intro/building.js index 989c70ee1..1fc26ce23 100644 --- a/modules/ui/intro/building.js +++ b/modules/ui/intro/building.js @@ -391,7 +391,7 @@ export function uiIntroBuilding(context, reveal) { // Something changed. Wait for transition to complete and check undo annotation. timeout(function() { - if (context.history().undoAnnotation() === t('operations.orthogonalize.annotation.feature.single')) { + if (context.history().undoAnnotation() === t('operations.orthogonalize.annotation.feature', { n: 1 })) { continueTo(doneSquare); } else { continueTo(retryClickSquare); @@ -721,7 +721,7 @@ export function uiIntroBuilding(context, reveal) { // Something changed. Wait for transition to complete and check undo annotation. timeout(function() { - if (context.history().undoAnnotation() === t('operations.circularize.annotation.single')) { + if (context.history().undoAnnotation() === t('operations.circularize.annotation.feature', { n: 1 })) { continueTo(play); } else { continueTo(retryClickCircle); diff --git a/modules/validations/impossible_oneway.js b/modules/validations/impossible_oneway.js index 66443757a..a6aaa597d 100644 --- a/modules/validations/impossible_oneway.js +++ b/modules/validations/impossible_oneway.js @@ -180,7 +180,7 @@ export function validationImpossibleOneway() { entityIds: [way.id], onClick: function(context) { var id = this.issue.entityIds[0]; - context.perform(actionReverse(id), t('operations.reverse.annotation')); + context.perform(actionReverse(id), t('operations.reverse.annotation.line', { n: 1 })); } })); } diff --git a/modules/validations/unsquare_way.js b/modules/validations/unsquare_way.js index 6b608243c..7a9ff52c3 100644 --- a/modules/validations/unsquare_way.js +++ b/modules/validations/unsquare_way.js @@ -67,7 +67,7 @@ export function validationUnsquareWay(context) { // use same degree threshold as for detection var autoAction = actionOrthogonalize(entity.id, context.projection, undefined, degreeThreshold); autoAction.transitionable = false; // when autofixing, do it instantly - autoArgs = [autoAction, t('operations.orthogonalize.annotation.feature.single')]; + autoArgs = [autoAction, t('operations.orthogonalize.annotation.feature', { n: 1 })]; } return [new validationIssue({ @@ -92,7 +92,7 @@ export function validationUnsquareWay(context) { // use same degree threshold as for detection context.perform( actionOrthogonalize(entityId, context.projection, undefined, degreeThreshold), - t('operations.orthogonalize.annotation.feature.single') + t('operations.orthogonalize.annotation.feature', { n: 1 }) ); // run after the squaring transition (currently 150ms) window.setTimeout(function() { completionHandler(); }, 175);