leaflet-geoman
leaflet-geoman copied to clipboard
setLang does not work quite righ
Hello, I have a big project with maps, pm is registered globally and because of this, setLang does not work quite right, I mean that in fact the merge of the object happens, and not clone , if I use fallback lang , then return to the original i I can't. Only after reloading the page.
Without your code we can't help you much. Please create a demo: https://jsfiddle.net/o1dwu2vg/
Are you doing following?
// from default en to de
map.pm.setLang('de');
and later:
// from de to en
map.pm.setLang('en');
map.pm.setLang('custom', { buttonTitles: { drawMarkerButton: 'ΠΠΎΠΈΡΠΊ Π² ΡΠΎΡΠΊΠ΅', drawLineButton: 'ΠΠΎΠΈΡΠΊ ΠΏΠΎ ΠΊΡΠΈΠ²ΠΎΠΉ', drawRectButton: 'ΠΠΎΠΈΡΠΊ Π² ΠΏΡΡΠΌΠΎΡΠ³ΠΎΠ»ΡΠ½ΠΈΠΊΠ΅', drawPolyButton: 'ΠΠΎΠΈΡΠΊ Π² ΠΏΠΎΠ»ΠΈΠ³ΠΎΠ½Π΅' } }, 'en')
and later:
map.pm.setLang('end')
don't work.The custom translation will remain
I second this. I have my own custom language and switching to it works just fine:
map.value.pm.setLang('lv', geomanTranslation, 'en');
However, afterwards the switch back to English does not work:
map.value.pm.setLang('en');
Custom language remains as the current translation.
Instead of switching back to English, I tried some other languages like de and ru - both actually worked just fine. Seems that there is a particular problem with switching back to English.
For now I had to add English as another custom translation as use it as one.