leaflet-geoman icon indicating copy to clipboard operation
leaflet-geoman copied to clipboard

setLang does not work quite righ

Open Spokt1 opened this issue 2 years ago β€’ 3 comments
trafficstars

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.

Spokt1 avatar Aug 09 '23 08:08 Spokt1

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'); 

Falke-Design avatar Aug 09 '23 17:08 Falke-Design

map.pm.setLang('custom', { buttonTitles: { drawMarkerButton: 'Поиск Π² Ρ‚ΠΎΡ‡ΠΊΠ΅', drawLineButton: 'Поиск ΠΏΠΎ ΠΊΡ€ΠΈΠ²ΠΎΠΉ', drawRectButton: 'Поиск Π² ΠΏΡ€ΡΠΌΠΎΡƒΠ³ΠΎΠ»ΡŒΠ½ΠΈΠΊΠ΅', drawPolyButton: 'Поиск Π² ΠΏΠΎΠ»ΠΈΠ³ΠΎΠ½Π΅' } }, 'en')

and later:

map.pm.setLang('end')

don't work.The custom translation will remain

example

Spokt1 avatar Aug 09 '23 17:08 Spokt1

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.

georgs-tumans avatar Aug 15 '23 09:08 georgs-tumans