@@ -16,6 +16,7 @@ interface UseMapProps {
1616 center : L . LatLngExpression ;
1717 enabled ?: boolean ;
1818 onShapeCreated ?: ( layer : L . Layer , callback : ( name : string | null , description : string | null ) => void ) => void ;
19+ isHebrew ?: boolean ;
1920}
2021
2122interface UseMapReturn {
@@ -24,7 +25,7 @@ interface UseMapReturn {
2425 featureCount : number ;
2526}
2627
27- export const useMap = ( { center, enabled = true , onShapeCreated } : UseMapProps ) : UseMapReturn => {
28+ export const useMap = ( { center, enabled = true , onShapeCreated, isHebrew } : UseMapProps ) : UseMapReturn => {
2829 const mapRef = useRef < L . Map | null > ( null ) ;
2930 const drawnItemsRef = useRef < L . FeatureGroup | null > ( null ) ;
3031 const drawControlRef = useRef < L . Control . Draw | null > ( null ) ;
@@ -63,6 +64,32 @@ export const useMap = ({ center, enabled = true, onShapeCreated }: UseMapProps):
6364 drawnItemsRef . current = new L . FeatureGroup ( ) ;
6465 mapRef . current . addLayer ( drawnItemsRef . current ) ;
6566
67+ if ( isHebrew ) {
68+ L . drawLocal . draw . toolbar . actions . title = "בטל ציור" ;
69+ L . drawLocal . draw . toolbar . actions . text = "ביטול" ;
70+ L . drawLocal . draw . toolbar . finish . title = "סיים ציור" ;
71+ L . drawLocal . draw . toolbar . finish . text = "סיום" ;
72+ L . drawLocal . draw . toolbar . undo . title = "מחק נקודה אחרונה" ;
73+ L . drawLocal . draw . toolbar . undo . text = "מחק אחרון" ;
74+ L . drawLocal . draw . handlers . polygon . tooltip . start = "לחצו כדי להתחיל לצייר צורה" ;
75+ L . drawLocal . draw . handlers . polygon . tooltip . cont = "לחצו כדי להמשיך לצייר" ;
76+ L . drawLocal . draw . handlers . polygon . tooltip . end = "לחצו על הנקודה הראשונה כדי לסגור את הצורה" ;
77+ L . drawLocal . draw . handlers . polyline . tooltip . start = "לחצו כדי להתחיל לצייר קו" ;
78+ L . drawLocal . draw . handlers . polyline . tooltip . cont = "לחצו כדי להמשיך לצייר" ;
79+ L . drawLocal . draw . handlers . polyline . tooltip . end = "לחצו על הנקודה האחרונה כדי לסיים" ;
80+ L . drawLocal . draw . handlers . marker . tooltip . start = "לחצו על המפה כדי להוסיף נקודה" ;
81+ L . drawLocal . edit . toolbar . actions . save . title = "שמור שינויים" ;
82+ L . drawLocal . edit . toolbar . actions . save . text = "שמור" ;
83+ L . drawLocal . edit . toolbar . actions . cancel . title = "בטל שינויים" ;
84+ L . drawLocal . edit . toolbar . actions . cancel . text = "ביטול" ;
85+ L . drawLocal . edit . toolbar . actions . clearAll . title = "נקה הכל" ;
86+ L . drawLocal . edit . toolbar . actions . clearAll . text = "נקה הכל" ;
87+ L . drawLocal . edit . toolbar . buttons . edit = "ערוך שכבות" ;
88+ L . drawLocal . edit . toolbar . buttons . editDisabled = "אין שכבות לעריכה" ;
89+ L . drawLocal . edit . toolbar . buttons . remove = "מחק שכבות" ;
90+ L . drawLocal . edit . toolbar . buttons . removeDisabled = "אין שכבות למחיקה" ;
91+ }
92+
6693 const drawControl = new L . Control . Draw ( {
6794 position : "topleft" ,
6895 edit : { featureGroup : drawnItemsRef . current } ,
@@ -119,7 +146,7 @@ export const useMap = ({ center, enabled = true, onShapeCreated }: UseMapProps):
119146 const newFeature = await createGeometry ( shapeName , description , geojson ) ;
120147 if ( newFeature ) {
121148 layer . featureId = newFeature . id ;
122- const displayName = newFeature . name || " Unnamed";
149+ const displayName = newFeature . name || ( isHebrew ? "ללא שם" : " Unnamed") ;
123150 layer . bindTooltip ( displayName ) ;
124151 }
125152 pendingLayersRef . current . delete ( layer ) ;
@@ -202,7 +229,7 @@ export const useMap = ({ center, enabled = true, onShapeCreated }: UseMapProps):
202229
203230 if ( layer ) {
204231 layer . featureId = feature . id ;
205- const displayName = feature . name || " Unnamed";
232+ const displayName = feature . name || ( isHebrew ? "ללא שם" : " Unnamed") ;
206233 layer . bindTooltip ( displayName ) ;
207234 drawnItemsRef . current ?. addLayer ( layer ) ;
208235 }
@@ -218,7 +245,7 @@ export const useMap = ({ center, enabled = true, onShapeCreated }: UseMapProps):
218245 drawControlRef . current = null ;
219246 }
220247 } ;
221- } , [ center , enabled ] ) ;
248+ } , [ center , enabled , isHebrew ] ) ;
222249
223250 return { mapRef, drawControlRef, featureCount } ;
224251} ;
0 commit comments