From: Tom Hughes Date: Fri, 27 Feb 2015 17:00:28 +0000 (+0000) Subject: Fix OSRM directions issues X-Git-Tag: live~4233 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/fa3ccdfd49bf62737d163fe3a637939f291b7815 Fix OSRM directions issues Don't rely on trailing spaces in translation strings as they aren't reliably preserved, and make "exit" translatable. Fixes #915 --- diff --git a/app/assets/javascripts/index/directions/osrm.js b/app/assets/javascripts/index/directions/osrm.js index b58ba30a2..2156bf309 100644 --- a/app/assets/javascripts/index/directions/osrm.js +++ b/app/assets/javascripts/index/directions/osrm.js @@ -66,9 +66,10 @@ function OSRMEngine() { var instText = "" + (i + 1) + ". "; 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] ? "" + s[1] + "" : I18n.t('javascripts.directions.instructions.unnamed'); } if ((i + 1) < data.route_instructions.length) { diff --git a/config/locales/en.yml b/config/locales/en.yml index e82fbdf02..a5c2f6453 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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"