});
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();
*** 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',
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
// Create base table
$("#content").removeClass("overlay-sidebar");
$('#sidebar_content').empty();
- var html='<h2><a class="geolink" href="#" onclick="$(~.close_directions~).click();return false;"><span class="icon close"></span></a>Directions</h2>'.replace(/~/g,"'");
+ var html='<h2><a class="geolink" href="#" onclick="$(~.close_directions~).click();return false;"><span class="icon close"></span></a>' + I18n.t('javascripts.directions.directions') + '</h2>'.replace(/~/g,"'");
html+="<table id='turnbyturn' />";
$('#sidebar_content').html(html);
// Add each row
};
r['gotRoute'+num]=function(data) { r.awaitingRoute=false; list[num].gotRoute(r,data); };
}
- select.append("<option value='"+i+"'>"+list[i].name+"</option>");
+ select.append("<option value='"+i+"'>"+I18n.t(list[i].name)+"</option>");
}
r.engines=list;
r.chosenEngine=list[0]; // default to first engine
// 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,
}
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);
// 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;
// *** needs to give credit
OSM.RoutingEngines.list.push({
- name: 'Bicycle (MapQuest Open)',
+ name: "javascripts.directions.engines.mapquest_bike",
draggable: false,
_hints: {},
MQ_SPRITE_MAP: {
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=");
// *** 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) {
var instText="<b>"+(i+1)+".</b> ";
instText+=TURN_INSTRUCTIONS[instCodes[0]];
if (instCodes[1]) { instText+="exit "+instCodes[1]+" "; }
- if (instCodes[0]!=15) { instText+=s[1] ? "<b>"+s[1]+"</b>" : "(unnamed)"; }
+ if (instCodes[0]!=15) { instText+=s[1] ? "<b>"+s[1]+"</b>" : 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 });
<div class='query_wrapper routing'>
<%= 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)" %>
<select class='routing_engines' name='routing_engines' onchange="OSM.routing.selectEngine(event)"></select>
</div>
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
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
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"
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"