diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js
index d668d6bf7..8f989deaf 100644
--- a/app/assets/javascripts/index.js
+++ b/app/assets/javascripts/index.js
@@ -349,7 +349,7 @@ $(document).ready(function () {
});
OSM.routing = OSM.Routing(map,'OSM.routing',$('.query_wrapper.routing'));
- OSM.routing.chooseEngine('Car (OSRM)');
+ OSM.routing.chooseEngine('javascripts.directions.engines.osrm_car');
$(".get_directions").on("click",function(e) {
e.preventDefault();
diff --git a/app/assets/javascripts/routing.js.erb b/app/assets/javascripts/routing.js.erb
index b6bf9f4a0..3c6db9999 100644
--- a/app/assets/javascripts/routing.js.erb
+++ b/app/assets/javascripts/routing.js.erb
@@ -14,24 +14,7 @@
*** add YOURS engine
*/
-var TURN_INSTRUCTIONS=["",
- "Continue on ", // 1
- "Slight right onto ", // 2
- "Turn right onto ", // 3
- "Sharp right onto ", // 4
- "U-turn along ", // 5
- "Sharp left onto ", // 6
- "Turn left onto ", // 7
- "Slight left onto ", // 8
- "(via point) ", // 9
- "Follow ", // 10
- "At roundabout take ", // 11
- "Leave roundabout - ", // 12
- "Stay on roundabout - ", // 13
- "Start at end of ", // 14
- "Reach destination", // 15
- "Go against one-way on ", // 16
- "End of one-way on "] // 17
+var TURN_INSTRUCTIONS=[]
var ROUTING_POLYLINE={
color: '#03f',
@@ -48,6 +31,25 @@ OSM.RoutingEngines={
OSM.Routing=function(map,name,jqSearch) {
var r={};
+ TURN_INSTRUCTIONS=["",
+ I18n.t('javascripts.directions.instructions.continue_on'), // 1
+ I18n.t('javascripts.directions.instructions.slight_right'), // 2
+ I18n.t('javascripts.directions.instructions.turn_right'), // 3
+ I18n.t('javascripts.directions.instructions.sharp_right'), // 4
+ I18n.t('javascripts.directions.instructions.uturn'), // 5
+ I18n.t('javascripts.directions.instructions.sharp_left'), // 6
+ I18n.t('javascripts.directions.instructions.turn_left'), // 7
+ I18n.t('javascripts.directions.instructions.slight_left'), // 8
+ I18n.t('javascripts.directions.instructions.via_point'), // 9
+ I18n.t('javascripts.directions.instructions.follow'), // 10
+ I18n.t('javascripts.directions.instructions.roundabout'), // 11
+ I18n.t('javascripts.directions.instructions.leave_roundabout'), // 12
+ I18n.t('javascripts.directions.instructions.stay_roundabout'), // 13
+ I18n.t('javascripts.directions.instructions.start'), // 14
+ I18n.t('javascripts.directions.instructions.destination'), // 15
+ I18n.t('javascripts.directions.instructions.against_oneway'), // 16
+ I18n.t('javascripts.directions.instructions.end_oneway')] // 17
+
r.map=map; // Leaflet map
r.name=name; // global variable name of this instance (needed for JSONP)
r.jqSearch=jqSearch; // JQuery object for search panel
@@ -184,7 +186,7 @@ OSM.Routing=function(map,name,jqSearch) {
// Create base table
$("#content").removeClass("overlay-sidebar");
$('#sidebar_content').empty();
- var html='
Directions
'.replace(/~/g,"'");
+ var html='' + I18n.t('javascripts.directions.directions') + '
'.replace(/~/g,"'");
html+="";
$('#sidebar_content').html(html);
// Add each row
@@ -242,7 +244,7 @@ OSM.Routing=function(map,name,jqSearch) {
};
r['gotRoute'+num]=function(data) { r.awaitingRoute=false; list[num].gotRoute(r,data); };
}
- select.append("");
+ select.append("");
}
r.engines=list;
r.chosenEngine=list[0]; // default to first engine
diff --git a/app/assets/javascripts/routing_engines/cloudmade_foot.js b/app/assets/javascripts/routing_engines/cloudmade_foot.js
index 5193c6472..5c1ba0e97 100644
--- a/app/assets/javascripts/routing_engines/cloudmade_foot.js
+++ b/app/assets/javascripts/routing_engines/cloudmade_foot.js
@@ -4,7 +4,7 @@
// http://cloudmade.com/documentation/routing
OSM.RoutingEngines.list.push({
- name: 'Foot (CloudMade)',
+ name: "javascripts.directions.engines.cloudmade_foot",
draggable: false,
CM_SPRITE_MAP: {
"C": 1,
@@ -25,7 +25,8 @@ OSM.RoutingEngines.list.push({
}
url+=p.join(',');
url+="/foot.js";
- this.requestJSONP(url+"?callback=");
+ url+="?lang=" + I18n.currentLocale();
+ this.requestJSONP(url+"&callback=");
},
gotRoute: function(router,data) {
router.setPolyline(data.route_geometry);
diff --git a/app/assets/javascripts/routing_engines/graphhopper_bicycle.js b/app/assets/javascripts/routing_engines/graphhopper_bicycle.js
index 7f7c83c80..6245124b1 100644
--- a/app/assets/javascripts/routing_engines/graphhopper_bicycle.js
+++ b/app/assets/javascripts/routing_engines/graphhopper_bicycle.js
@@ -1,11 +1,11 @@
// GraphHopper bicycle engine
OSM.RoutingEngines.list.push({
- name: 'Bicycle (GraphHopper)',
+ name: "javascripts.directions.engines.graphhopper_bike",
draggable: true,
_hints: {},
getRoute: function(isFinal, points) {
- var url = "http://graphhopper.com/routing/api/route?vehicle=bike&locale=en";
+ var url = "http://graphhopper.com/routing/api/route?vehicle=bike&locale=" + I18n.currentLocale();
for (var i = 0; i < points.length; i++) {
var pair = points[i].join(',');
url += "&point=" + pair;
diff --git a/app/assets/javascripts/routing_engines/mapquest_bicycle.js b/app/assets/javascripts/routing_engines/mapquest_bicycle.js
index f74ccba15..b08096955 100644
--- a/app/assets/javascripts/routing_engines/mapquest_bicycle.js
+++ b/app/assets/javascripts/routing_engines/mapquest_bicycle.js
@@ -6,7 +6,7 @@
// *** needs to give credit
OSM.RoutingEngines.list.push({
- name: 'Bicycle (MapQuest Open)',
+ name: "javascripts.directions.engines.mapquest_bike",
draggable: false,
_hints: {},
MQ_SPRITE_MAP: {
@@ -36,6 +36,7 @@ OSM.RoutingEngines.list.push({
url+="&from="+from.join(',');
url+="&to="+to.join(',');
url+="&routeType=bicycle";
+ //url+="&locale=" + I18n.currentLocale(); //Doesn't actually work. MapQuest requires full locale e.g. "de_DE", but I18n only provides language, e.g. "de"
url+="&manMaps=false";
url+="&shapeFormat=raw&generalize=0";
this.requestJSONP(url+"&callback=");
diff --git a/app/assets/javascripts/routing_engines/osrm_car.js b/app/assets/javascripts/routing_engines/osrm_car.js
index cb80c5615..0011b0205 100644
--- a/app/assets/javascripts/routing_engines/osrm_car.js
+++ b/app/assets/javascripts/routing_engines/osrm_car.js
@@ -3,7 +3,7 @@
// *** need to clear hints at some point
OSM.RoutingEngines.list.push({
- name: 'Car (OSRM)',
+ name: "javascripts.directions.engines.osrm_car",
draggable: true,
_hints: {},
getRoute: function(isFinal,points) {
@@ -34,7 +34,7 @@ OSM.RoutingEngines.list.push({
var instText=""+(i+1)+". ";
instText+=TURN_INSTRUCTIONS[instCodes[0]];
if (instCodes[1]) { instText+="exit "+instCodes[1]+" "; }
- if (instCodes[0]!=15) { instText+=s[1] ? ""+s[1]+"" : "(unnamed)"; }
+ if (instCodes[0]!=15) { instText+=s[1] ? ""+s[1]+"" : I18n.t('javascripts.directions.instructions.unnamed'); }
steps.push([line[s[3]], s[0].split('-')[0], instText, s[2]]);
}
if (steps.length) router.setItinerary({ steps: steps });
diff --git a/app/views/layouts/_search.html.erb b/app/views/layouts/_search.html.erb
index e1c85f3b7..e9aa76f5a 100644
--- a/app/views/layouts/_search.html.erb
+++ b/app/views/layouts/_search.html.erb
@@ -16,9 +16,9 @@
<%= image_tag "marker-green.png", :class => 'routing_marker', :id => 'marker_from', :draggable => 'true' %>
- <%= text_field_tag "route_from", params[:from], :placeholder => "From", :onchange=>"OSM.routing.geocode('route_from',event)" %>
+ <%= text_field_tag "route_from", params[:from], :placeholder => t('site.search.from'), :onchange=>"OSM.routing.geocode('route_from',event)" %>
<%= image_tag "marker-red.png" , :class => 'routing_marker', :id => 'marker_to' , :draggable => 'true' %>
- <%= text_field_tag "route_to" , params[:to] , :placeholder => "To" , :onchange=>"OSM.routing.geocode('route_to' ,event)" %>
+ <%= text_field_tag "route_to" , params[:to] , :placeholder => t('site.search.to') , :onchange=>"OSM.routing.geocode('route_to' ,event)" %>
diff --git a/config/locales/de.yml b/config/locales/de.yml
index 7d5cfc60e..16bdfbe1a 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -929,6 +929,32 @@ de:
javascripts:
close: Schließen
edit_help: Wähle eine höhere Zoomstufe und verschiebe die Karte an einen Ort, den du bearbeiten möchtest, und klicke hier.
+ directions:
+ directions: "Fahranweisungen: "
+ engines:
+ graphhopper_bike: "Fahrrad (GraphHopper)"
+ mapquest_bike: "Fahrrad (MapQuest)"
+ osrm_car: "Auto (OSRM)"
+ cloudmade_foot: "Fuss (Cloudmade)"
+ instructions:
+ continue_on: "Weiter auf "
+ slight_right: "Rechts halten auf "
+ turn_right: "Rechts abbiegen auf "
+ sharp_right: "Hart rechts auf "
+ uturn: "U-turn along "
+ sharp_left: "Hart links auf "
+ turn_left: "Links abbiegen auf "
+ slight_left: "Links halten auf "
+ via_point: "(via point) "
+ follow: "Folge "
+ roundabout: "Im Kreisverkehr nehme "
+ leave_roundabout: "Verlasse den Kreisverkehr - "
+ stay_roundabout: "Stay on roundabout - "
+ start: "Start at end of "
+ destination: "Ziel erreicht"
+ against_oneway: "Go against one-way on "
+ end_oneway: "Ende der Einbahnstrasse "
+ unnamed: "(unbekannt)"
key:
title: Legende
tooltip: Legende
@@ -1467,6 +1493,12 @@ de:
preview: Vorschau
search:
search: Suchen
+ get_directions: "Route berechnen"
+ get_directions_title: "Routenberechnung zwischen zwei Orten"
+ close_directions: "Schliessen der Route"
+ close_directions_title: "Schliessen des Routenmenus"
+ from: "Von"
+ to: "Nach"
submit_text: Los
where_am_i: Wo bin ich?
where_am_i_title: Die momentane Position mit der Suchmaschine anzeigen
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 4bc926f2b..e567a497d 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -1328,6 +1328,8 @@ en:
get_directions_title: "Find directions between two points"
close_directions: "Close directions"
close_directions_title: "Close the directions panel"
+ from: "From"
+ to: "To"
where_am_i: "Where am I?"
where_am_i_title: Describe the current location using the search engine
submit_text: "Go"
@@ -2116,6 +2118,32 @@ en:
comment_and_resolve: Comment & Resolve
comment: Comment
edit_help: Move the map and zoom in on a location you want to edit, then click here.
+ directions:
+ engines:
+ graphhopper_bike: "Bicycle (GraphHopper)"
+ mapquest_bike: "Bicycle (MapQuest)"
+ osrm_car: "Car (OSRM)"
+ cloudmade_foot: "Foot (Cloudmade)"
+ directions: "Directions"
+ 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 leeeeft 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 "
+ unnamed: "(unnamed)"
redaction:
edit:
description: "Description"