title: Replace substring in GeoJSON for popup window Leaflet
body: <p>Have looked into lots of questions about replacing substrings, but none of the examples has been working for me. I have a string in geojson (feature.properties.openingHours), this properties has &quot;Mon, Fri, Sat, Sun&quot; together with times &quot;00:00-24:00 Mon-Sun&quot; etc. I need to change the weekdays to local language for the popup when a &quot;click&quot; occur on a point in the Leaflet map. The string can hold several opening hours like &quot;00:00-20:00 Mon-Fri 08:00-20:00 Sat 08:00-18:00 Sun&quot;</p>
  <p>This is the latest I have tried and I get the error &quot;days not defined&quot;, is this wrong way doing it, or what is missing?</p>
  <p>Result should be from &quot;00:00-24:00 Mon-Sun&quot; =&gt; &quot;00:00-24:00 Mån-Sön&quot;</p>
  <pre><code>    function openingHours(feature, latlng){ 
      var days = feature.properties.openingHours
          days = days.replace(/Mon/g, 'Mån')
          days = days.replace(/Fri/g, 'Fre')
          days = days.replace(/Sat/g, 'Lör')
          days = days.replace(/Sun/g, 'Sön');
      };
  
  geoLayer = L.geoJson(json, {
       
      pointToLayer: function (feature, latlng) {
      return new L.shapeMarker(latlng, {radius: 7, color: '#b30000', fillOpacity: 0.7, weight: 2,  shape: 'square'})
      },
  
  onEachFeature: function(feature, layer) {
      var popupText = '';
      popupText += (feature.properties.openingHours) ? '&lt;br&gt;&lt;/b&gt;&lt;i&gt;Öppettider:&lt;/i&gt;': '';
      popupText += (feature.properties.openingHours) ? '&lt;br&gt;&lt;/b&gt;&lt;i&gt;' + openingHours(days) + '&lt;/i&gt;&lt;br&gt;': '';
  </code></pre>