]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/directions/osrm.js
Show exit numbers for off ramps in OSRM directions
[rails.git] / app / assets / javascripts / index / directions / osrm.js
index e31c053ef7877bb62b5469c3dcbd83e71df147a5..f2276c11f3c7c6e604304efc6829a971627e0a7e 100644 (file)
@@ -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 });
         }