From: Jamie Guthrie Date: Sun, 29 Apr 2018 18:53:57 +0000 (+0100) Subject: Merge branch 'master' into convert_roundabout_exits X-Git-Tag: live~3061^2~1^2 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/76bc5eba0617e36ebb853d24212543d0e1d4904d?hp=8bd001f1282b7a33a71c0565504e160dbe567d5d Merge branch 'master' into convert_roundabout_exits --- diff --git a/app/assets/javascripts/index/directions/osrm.js b/app/assets/javascripts/index/directions/osrm.js index 84f085c5a..e249ce1f5 100644 --- a/app/assets/javascripts/index/directions/osrm.js +++ b/app/assets/javascripts/index/directions/osrm.js @@ -60,6 +60,12 @@ function OSRMEngine() { 'depart': 8, 'arrive': 14 }; + var numToWord = function(num) { + if(num > 10) { + num = 11; + } + return ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "gt_ten"][num]; + }; var transformed_steps = input_steps.map(function(step, idx) { var maneuver_id; @@ -112,7 +118,7 @@ function OSRMEngine() { if (step.maneuver.type.match(/rotary|roundabout/)) { if (step.maneuver.exit) { - instText += I18n.t(template + '_with_exit', { exit: step.maneuver.exit, name: name } ); + instText += I18n.t(template + '_with_exit', { exit: I18n.t('javascripts.directions.instructions.exit_counts.' + numToWord(step.maneuver.exit)), name: name } ); } else { instText += I18n.t(template + '_without_exit', { name: name } ); } diff --git a/config/locales/en.yml b/config/locales/en.yml index fd0317df1..a2a575492 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2384,6 +2384,18 @@ en: continue_with_exit: Exit onto %{name} unnamed: "unnamed road" courtesy: "Directions courtesy of %{link}" + exit_counts: + one: "1st" + two: "2nd" + three: "3rd" + four: "4th" + five: "5th" + six: "6th" + seven: "7th" + eight: "8th" + nine: "9th" + ten: "10th" + gt_ten: "" time: "Time" query: node: Node