@hlfan commented on this pull request.

I didn’t see anything particularly noteworthy in your changes compared to 
4da96156a93c79c8e4e8f9c2e5aac308bf9e9d86, the few comments I’ve left are about 
things you haven't touched yet.

> +      for (let i = 0; i < OSM.preferred_languages.length; i++) {
+        const preferredLanguage = OSM.preferred_languages[i].toLowerCase();
+        const matchedLanguage = supportedLanguages.find(function 
(supportedLanguage) {
+          return supportedLanguage.toLowerCase().replace("_", "-") === 
preferredLanguage;
+        });
+        if (matchedLanguage) {
+          maplibreMap.setLanguage(matchedLanguage);
+          break;
+        }
+      }

```suggestion
      for (const preferredLanguage of OSM.preferred_languages) {
        const preferred = preferredLanguage.toLowerCase().replace("-", "_");
        const match = supportedLanguages.find(supported =>
          supported.toLowerCase() === preferred
        );
        if (match) {
          maplibreMap.setLanguage(match);
          break;
        }
      }
```
Optionally put the `.find()` in one line or guard setLanguage with `continue`.

> -}
+}

Why was this changed?

>  L.extend(L.LatLngBounds.prototype, {
   getSize: function () {
     return (this._northEast.lat - this._southWest.lat) *
            (this._northEast.lng - this._southWest.lng);
   }
 });
 
+if (OSM.MAPTILER_KEY) {
+  maplibregl.setRTLTextPlugin(OSM.RTL_TEXT_PLUGIN, true);
+
+  L.OSM.OpenMapTiles = L.MaplibreGL.extend({
+    options: {
+      maxZoom: 23,
+      style: "https://api.maptiler.com/maps/openstreetmap/style.json?key="; + 
OSM.MAPTILER_KEY

```suggestion
      style: OSM.MAPTILER_OSM_STYLE_URL + "?key=" + OSM.MAPTILER_KEY
```

I know this kinda goes against 
https://github.com/openstreetmap/openstreetmap-website/pull/4042#discussion_r1966812213,
 but I'd prefer having the whole URL in the settings and basing the CSP on it 
like in #6137:
https://github.com/openstreetmap/openstreetmap-website/blob/7f98378630eaba699e152602046fa3a7eab924e1/app/controllers/application_controller.rb#L248-L249

On app/assets/javascripts/leaflet.map.js:

This could instead be placed into a `leaflet.osm.vector.js` file and inserted 
at line 10 of `application.js`

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/4042#pullrequestreview-2975740543
You are receiving this because you are subscribed to this thread.

Message ID: 
<openstreetmap/openstreetmap-website/pull/4042/review/2975740...@github.com>
_______________________________________________
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to