X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/94ffa36306c58a4f40bf84b053f76c5293f3d65e..d8eda6ba03f757d0cd5997b788d660aad2bf2e3c:/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..f2276c11f 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 = step.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 }); }