Skip to content

Commit 0409f79

Browse files
committed
Fix assigning custom text to L.drawLocal
Fixed the assigning of custom text to the L.drawLocal configuration object according to the documentation https://github.com/Leaflet/Leaflet.draw#customizing-language-and-text-in-leafletdraw Assigning the full object instead of overwriting the single attributes breaks the latest versions of leaflet-draw (at least since version 0.4), because now some needed configuration values (e.g: L.drawLocal.draw.toolbar.finish.title) are missing.
1 parent c3f888a commit 0409f79

File tree

1 file changed

+32
-91
lines changed

1 file changed

+32
-91
lines changed
Lines changed: 32 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,33 @@
11
{% load i18n %}
2-
L.drawLocal = {
3-
draw: {
4-
toolbar: {
5-
actions: {
6-
title: "{% trans "Cancel drawing" %}",
7-
text: "{% trans "Cancel" %}"
8-
},
9-
undo: {
10-
title: "{% trans "Delete last point drawn" %}",
11-
text: "{% trans "Delete last point" %}"
12-
},
13-
buttons: {
14-
polyline: "{% trans "Draw a polyline" %}",
15-
polygon: "{% trans "Draw a polygon" %}",
16-
rectangle: "{% trans "Draw a rectangle" %}",
17-
circle: "{% trans "Draw a circle" %}",
18-
marker: "{% trans "Draw a marker" %}"
19-
}
20-
},
21-
handlers: {
22-
circle: {
23-
tooltip: {
24-
start: "{% trans "Click and drag to draw circle." %}"
25-
}
26-
},
27-
marker: {
28-
tooltip: {
29-
start: "{% trans "Click map to place marker." %}"
30-
}
31-
},
32-
polygon: {
33-
tooltip: {
34-
start: "{% trans "Click to start drawing shape." %}",
35-
cont: "{% trans "Click to continue drawing shape." %}",
36-
end: "{% trans "Click first point to close this shape." %}"
37-
}
38-
},
39-
polyline: {
40-
error: "{% trans "<strong>Error:</strong> shape edges cannot cross!" %}",
41-
tooltip: {
42-
start: "{% trans "Click to start drawing line." %}",
43-
cont: "{% trans "Click to continue drawing line." %}",
44-
end: "{% trans "Click last point to finish line." %}"
45-
}
46-
},
47-
rectangle: {
48-
tooltip: {
49-
start: "{% trans "Click and drag to draw rectangle." %}"
50-
}
51-
},
52-
simpleshape: {
53-
tooltip: {
54-
end: "{% trans "Release mouse to finish drawing." %}"
55-
}
56-
}
57-
}
58-
},
59-
edit: {
60-
toolbar: {
61-
actions: {
62-
save: {
63-
title: "{% trans "Save changes." %}",
64-
text: "{% trans "Save" %}"
65-
},
66-
cancel: {
67-
title: "{% trans "Cancel editing, discards all changes." %}",
68-
text: "{% trans "Cancel" %}"
69-
}
70-
},
71-
buttons: {
72-
edit: "{% trans "Edit layers" %}",
73-
editDisabled: "{% trans "No layers to edit." %}",
74-
remove: "{% trans "Delete layers" %}",
75-
removeDisabled: "{% trans "No layers to delete." %}"
76-
}
77-
},
78-
handlers: {
79-
edit: {
80-
tooltip: {
81-
text: "{% trans "Drag handles, or marker to edit feature." %}",
82-
subtext: "{% trans "Click cancel to undo changes." %}"
83-
}
84-
},
85-
remove: {
86-
tooltip: {
87-
text: "{% trans "Click on a feature to remove" %}"
88-
}
89-
}
90-
}
91-
}
92-
};
2+
L.drawLocal.draw.toolbar.actions.title = "{% trans "Cancel drawing" %}";
3+
L.drawLocal.draw.toolbar.actions.text = "{% trans "Cancel" %}";
4+
L.drawLocal.draw.toolbar.undo.title = "{% trans "Delete last point drawn" %}";
5+
L.drawLocal.draw.toolbar.undo.text = "{% trans "Delete last point" %}";
6+
L.drawLocal.draw.toolbar.buttons.polyline = "{% trans "Draw a polyline" %}";
7+
L.drawLocal.draw.toolbar.buttons.polygon = "{% trans "Draw a polygon" %}";
8+
L.drawLocal.draw.toolbar.buttons.rectangle = "{% trans "Draw a rectangle" %}";
9+
L.drawLocal.draw.toolbar.buttons.circle = "{% trans "Draw a circle" %}";
10+
L.drawLocal.draw.toolbar.buttons.marker = "{% trans "Draw a marker" %}";
11+
L.drawLocal.draw.handlers.circle.tooltip.start = "{% trans "Click and drag to draw circle." %}";
12+
L.drawLocal.draw.handlers.marker.tooltip.start = "{% trans "Click map to place marker." %}";
13+
L.drawLocal.draw.handlers.polygon.tooltip.start = "{% trans "Click to start drawing shape." %}";
14+
L.drawLocal.draw.handlers.polygon.tooltip.cont = "{% trans "Click to continue drawing shape." %}";
15+
L.drawLocal.draw.handlers.polygon.tooltip.end = "{% trans "Click first point to close this shape." %}";
16+
L.drawLocal.draw.handlers.polyline.error = "{% trans "<strong>Error:</strong> shape edges cannot cross!" %}";
17+
L.drawLocal.draw.handlers.polyline.tooltip.start = "{% trans "Click to start drawing line." %}";
18+
L.drawLocal.draw.handlers.polyline.tooltip.cont = "{% trans "Click to continue drawing line." %}";
19+
L.drawLocal.draw.handlers.polyline.tooltip.end = "{% trans "Click last point to finish line." %}";
20+
L.drawLocal.draw.handlers.rectangle.tooltip.start = "{% trans "Click and drag to draw rectangle." %}";
21+
L.drawLocal.draw.handlers.simpleshape.tooltip.end = "{% trans "Release mouse to finish drawing." %}";
22+
23+
L.drawLocal.edit.toolbar.actions.save.title = "{% trans "Save changes." %}";
24+
L.drawLocal.edit.toolbar.actions.save.text = "{% trans "Save" %}";
25+
L.drawLocal.edit.toolbar.actions.cancel.title = "{% trans "Cancel editing, discards all changes." %}";
26+
L.drawLocal.edit.toolbar.actions.cancel.text = "{% trans "Cancel" %}";
27+
L.drawLocal.edit.toolbar.buttons.edit = "{% trans "Edit layers" %}";
28+
L.drawLocal.edit.toolbar.buttons.editDisabled = "{% trans "No layers to edit." %}";
29+
L.drawLocal.edit.toolbar.buttons.remove = "{% trans "Delete layers" %}";
30+
L.drawLocal.edit.toolbar.buttons.removeDisabled = "{% trans "No layers to delete." %}";
31+
L.drawLocal.edit.handlers.edit.tooltip.text = "{% trans "Drag handles, or marker to edit feature." %}";
32+
L.drawLocal.edit.handlers.edit.tooltip.subtext = "{% trans "Click cancel to undo changes." %}";
33+
L.drawLocal.edit.handlers.remove.tooltip.text = "{% trans "Click on a feature to remove" %}";

0 commit comments

Comments
 (0)