Improve hint text to aid in localization

- change the "Up to {num} ways" to "Up to 2 ways"
  (we don't plan to go above 2 for now)
- enumerate all the turn types No/Only/Allowed x Left/Right/Straight/U
- Add a line for "Click for" to let user know they can click to toggle

see https://github.com/openstreetmap/iD/pull/4768#pullrequestreview-100256196
This commit is contained in:
Bryan Housel
2018-03-01 00:58:53 -05:00
parent 241159b547
commit 78170f8fe9
3 changed files with 44 additions and 47 deletions
+14 -14
View File
@@ -229,20 +229,22 @@ en:
via: Via
via_node_only: "Node only"
via_up_to_one: "Up to 1 way"
via_up_to_multiple: "Up to {num} ways"
via_up_to_two: "Up to 2 ways"
help:
no: NO
only: ONLY
allowed: Allowed
indirect: "(indirect)"
turn:
left_turn: Left Turn
right_turn: Right Turn
u_turn: U-Turn
straight_on: Straight On
no_turn_string: "{no} {turn} {indirect}"
only_turn_string: "{only} {turn} {indirect}"
allowed_turn_string: "{turn} {allowed} {indirect}"
no_left_turn: "NO Left Turn {indirect}"
no_right_turn: "NO Right Turn {indirect}"
no_u_turn: "NO U-Turn {indirect}"
no_straight_on: "NO Straight On {indirect}"
only_left_turn: "ONLY Left Turn {indirect}"
only_right_turn: "ONLY Right Turn {indirect}"
only_u_turn: "ONLY U-Turn {indirect}"
only_straight_on: "ONLY Straight On {indirect}"
allowed_left_turn: "Left Turn Allowed {indirect}"
allowed_right_turn: "Right Turn Allowed {indirect}"
allowed_u_turn: "U-Turn Allowed {indirect}"
allowed_straight_on: "Straight On Allowed {indirect}"
from: FROM
via: VIA
to: TO
@@ -251,9 +253,7 @@ en:
via_names: "{via} {viaNames}"
select_from: "Click to select a {from} segment"
select_from_name: "Click to select {from} {fromName}"
toggle: Click to toggle turn restrictions.
toggle_on: 'Click to add a "{restriction}" restriction.'
toggle_off: 'Click to remove the "{restriction}" restriction.'
toggle: "Click for \"{turn}\""
undo:
tooltip: "Undo: {action}"
nothing: Nothing to undo.
+14 -14
View File
@@ -298,22 +298,24 @@
"via": "Via",
"via_node_only": "Node only",
"via_up_to_one": "Up to 1 way",
"via_up_to_multiple": "Up to {num} ways"
"via_up_to_two": "Up to 2 ways"
},
"help": {
"no": "NO",
"only": "ONLY",
"allowed": "Allowed",
"indirect": "(indirect)",
"turn": {
"left_turn": "Left Turn",
"right_turn": "Right Turn",
"u_turn": "U-Turn",
"straight_on": "Straight On"
"no_left_turn": "NO Left Turn {indirect}",
"no_right_turn": "NO Right Turn {indirect}",
"no_u_turn": "NO U-Turn {indirect}",
"no_straight_on": "NO Straight On {indirect}",
"only_left_turn": "ONLY Left Turn {indirect}",
"only_right_turn": "ONLY Right Turn {indirect}",
"only_u_turn": "ONLY U-Turn {indirect}",
"only_straight_on": "ONLY Straight On {indirect}",
"allowed_left_turn": "Left Turn Allowed {indirect}",
"allowed_right_turn": "Right Turn Allowed {indirect}",
"allowed_u_turn": "U-Turn Allowed {indirect}",
"allowed_straight_on": "Straight On Allowed {indirect}"
},
"no_turn_string": "{no} {turn} {indirect}",
"only_turn_string": "{only} {turn} {indirect}",
"allowed_turn_string": "{turn} {allowed} {indirect}",
"from": "FROM",
"via": "VIA",
"to": "TO",
@@ -322,9 +324,7 @@
"via_names": "{via} {viaNames}",
"select_from": "Click to select a {from} segment",
"select_from_name": "Click to select {from} {fromName}",
"toggle": "Click to toggle turn restrictions.",
"toggle_on": "Click to add a \"{restriction}\" restriction.",
"toggle_off": "Click to remove the \"{restriction}\" restriction."
"toggle": "Click for \"{turn}\""
}
},
"undo": {
+16 -19
View File
@@ -499,35 +499,26 @@ export function uiFieldRestrictions(field, context) {
var restrictionType = osmInferRestriction(vgraph, datum, projection);
var turnType = restrictionType.replace(/^(only|no)\_/, '');
var indirect = (datum.direct === false ? t('restriction.help.indirect') : '');
var klass, turnHtml;
var klass, turnText, nextText;
if (datum.no) {
klass = 'restrict';
turnHtml = t('restriction.help.no_turn_string', {
no: t('restriction.help.no'),
turn: t('restriction.help.turn.' + turnType),
indirect: indirect
});
turnText = t('restriction.help.turn.no_' + turnType, { indirect: indirect });
nextText = t('restriction.help.turn.only_' + turnType, { indirect: '' });
} else if (datum.only) {
klass = 'only';
turnHtml = t('restriction.help.only_turn_string', {
only: t('restriction.help.only'),
turn: t('restriction.help.turn.' + turnType),
indirect: indirect
});
turnText = t('restriction.help.turn.only_' + turnType, { indirect: indirect });
nextText = t('restriction.help.turn.allowed_' + turnType, { indirect: '' });
} else {
klass = 'allow';
turnHtml = t('restriction.help.allowed_turn_string', {
allowed: t('restriction.help.allowed'),
turn: t('restriction.help.turn.' + turnType),
indirect: indirect
});
turnText = t('restriction.help.turn.allowed_' + turnType, { indirect: indirect });
nextText = t('restriction.help.turn.no_' + turnType, { indirect: '' });
}
help
.append('div') // Turn Description
.append('div') // "NO Right Turn (indirect)"
.attr('class', 'qualifier ' + klass)
.html(turnHtml);
.text(turnText);
help
.append('div') // "FROM {fromName} TO {toName}"
@@ -555,6 +546,12 @@ export function uiFieldRestrictions(field, context) {
}));
}
if (!indirect) {
help
.append('div') // Click for "No Right Turn"
.text(t('restriction.help.toggle', { turn: nextText.trim() }));
}
highlightPathsFrom(null);
var alongIDs = datum.path.slice();
surface.selectAll(utilEntitySelector(alongIDs))
@@ -607,7 +604,7 @@ export function uiFieldRestrictions(field, context) {
function displayMaxVia(maxVia) {
return maxVia === 0 ? t('restriction.controls.via_node_only')
: maxVia === 1 ? t('restriction.controls.via_up_to_one')
: t('restriction.controls.via_up_to_multiple', { num: maxVia });
: t('restriction.controls.via_up_to_two');
}