]> git.openstreetmap.org Git - rails.git/commitdiff
Minor fixes to the I18n code of routing
authorKai Krueger <kakrueger@gmail.com>
Sat, 29 Mar 2014 22:47:42 +0000 (16:47 -0600)
committerKai Krueger <kakrueger@gmail.com>
Sat, 29 Mar 2014 22:47:42 +0000 (16:47 -0600)
MapQuest instructions still don't translate, as that backend doesn't accept
simple language locals but require country codes as well.

app/assets/javascripts/routing.js.erb
app/assets/javascripts/routing_engines/graphhopper.js
app/assets/javascripts/routing_engines/mapquest.js
app/assets/javascripts/routing_engines/osrm.js
config/locales/de.yml
config/locales/en.yml

index 84bf178328954205c4ade68ca92f68eb4da71a10..3f38beef4382a6484c273adad28e3830a0007894 100644 (file)
@@ -216,7 +216,7 @@ OSM.Routing=function(map,name,jqSearch) {
             $('#turnbyturn').append(row);
             cumulative+=step[3];
         }
-        $('#sidebar_content').append('<p id="routing_credit">' + r.chosenEngine.creditline + '</p>');
+        $('#sidebar_content').append('<p id="routing_credit">' + I18n.t('javascripts.directions.instructions.courtesy',{link: r.chosenEngine.creditline}) + '</p>');
 
     };
     r.clickTurn=function(instruction,latlng) {
index 6d83e26e2839b721454cd9722caf2352556105af..0f29c162b8ffe57da6ed290aef3577da15159560 100644 (file)
@@ -1,6 +1,7 @@
 GraphHopperEngine = function(vehicleName, vehicleParam, locale) {
     this.vehicleName = vehicleName;
     this.vehicleParam = vehicleParam;
+    //At this point the local system isn't correctly initialised yet, so we don't have accurate information about current locale
     this.locale = locale;
     if (!locale)
         this.locale = "en";
@@ -10,12 +11,13 @@ GraphHopperEngine.prototype.createConfig = function() {
     var that = this;
     return {
         name: "javascripts.directions.engines.graphhopper_"+this.vehicleName.toLowerCase(),
+            creditline: '<a href="http://graphhopper.com/" target="_blank">Graphhopper</a>',
         draggable: false,
         _hints: {},
         getRoute: function(isFinal, points) {
             var url = "http://graphhopper.com/routing/api/route?" 
                     + that.vehicleParam 
-                    + "&locale=" + that.locale;
+                    + "&locale=" + I18n.currentLocale();
             for (var i = 0; i < points.length; i++) {
                 var pair = points[i].join(',');
                 url += "&point=" + pair;
index dc854ccdc9dffd38ccbfc5b88888e110f01adb12..39e47706aff72bcd4a6dd572cca971ea643e9689 100644 (file)
@@ -15,7 +15,7 @@ MapQuestEngine.prototype.createConfig = function() {
     var that = this;
     return {
         name: "javascripts.directions.engines.mapquest_"+this.vehicleName.toLowerCase(),
-        creditline: 'Directions courtesy of <a href="http://www.mapquest.com/" target="_blank">MapQuest</a> <img src="http://developer.mapquest.com/content/osm/mq_logo.png">',
+        creditline: '<a href="http://www.mapquest.com/" target="_blank">MapQuest</a> <img src="http://developer.mapquest.com/content/osm/mq_logo.png">',
         draggable: false,
         _hints: {},
         MQ_SPRITE_MAP: {
@@ -45,7 +45,7 @@ MapQuestEngine.prototype.createConfig = function() {
             url+="&from="+from.join(',');
             url+="&to="+to.join(',');
             url+="&"+that.vehicleParam;
-            //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+="&locale=" + I18n.currentLocale(); //Doesn't actually work. MapQuest requires full locale e.g. "de_DE", but I18n may only provides language, e.g. "de"
             url+="&manMaps=false";
             url+="&shapeFormat=raw&generalize=0&unit=k";
             this.requestCORS(url);
index 660a306ea093e6d17bbb6a248acc9d4848d23075..b40d5b3069325ad757dbc853a729f84a6bcaea14 100644 (file)
@@ -13,7 +13,7 @@ OSRMEngine.prototype.createConfig = function() {
     var that = this;
     return {
         name: "javascripts.directions.engines.osrm_"+this.vehicleName.toLowerCase(),
-        creditline: 'Directions courtesy of <a href="http://project-osrm.org/" target="_blank">OSRM</a>',
+            creditline: '<a href="http://project-osrm.org/" target="_blank">OSRM</a>',
         draggable: true,
         _hints: {},
         getRoute: function(isFinal,points) {
index d2d9e9349d59c244e0a02ac4aa58b6d6ab98a8dc..798105ee0df8d94cb95017ffbd7eb18f87074cd3 100644 (file)
@@ -944,10 +944,17 @@ de:
     directions:
       directions: "Fahranweisungen: "
       engines:
-        graphhopper_bike: "Fahrrad (GraphHopper)"
-        mapquest_bike: "Fahrrad (MapQuest)"
+        graphhopper_bicycle: "Fahrrad (GraphHopper)"
+        graphhopper_foot: "Fuss (GraphHopper)"
+        mapquest_bicycle: "Fahrrad (MapQuest)"
+        mapquest_foot: "Fuss (MapQuest)"
+        mapquest_car: "Auto (MapQuest)"
         osrm_car: "Auto (OSRM)"
-        cloudmade_foot: "Fuss (Cloudmade)"
+      distance: "Distanz:"
+      time: "Zeit:"
+      errors:
+        no_route: "Wir konnten keine Strecke zwischen diesen beiden Orten berechnen."
+        no_place: "Wir konnten den Ort nicht finden."
       instructions:
         continue_on: "Weiter auf "
         slight_right: "Rechts halten auf "
@@ -967,6 +974,7 @@ de:
         against_oneway: "Go against one-way on "
         end_oneway: "Ende der Einbahnstrasse "
         unnamed: "(unbekannt)"
+        courtesy: "Fahranweisungen stammen von %{link}"
     key: 
       title: Legende
       tooltip: Legende
index 4384fda865930c7249da06cdb449b73384bdaa99..7787fde86b19ef2a2ad27e794aa6c78e37eb888b 100644 (file)
@@ -2151,6 +2151,7 @@ en:
         against_oneway: "Go against one-way on "
         end_oneway: "End of one-way on "
         unnamed: "(unnamed)"
+        courtesy: "Directions courtesy of %{link}"
       time: "Time"
   redaction:
     edit: