Fix OSRM directions issues
authorTom Hughes <tom@compton.nu>
Fri, 27 Feb 2015 17:00:28 +0000 (17:00 +0000)
committerTom Hughes <tom@compton.nu>
Fri, 27 Feb 2015 17:00:28 +0000 (17:00 +0000)
Don't rely on trailing spaces in translation strings as they
aren't reliably preserved, and make "exit" translatable.

Fixes #915

app/assets/javascripts/index/directions/osrm.js
config/locales/en.yml

index b58ba30..2156bf3 100644 (file)
@@ -66,9 +66,10 @@ function OSRMEngine() {
             var instText = "<b>" + (i + 1) + ".</b> ";
             instText += TURN_INSTRUCTIONS[instCodes[0]];
             if (instCodes[1]) {
-              instText += "exit " + instCodes[1] + " ";
+              instText += I18n.t('javascripts.directions.instructions.exit', { exit: instCodes[1] } );
             }
             if (instCodes[0] !== 15) {
+              instText += " ";
               instText += s[1] ? "<b>" + s[1] + "</b>" : I18n.t('javascripts.directions.instructions.unnamed');
             }
             if ((i + 1) < data.route_instructions.length) {
index e82fbdf..a5c2f64 100644 (file)
@@ -2193,23 +2193,24 @@ en:
         no_route: "Couldn't find a route between those two places."
         no_place: "Sorry - couldn't find that place."
       instructions:
-        continue_on: "Continue on "
-        slight_right: "Slight right onto "
-        turn_right: "Turn right onto "
-        sharp_right: "Sharp right onto "
-        uturn: "U-turn along "
-        sharp_left: "Sharp left onto "
-        turn_left: "Turn left onto "
-        slight_left: "Slight left onto "
-        via_point: "(via point) "
-        follow:  "Follow "
-        roundabout: "At roundabout take "
-        leave_roundabout: "Leave roundabout - "
-        stay_roundabout: "Stay on roundabout - "
-        start: "Start at end of "
-        destination: "Reach destination"
-        against_oneway: "Go against one-way on "
-        end_oneway: "End of one-way on "
+        continue_on: Continue on
+        slight_right: Slight right onto
+        turn_right: Turn right onto
+        sharp_right: Sharp right onto
+        uturn: U-turn along
+        sharp_left: Sharp left onto
+        turn_left: Turn left onto
+        slight_left: Slight left onto
+        via_point: (via point)
+        follow: Follow
+        roundabout: At roundabout take
+        leave_roundabout: Leave roundabout -
+        stay_roundabout: Stay on roundabout -
+        start: Start at end of
+        destination: Reach destination
+        against_oneway: Go against one-way on
+        end_oneway: End of one-way on
+        exit: exit %{exit}
         unnamed: "(unnamed)"
         courtesy: "Directions courtesy of %{link}"
       time: "Time"