Leaflet-routing: http://www.liedman.net/leaflet-routing-machine/
If you initialize the L.Routing.control like this:
var router = new L.Routing.control({
waypoints: [L.latLng(57.74, 11.94), L.latLng(57.6792, 11.949)],
language: 'pt' // here's the magic
}).addTo(map);
It appears translated on the page.
but when I access the instructions in the 'router' object: router._routes[0].instructions[0] it returns something like this:
router._routes[0].instructions[0] = {
direction: "E",
distance: 13041.6,
exit: undefined,
index: 0,
mode: "driving",
modifier: undefined,
road: "",
time: 860.2,
type: "Head"
}
How can I get the translation formatted like in the interface?
Best Answer
Find out.
This doesn't work for some reason:
but this do:
You have for loop through all the instructions and mount the strings yourself but is better than nothing.