X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/424b6ef1cf760c4a3e27ac1e6f612ae42a9cd493..e44f856b53fcba5b44af37126579a034ef654676:/app/assets/javascripts/index/directions/osrm.js diff --git a/app/assets/javascripts/index/directions/osrm.js b/app/assets/javascripts/index/directions/osrm.js index e31c053ef..84f085c5a 100644 --- a/app/assets/javascripts/index/directions/osrm.js +++ b/app/assets/javascripts/index/directions/osrm.js @@ -117,19 +117,14 @@ function OSRMEngine() { instText += I18n.t(template + '_without_exit', { name: name } ); } } else if (step.maneuver.type.match(/on ramp|off ramp/)) { - if (step.destinations) { - if (namedRoad) { - instText += I18n.t(template + '_with_name_and_directions', { name: name, directions: destinations } ); - } else { - instText += I18n.t(template + '_with_directions', { directions: destinations } ); - } - } else { - if (namedRoad) { - instText += I18n.t(template + '_without_exit', { name: name }); - } else { - instText += I18n.t(template + '_without_directions'); - } + var params = {}; + if (step.exits && step.maneuver.type.match(/off ramp/)) params.exit = step.exits; + if (step.destinations) params.directions = destinations; + if (namedRoad) params.directions = name; + if (Object.keys(params).length > 0) { + template = template + "_with_" + Object.keys(params).join("_"); } + instText += I18n.t(template, params); } else { instText += I18n.t(template + '_without_exit', { name: name }); }