leaflet-routing-machine
leaflet-routing-machine copied to clipboard
Language support
Hi, first thanks a lot for your work! But please let me make a suggestion: The file leaflet-routing-machine.js (leaflet-routing-machine.min.js) is getting quite big in the meanwhile and therefore takes longer to download it when implementing it in your own projects. At the same time there are very "exotic" languages in this file which maybe you never need in your personal project. So would it be better to provide these languages in seperate files so the developer can add those languages he actually wants/needs to have in his own project?
Best regards Ruth
Hi Ruth, thanks for you suggestion and also great to hear you're finding Leaflet Routing Machine useful.
In theory, I think your suggestion is sound, but as it is now, these translations are incorporated from the osrm-text-instructions package, which is included in the pre-built bundle. I don't think it's possible for me to break out the actual languages from it, but I should say I haven't looked closely.
Also, at the moment I have very limited amount of time to spend on Leaflet Routing Machine, so it's not likely I will have time to do anything like this at this time. Help is of course welcome, as long as we can agree on a way to do this that doesn't cause trouble for other users.
Hi Per,
thanks very much for your response.
I know the time..
But I am not sure whether my help is of use…, I am just happy that I got through your code to make minor adjustments there. So I deleted those “exotic” languages as well.
Again thanks a lot for your work!
Ruth
Von: Per Liedman [mailto:[email protected]] Gesendet: Dienstag, 21. November 2017 15:50 An: perliedman/leaflet-routing-machine [email protected] Cc: RuthLanguismedia [email protected]; Author [email protected] Betreff: Re: [perliedman/leaflet-routing-machine] Language support (#446)
Hi Ruth, thanks for you suggestion and also great to hear you're finding Leaflet Routing Machine useful.
In theory, I think your suggestion is sound, but as it is now, these translations are incorporated from the osrm-text-instructions package, which is included in the pre-built bundle. I don't think it's possible for me to break out the actual languages from it, but I should say I haven't looked closely.
Also, at the moment I have very limited amount of time to spend on Leaflet Routing Machine, so it's not likely I will have time to do anything like this at this time. Help is of course welcome, as long as we can agree on a way to do this that doesn't cause trouble for other users.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/perliedman/leaflet-routing-machine/issues/446#issuecomment-346049439 , or mute the thread https://github.com/notifications/unsubscribe-auth/AgRJWM9WauMGJAX3tUq13LHkmi54V9Gcks5s4uMcgaJpZM4QkTgh . https://github.com/notifications/beacon/AgRJWLk8hdfNwzCCsaTLYjKYuxcUMectks5s4uMcgaJpZM4QkTgh.gif
Hi Per, Any way to add português to the languages? The translation I can do. Thank you Thomas
@ragapack you should check osrm-text-instructions
, which we use for the instruction texts, I don't know if they support Portuguese yet. There are a few strings that are specific to Leaflet Routing Machine as well, but I think they are already translated (since pt
is Portuguese, right?): https://github.com/perliedman/leaflet-routing-machine/blob/master/src/localization.js#L441
@ragapack osrm-text-instructions has a pt-BR
localization but no plain pt
, like it does with spanish es
/es-ES
. Either use pt-BR
as the name of the locale or even use it as a template for your translation, or use this branch which includes a workaround to make Portugese work with the generic pt
locale.
@perliedman , @ggl I need Brazilian Portuguese so pt-BR is OK for me. Now I have tried it out, works fine with all languages except pt-BR and es-ES If I set: language: 'es', It Works perfect with the Spanish language. language: 'es-ES', Does not work language: 'pt-BR', Does not work I think there is any problem with the size of the language key. In the leaflet-routing-machine.min.js file I found anything correct. I am using the sample code from the tutorial.
<script>
var map = L.map('map');
mapLink =
'<a href="http://openstreetmap.org">OpenStreetMap</a>';
L.tileLayer(
'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© ' + mapLink + ' Contributors',
maxZoom: 18,
}).addTo(map);
L.Routing.control({
waypoints: [
L.latLng(57.74, 11.94),
L.latLng(57.6792, 11.949)
],
language: 'pt-BR',
routeWhileDragging: true
}).addTo(map);
</script>
I too fervently hope for another source code version that contains only the English language. Upon inspecting the current code, I dare not try removing the other languages due to my novice familiarity in JavaScript..
I changed the code from pt-BR to only pt and now the português version Works. The 2 files are attached to this zip file. lrm.zip
very good guys! Thanks!
very good guys! Thanks!
I am using 'pt' with version 3.1.12 but the instructions continue on 'en'.
var control = L.Routing.control(L.extend(window.lrmConfig,{
language: 'pt',
formatter: new L.Routing.Formatter({
language: 'pt'
}),
geocoder: L.Control.Geocoder.nominatim(),
routeWhileDragging: true,
reverseWaypoints: true,
altLineOptions: {
styles: [
{ color: 'black', opacity: 0.15, weight: 9 },
{ color: 'white', opacity: 0.8, weight: 6 },
{ color: 'blue', opacity: 0.5, weight: 2 }
]
},
router: L.Routing.osrmv1({
serviceUrl: 'http://192.168.0.78:5000/route/v1'
})
})).addTo(map);
Can anyone help? Thanks.
Hi @phoenixproject, you should add the language option in the Routing object, like this.
var control = L.Routing.control({
....
, router: L.Routing.osrmv1({
serviceUrl: getUrlServidorDeRotas()
,language: 'pt'
})
....
}).addTo(mymap);
Pelase translate 'Indonesia'