← All changes
|
templates/partials/single-trip/content-location.php
+51
-30
3.0.2.6
→
3.0.17
View file →
| @@ -7,9 +7,9 @@ | ||
| 7 | 7 | // Expected variables: $trip, $tab, $itinerary_entries |
| 8 | 8 | ?> |
| 9 | 9 | <section class="yatra-trip-section" id="location" itemscope itemtype="https://schema.org/Place"> |
| 10 | 10 | <h2 class="yatra-trip-section-title"> |
| 11 | - <?php yatra_render_tab_icon($tab->icon ?? null, 'map-pin', 'yatra-trip-section-title-icon', $tab->label ?? 'Location'); ?> | |
| 11 | + <?php yatra_render_tab_icon($tab->icon ?? null, 'map-pin', 'yatra-trip-section-title-icon', $tab->label ?? __('Location', 'yatra')); ?> | |
| 12 | 12 | <?php echo esc_html(isset($tab->label) ? $tab->label : __('Location', 'yatra')); ?> |
| 13 | 13 | </h2> |
| 14 | 14 | |
| 15 | 15 | <?php |
| @@ -39,12 +39,12 @@ | ||
| 39 | 39 | <!-- Load Leaflet CSS and JS --> |
| 40 | 40 | <link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" |
| 41 | 41 | integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" |
| 42 | 42 | crossorigin=""/> |
| 43 | - <script src="https://unpkg.com/[email protected]/dist/leaflet.js" | |
| 44 | - integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" | |
| 43 | + <script src="https://unpkg.com/[email protected]/dist/leaflet.js" | |
| 44 | + integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" | |
| 45 | 45 | crossorigin=""></script> |
| 46 | - | |
| 46 | + | |
| 47 | 47 | <script> |
| 48 | 48 | /** |
| 49 | 49 | * Yatra Trip Map Initialization |
| 50 | 50 | * Renders interactive map with trip route, markers, and directional arrows |
| @@ -74,13 +74,30 @@ | ||
| 74 | 74 | var endLat = parseFloat('<?php echo esc_js($trip->ending_latitude ?? '0'); ?>'); |
| 75 | 75 | var endLng = parseFloat('<?php echo esc_js($trip->ending_longitude ?? '0'); ?>'); |
| 76 | 76 | var startingLocation = '<?php echo esc_js($trip->getStartingLocation() ?? ''); ?>'; |
| 77 | 77 | var endingLocation = '<?php echo esc_js($trip->ending_location ?? ''); ?>'; |
| 78 | + var yatraMapI18n = { | |
| 79 | + mapLocationNotAvailable: '<?php echo esc_js(__('Map location not available', 'yatra')); ?>', | |
| 80 | + mapFailedToLoad: '<?php echo esc_js(__('Map failed to load. Please refresh the page.', 'yatra')); ?>', | |
| 81 | + tripStartingPoint: '<?php echo esc_js(__('Trip Starting Point', 'yatra')); ?>', | |
| 82 | + tripStart: '<?php echo esc_js(__('Trip Start', 'yatra')); ?>', | |
| 83 | + tripEndingPoint: '<?php echo esc_js(__('Trip Ending Point', 'yatra')); ?>', | |
| 84 | + tripEnd: '<?php echo esc_js(__('Trip End', 'yatra')); ?>', | |
| 85 | + startingPoint: '<?php echo esc_js(__('Starting Point', 'yatra')); ?>', | |
| 86 | + endingPoint: '<?php echo esc_js(__('Ending Point', 'yatra')); ?>', | |
| 87 | + labelLocation: '<?php echo esc_js(__('Location:', 'yatra')); ?>', | |
| 88 | + labelCoordinates: '<?php echo esc_js(__('Coordinates:', 'yatra')); ?>', | |
| 89 | + labelMap: '<?php echo esc_js(__('Map:', 'yatra')); ?>', | |
| 90 | + labelTime: '<?php echo esc_js(__('Time:', 'yatra')); ?>', | |
| 91 | + labelDescription: '<?php echo esc_js(__('Description', 'yatra')); ?>', | |
| 92 | + day: '<?php echo esc_js(__('Day', 'yatra')); ?>', | |
| 93 | + viewOnOpenStreetMap: '<?php echo esc_js(__('View on OpenStreetMap ↗', 'yatra')); ?>' | |
| 94 | + }; | |
| 78 | 95 | |
| 79 | 96 | // Validate coordinates |
| 80 | 97 | if (isNaN(startLat) || isNaN(startLng) || startLat === 0 || startLng === 0) { |
| 81 | 98 | console.warn('[Yatra Map] Invalid starting coordinates'); |
| 82 | - mapContainer.innerHTML = '<div style="padding: 40px; text-align: center; color: #64748b;">Map location not available</div>'; | |
| 99 | + mapContainer.innerHTML = '<div style="padding: 40px; text-align: center; color: #64748b;">' + yatraMapI18n.mapLocationNotAvailable + '</div>'; | |
| 83 | 100 | return; |
| 84 | 101 | } |
| 85 | 102 | |
| 86 | 103 | // Itinerary activities with coordinates (sanitized) |
| @@ -132,9 +149,13 @@ | ||
| 132 | 149 | map.attributionControl.setPrefix(''); |
| 133 | 150 | |
| 134 | 151 | // Add OpenStreetMap tiles with error handling |
| 135 | 152 | var tileLayer = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { |
| 136 | - attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors', | |
| 153 | + attribution: <?php echo wp_json_encode(sprintf( | |
| 154 | + /* translators: %s: map data provider link (e.g. OpenStreetMap). */ | |
| 155 | + __('© %s contributors', 'yatra'), | |
| 156 | + '<a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>' | |
| 157 | + )); ?>, | |
| 137 | 158 | maxZoom: 19, |
| 138 | 159 | minZoom: 2, |
| 139 | 160 | errorTileUrl: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==', |
| 140 | 161 | crossOrigin: true |
| @@ -196,25 +217,25 @@ | ||
| 196 | 217 | '<div class="yatra-popup-icon-start">' + |
| 197 | 218 | '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12l5 5L20 7"/></svg>' + |
| 198 | 219 | '</div>' + |
| 199 | 220 | '<div class="yatra-popup-title-section">' + |
| 200 | - '<h4 class="yatra-popup-title">' + (startingLocation || 'Trip Starting Point') + '</h4>' + | |
| 201 | - '<span class="yatra-popup-badge yatra-badge-start">Starting Point</span>' + | |
| 221 | + '<h4 class="yatra-popup-title">' + (startingLocation || yatraMapI18n.tripStartingPoint) + '</h4>' + | |
| 222 | + '<span class="yatra-popup-badge yatra-badge-start">' + yatraMapI18n.startingPoint + '</span>' + | |
| 202 | 223 | '</div>' + |
| 203 | 224 | '</div>' + |
| 204 | 225 | '<div class="yatra-popup-body">' + |
| 205 | 226 | '<div class="yatra-popup-info">' + |
| 206 | 227 | '<div class="yatra-popup-info-item">' + |
| 207 | - '<span class="yatra-popup-label"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align: middle; margin-right: 4px;"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"/><circle cx="12" cy="10" r="3"/></svg>Location:</span>' + | |
| 208 | - '<span class="yatra-popup-value">' + (startingLocation || 'Trip Start') + '</span>' + | |
| 228 | + '<span class="yatra-popup-label"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align: middle; margin-right: 4px;"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"/><circle cx="12" cy="10" r="3"/></svg>' + yatraMapI18n.labelLocation + '</span>' + | |
| 229 | + '<span class="yatra-popup-value">' + (startingLocation || yatraMapI18n.tripStart) + '</span>' + | |
| 209 | 230 | '</div>' + |
| 210 | 231 | '<div class="yatra-popup-info-item">' + |
| 211 | - '<span class="yatra-popup-label"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align: middle; margin-right: 4px;"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg>Coordinates:</span>' + | |
| 232 | + '<span class="yatra-popup-label"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align: middle; margin-right: 4px;"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg>' + yatraMapI18n.labelCoordinates + '</span>' + | |
| 212 | 233 | '<span class="yatra-popup-value">' + startLat.toFixed(6) + ', ' + startLng.toFixed(6) + '</span>' + |
| 213 | 234 | '</div>' + |
| 214 | 235 | '<div class="yatra-popup-info-item">' + |
| 215 | - '<span class="yatra-popup-label"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align: middle; margin-right: 4px;"><polygon points="1 6 1 22 8 18 16 22 16 6"/><polyline points="8 18 8 12 16 12"/></svg>Map:</span>' + | |
| 216 | - '<a href="https://www.openstreetmap.org/?mlat=' + startLat + '&mlon=' + startLng + '#map=15/' + startLat + '/' + startLng + '" target="_blank" class="yatra-popup-link">View on OpenStreetMap ↗</a>' + | |
| 236 | + '<span class="yatra-popup-label"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align: middle; margin-right: 4px;"><polygon points="1 6 1 22 8 18 16 22 16 6"/><polyline points="8 18 8 12 16 12"/></svg>' + yatraMapI18n.labelMap + '</span>' + | |
| 237 | + '<a href="https://www.openstreetmap.org/?mlat=' + startLat + '&mlon=' + startLng + '#map=15/' + startLat + '/' + startLng + '" target="_blank" class="yatra-popup-link">' + yatraMapI18n.viewOnOpenStreetMap + '</a>' + | |
| 217 | 238 | '</div>' + |
| 218 | 239 | '</div>' + |
| 219 | 240 | '</div>' + |
| 220 | 241 | '</div>'; |
| @@ -223,9 +244,9 @@ | ||
| 223 | 244 | className: 'yatra-custom-popup' |
| 224 | 245 | }); |
| 225 | 246 | |
| 226 | 247 | // Add tooltip that shows on hover |
| 227 | - var startTooltip = startingLocation ? startingLocation : 'Trip Starting Point'; | |
| 248 | + var startTooltip = startingLocation ? startingLocation : yatraMapI18n.tripStartingPoint; | |
| 228 | 249 | startMarker.bindTooltip(startTooltip, { |
| 229 | 250 | permanent: false, |
| 230 | 251 | direction: 'top', |
| 231 | 252 | className: 'yatra-marker-tooltip', |
| @@ -254,9 +275,9 @@ | ||
| 254 | 275 | '</div>' + |
| 255 | 276 | '<div class="yatra-popup-title-section">' + |
| 256 | 277 | '<h4 class="yatra-popup-title">' + activity.title + '</h4>' + |
| 257 | 278 | '<div class="yatra-popup-badges">' + |
| 258 | - '<span class="yatra-popup-badge yatra-badge-activity">Day ' + activity.day + '</span>' + | |
| 279 | + '<span class="yatra-popup-badge yatra-badge-activity">' + yatraMapI18n.day + ' ' + activity.day + '</span>' + | |
| 259 | 280 | (activity.day_title ? '<span class="yatra-popup-day-title">' + activity.day_title + '</span>' : '') + |
| 260 | 281 | '</div>' + |
| 261 | 282 | '</div>' + |
| 262 | 283 | '</div>' + |
| @@ -262,26 +283,26 @@ | ||
| 262 | 283 | '</div>' + |
| 263 | 284 | '<div class="yatra-popup-body">' + |
| 264 | 285 | '<div class="yatra-popup-info">' + |
| 265 | 286 | (activity.location ? '<div class="yatra-popup-info-item">' + |
| 266 | - '<span class="yatra-popup-label"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align: middle; margin-right: 4px;"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"/><circle cx="12" cy="10" r="3"/></svg>Location:</span>' + | |
| 287 | + '<span class="yatra-popup-label"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align: middle; margin-right: 4px;"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"/><circle cx="12" cy="10" r="3"/></svg>' + yatraMapI18n.labelLocation + '</span>' + | |
| 267 | 288 | '<span class="yatra-popup-value">' + activity.location + '</span>' + |
| 268 | 289 | '</div>' : '') + |
| 269 | 290 | (activity.start_time && activity.end_time ? '<div class="yatra-popup-info-item">' + |
| 270 | - '<span class="yatra-popup-label"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align: middle; margin-right: 4px;"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>Time:</span>' + | |
| 291 | + '<span class="yatra-popup-label"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align: middle; margin-right: 4px;"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>' + yatraMapI18n.labelTime + '</span>' + | |
| 271 | 292 | '<span class="yatra-popup-value">' + activity.start_time + ' - ' + activity.end_time + '</span>' + |
| 272 | 293 | '</div>' : '') + |
| 273 | 294 | '<div class="yatra-popup-info-item">' + |
| 274 | - '<span class="yatra-popup-label"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align: middle; margin-right: 4px;"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg>Coordinates:</span>' + | |
| 295 | + '<span class="yatra-popup-label"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align: middle; margin-right: 4px;"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg>' + yatraMapI18n.labelCoordinates + '</span>' + | |
| 275 | 296 | '<span class="yatra-popup-value">' + activity.lat.toFixed(6) + ', ' + activity.lng.toFixed(6) + '</span>' + |
| 276 | 297 | '</div>' + |
| 277 | 298 | '<div class="yatra-popup-info-item">' + |
| 278 | - '<span class="yatra-popup-label"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align: middle; margin-right: 4px;"><polygon points="1 6 1 22 8 18 16 22 16 6"/><polyline points="8 18 8 12 16 12"/></svg>Map:</span>' + | |
| 279 | - '<a href="https://www.openstreetmap.org/?mlat=' + activity.lat + '&mlon=' + activity.lng + '#map=15/' + activity.lat + '/' + activity.lng + '" target="_blank" class="yatra-popup-link">View on OpenStreetMap ↗</a>' + | |
| 299 | + '<span class="yatra-popup-label"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align: middle; margin-right: 4px;"><polygon points="1 6 1 22 8 18 16 22 16 6"/><polyline points="8 18 8 12 16 12"/></svg>' + yatraMapI18n.labelMap + '</span>' + | |
| 300 | + '<a href="https://www.openstreetmap.org/?mlat=' + activity.lat + '&mlon=' + activity.lng + '#map=15/' + activity.lat + '/' + activity.lng + '" target="_blank" class="yatra-popup-link">' + yatraMapI18n.viewOnOpenStreetMap + '</a>' + | |
| 280 | 301 | '</div>' + |
| 281 | 302 | '</div>' + |
| 282 | 303 | (activity.description ? '<div class="yatra-popup-description">' + |
| 283 | - '<div class="yatra-popup-desc-title"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align: middle; margin-right: 4px;"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/><polyline points="10 9 9 9 8 9"/></svg>Description</div>' + | |
| 304 | + '<div class="yatra-popup-desc-title"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align: middle; margin-right: 4px;"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/><polyline points="10 9 9 9 8 9"/></svg>' + yatraMapI18n.labelDescription + '</div>' + | |
| 284 | 305 | '<div class="yatra-popup-desc-text">' + |
| 285 | 306 | (activity.description.length > 150 ? activity.description.substring(0, 150) + '...' : activity.description) + |
| 286 | 307 | '</div>' + |
| 287 | 308 | '</div>' : '') + |
| @@ -318,25 +339,25 @@ | ||
| 318 | 339 | '<div class="yatra-popup-icon-end">' + |
| 319 | 340 | '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 11l3 3L22 4"/><path d="M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"/></svg>' + |
| 320 | 341 | '</div>' + |
| 321 | 342 | '<div class="yatra-popup-title-section">' + |
| 322 | - '<h4 class="yatra-popup-title">' + (endingLocation || 'Trip Ending Point') + '</h4>' + | |
| 323 | - '<span class="yatra-popup-badge yatra-badge-end">Ending Point</span>' + | |
| 343 | + '<h4 class="yatra-popup-title">' + (endingLocation || yatraMapI18n.tripEndingPoint) + '</h4>' + | |
| 344 | + '<span class="yatra-popup-badge yatra-badge-end">' + yatraMapI18n.endingPoint + '</span>' + | |
| 324 | 345 | '</div>' + |
| 325 | 346 | '</div>' + |
| 326 | 347 | '<div class="yatra-popup-body">' + |
| 327 | 348 | '<div class="yatra-popup-info">' + |
| 328 | 349 | '<div class="yatra-popup-info-item">' + |
| 329 | - '<span class="yatra-popup-label"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align: middle; margin-right: 4px;"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"/><circle cx="12" cy="10" r="3"/></svg>Location:</span>' + | |
| 330 | - '<span class="yatra-popup-value">' + (endingLocation || 'Trip End') + '</span>' + | |
| 350 | + '<span class="yatra-popup-label"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align: middle; margin-right: 4px;"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"/><circle cx="12" cy="10" r="3"/></svg>' + yatraMapI18n.labelLocation + '</span>' + | |
| 351 | + '<span class="yatra-popup-value">' + (endingLocation || yatraMapI18n.tripEnd) + '</span>' + | |
| 331 | 352 | '</div>' + |
| 332 | 353 | '<div class="yatra-popup-info-item">' + |
| 333 | - '<span class="yatra-popup-label"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align: middle; margin-right: 4px;"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg>Coordinates:</span>' + | |
| 354 | + '<span class="yatra-popup-label"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align: middle; margin-right: 4px;"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg>' + yatraMapI18n.labelCoordinates + '</span>' + | |
| 334 | 355 | '<span class="yatra-popup-value">' + endLat.toFixed(6) + ', ' + endLng.toFixed(6) + '</span>' + |
| 335 | 356 | '</div>' + |
| 336 | 357 | '<div class="yatra-popup-info-item">' + |
| 337 | - '<span class="yatra-popup-label"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align: middle; margin-right: 4px;"><polygon points="1 6 1 22 8 18 16 22 16 6"/><polyline points="8 18 8 12 16 12"/></svg>Map:</span>' + | |
| 338 | - '<a href="https://www.openstreetmap.org/?mlat=' + endLat + '&mlon=' + endLng + '#map=15/' + endLat + '/' + endLng + '" target="_blank" class="yatra-popup-link">View on OpenStreetMap ↗</a>' + | |
| 358 | + '<span class="yatra-popup-label"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align: middle; margin-right: 4px;"><polygon points="1 6 1 22 8 18 16 22 16 6"/><polyline points="8 18 8 12 16 12"/></svg>' + yatraMapI18n.labelMap + '</span>' + | |
| 359 | + '<a href="https://www.openstreetmap.org/?mlat=' + endLat + '&mlon=' + endLng + '#map=15/' + endLat + '/' + endLng + '" target="_blank" class="yatra-popup-link">' + yatraMapI18n.viewOnOpenStreetMap + '</a>' + | |
| 339 | 360 | '</div>' + |
| 340 | 361 | '</div>' + |
| 341 | 362 | '</div>' + |
| 342 | 363 | '</div>'; |
| @@ -345,9 +366,9 @@ | ||
| 345 | 366 | className: 'yatra-custom-popup' |
| 346 | 367 | }); |
| 347 | 368 | |
| 348 | 369 | // Add tooltip that shows on hover |
| 349 | - var endTooltip = endingLocation ? endingLocation : 'Trip Ending Point'; | |
| 370 | + var endTooltip = endingLocation ? endingLocation : yatraMapI18n.tripEndingPoint; | |
| 350 | 371 | endMarker.bindTooltip(endTooltip, { |
| 351 | 372 | permanent: false, |
| 352 | 373 | direction: 'top', |
| 353 | 374 | className: 'yatra-marker-tooltip', |
| @@ -475,9 +496,9 @@ | ||
| 475 | 496 | |
| 476 | 497 | } catch (error) { |
| 477 | 498 | console.error('[Yatra Map] Initialization error:', error); |
| 478 | 499 | if (mapContainer) { |
| 479 | - mapContainer.innerHTML = '<div style="padding: 40px; text-align: center; color: #ef4444;">Map failed to load. Please refresh the page.</div>'; | |
| 500 | + mapContainer.innerHTML = '<div style="padding: 40px; text-align: center; color: #ef4444;">' + yatraMapI18n.mapFailedToLoad + '</div>'; | |
| 480 | 501 | } |
| 481 | 502 | } |
| 482 | 503 | }); |
| 483 | 504 | })(); |