Show exit numbers for off ramps in OSRM directions

Fixes #1768
This commit is contained in:
Tom Hughes 2018-02-25 20:51:11 +00:00
parent 94ffa36306
commit d8eda6ba03
2 changed files with 21 additions and 18 deletions

View file

@ -117,19 +117,14 @@ function OSRMEngine() {
instText += I18n.t(template + '_without_exit', { name: name } ); instText += I18n.t(template + '_without_exit', { name: name } );
} }
} else if (step.maneuver.type.match(/on ramp|off ramp/)) { } else if (step.maneuver.type.match(/on ramp|off ramp/)) {
if (step.destinations) { var params = {};
if (namedRoad) { if (step.exits && step.maneuver.type.match(/off ramp/)) params.exit = step.exits;
instText += I18n.t(template + '_with_name_and_directions', { name: name, directions: destinations } ); if (step.destinations) params.directions = step.destinations;
} else { if (namedRoad) params.directions = name;
instText += I18n.t(template + '_with_directions', { directions: destinations } ); if (Object.keys(params).length > 0) {
} template = template + "_with_" + Object.keys(params).join("_");
} else {
if (namedRoad) {
instText += I18n.t(template + '_without_exit', { name: name });
} else {
instText += I18n.t(template + '_without_directions');
}
} }
instText += I18n.t(template, params);
} else { } else {
instText += I18n.t(template + '_without_exit', { name: name }); instText += I18n.t(template + '_without_exit', { name: name });
} }

View file

@ -2329,10 +2329,14 @@ en:
instructions: instructions:
continue_without_exit: Continue on %{name} continue_without_exit: Continue on %{name}
slight_right_without_exit: Slight right onto %{name} slight_right_without_exit: Slight right onto %{name}
offramp_right_without_exit: Take the ramp on the right onto %{name} offramp_right: Take the ramp on the right
offramp_right_with_exit: Take exit %{exit} on the right
offramp_right_with_exit_name: Take exit %{exit} on the right onto %{name}
offramp_right_with_exit_directions: Take exit %{exit} on the right towards %{directions}
offramp_right_with_exit_name_directions: Take exit %{exit} on the right onto %{name}, towards %{directions}
offramp_right_with_name: Take the ramp on the right onto %{name}
offramp_right_with_directions: Take the ramp on the right towards %{directions} offramp_right_with_directions: Take the ramp on the right towards %{directions}
offramp_right_with_name_and_directions: Take the ramp on the right onto %{name}, towards %{directions} offramp_right_with_name_directions: Take the ramp on the right onto %{name}, towards %{directions}
offramp_right_without_directions: Take the ramp on the right
onramp_right_without_exit: Turn right on the ramp onto %{name} onramp_right_without_exit: Turn right on the ramp onto %{name}
onramp_right_with_directions: Turn right onto the ramp towards %{directions} onramp_right_with_directions: Turn right onto the ramp towards %{directions}
onramp_right_with_name_and_directions: Turn right on the ramp onto %{name}, towards %{directions} onramp_right_with_name_and_directions: Turn right on the ramp onto %{name}, towards %{directions}
@ -2345,10 +2349,14 @@ en:
uturn_without_exit: U-turn along %{name} uturn_without_exit: U-turn along %{name}
sharp_left_without_exit: Sharp left onto %{name} sharp_left_without_exit: Sharp left onto %{name}
turn_left_without_exit: Turn left onto %{name} turn_left_without_exit: Turn left onto %{name}
offramp_left_without_exit: Take the ramp on the left onto %{name} offramp_left: Take the ramp on the left
offramp_left_with_exit: Take exit %{exit} on the left
offramp_left_with_exit_name: Take exit %{exit} on the left onto %{name}
offramp_left_with_exit_directions: Take exit %{exit} on the left towards %{directions}
offramp_left_with_exit_name_directions: Take exit %{exit} on the left onto %{name}, towards %{directions}
offramp_left_with_name: Take the ramp on the left onto %{name}
offramp_left_with_directions: Take the ramp on the left towards %{directions} offramp_left_with_directions: Take the ramp on the left towards %{directions}
offramp_left_with_name_and_directions: Take the ramp on the left onto %{name}, towards %{directions} offramp_left_with_name_directions: Take the ramp on the left onto %{name}, towards %{directions}
offramp_left_without_directions: Take the ramp on the left
onramp_left_without_exit: Turn left on the ramp onto %{name} onramp_left_without_exit: Turn left on the ramp onto %{name}
onramp_left_with_directions: Turn left onto the ramp towards %{directions} onramp_left_with_directions: Turn left onto the ramp towards %{directions}
onramp_left_with_name_and_directions: Turn left on the ramp onto %{name}, towards %{directions} onramp_left_with_name_and_directions: Turn left on the ramp onto %{name}, towards %{directions}