Leaflet.draw icon indicating copy to clipboard operation
Leaflet.draw copied to clipboard

Localization for Leaflet.draw

Open DenisCarriere opened this issue 6 years ago • 3 comments

For anyone interested in multiple language support, I started a localization plugin to work with Leaflet.draw by simply expanding on the L.drawLocal (which was the prefered method describe in your README).

https://github.com/DenisCarriere/Leaflet.draw.locales

Pretty straightforward and easy to use:

var L = require('leaflet')
var drawLocales = require('leaflet-draw-locales')

// Automatically defines Leaflet.draw to the specified language
drawLocales('fr')

// Customize locale language
var locale = drawLocales('fr')
locale.draw.toolbar.buttons.polygon = 'Awesome polygon!'
L.drawLocal = locale

Currently there's only 2 languages supported (English & French), if anyone would like to contribute to adding more languages (I would very much appreciate it 🤗 !) or if we can figure out a way to port over locales to be directly built-in Leaflet.draw.

image

DenisCarriere avatar Jul 21 '17 23:07 DenisCarriere

Cannot assign to 'drawLocal' because it is a read-only property ??

diamondskrt avatar Dec 21 '21 18:12 diamondskrt

I have the same problem @diamondskrt ! Could you solve it?

Masa-99 avatar May 05 '23 14:05 Masa-99

@Masa-99 maybe that's the problem, update your version image

diamondskrt avatar May 12 '23 11:05 diamondskrt