-
Notifications
You must be signed in to change notification settings - Fork 994
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Makes it possible to translate Leaflet.draw #87
Conversation
FYI, here is a proposal to add a simple i18n system centralized in Leaflet and make all the plugins share the same rules: Leaflet/Leaflet#1232 |
Very interesting. I'll have a look and see if I can make this pull compliant with your suggestion :-) |
@jacobtoye bump! |
Thanks! It would be great to make function to switch locales, like L.drawLocal.setLocale("en"). // Leaflet.draw.en.js
L.drawLocal.en = {
draw: {
toolbar: {
polyline: 'Draw a polyline',
polygon: 'Draw a polygon',
...
// Leaflet.draw.ru.js
L.drawLocal.ru = {
draw: {
toolbar: {
polyline: 'Добавить линию',
polygon: 'Добавить полигон',
... So, it would be possible to include all localisation files from folder and than just set locale with function. |
I think very important for current users of Leaflet.draw (they mostly don't use localisation) is ability to make simple update without necessity to add any localisation files. Maybe solution is to set default locale to "en" and include "en" localisation strings directly in leaflet.draw.js. |
@aleksejleonov don't get me wrong but the reason they don't use translation is that there is no translation atm. What I am pretty sure about is that most users won't compile their own leaflet.draw.js from source, meaning that we need to provide users an easy mean to include their own translation. The simplest way is to have one namespace that they can override if they like. Either by including their own translation file or by simply setting the variables, one by one, I'm thinking about rewriting this pull to the suggested model by @mourner in [https://github.com/Leaflet/Leaflet/pull/1232](this thread). |
FYI, work in progress: https://github.com/yohanboniface/Leaflet.i18n |
Finally found the time to look into this pull guys. Sorry :( It should be "good enough" until (if ever) leaflet decides to support localization officially. |
Makes it possible to translate Leaflet.draw
All localization specific strings has been refactored out of the core and into a
/locales/Leaflet.draw.en.js
file which is then referenced throughout the project.This makes it possible to translate Leaflet.draw into other languages.