mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-20 23:44:47 +02:00
Show count and use plural forms for more operation strings (re: #8014)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 });
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -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 });
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -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 });
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -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 });
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -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 });
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -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 });
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -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 });
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 }));
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user