Leaflet / Leaflet.draw

Vector drawing and editing plugin for Leaflet
https://leaflet.github.io/Leaflet.draw/docs/leaflet-draw-latest.html
MIT License
1.97k stars 992 forks source link

Localization for Leaflet.draw #748

Open DenisCarriere opened 7 years ago

DenisCarriere commented 7 years ago

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

diamondskrt commented 2 years ago

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

Masa-99 commented 1 year ago

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

diamondskrt commented 1 year ago

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