<p></p>
<p><b>@hlfan</b> commented on this pull request.</p>

<p dir="auto">I didn’t see anything particularly noteworthy in your changes compared to <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/openstreetmap/openstreetmap-website/commit/4da96156a93c79c8e4e8f9c2e5aac308bf9e9d86/hovercard" href="https://github.com/openstreetmap/openstreetmap-website/commit/4da96156a93c79c8e4e8f9c2e5aac308bf9e9d86"><tt>4da9615</tt></a>, the few comments I’ve left are about things you haven't touched yet.</p><hr>

<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4042#discussion_r2177764779">app/assets/javascripts/leaflet.map.js</a>:</p>
<pre style='color:#555'>> +      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;
+        }
+      }
</pre>
⬇️ Suggested change
<pre style="color: #555">-      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;
-        }
-      }
+      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;
+        }
+      }
</pre>

<p dir="auto">Optionally put the <code class="notranslate">.find()</code> in one line or guard setLanguage with <code class="notranslate">continue</code>.</p>

<hr>

<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4042#discussion_r2177765249">package.json</a>:</p>
<pre style='color:#555'>> -}
+}
</pre>
<p dir="auto">Why was this changed?</p>

<hr>

<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4042#discussion_r2177806000">app/assets/javascripts/leaflet.map.js</a>:</p>
<pre style='color:#555'>>  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
</pre>
⬇️ Suggested change
<pre style="color: #555">-      style: "https://api.maptiler.com/maps/openstreetmap/style.json?key=" + OSM.MAPTILER_KEY
+      style: OSM.MAPTILER_OSM_STYLE_URL + "?key=" + OSM.MAPTILER_KEY
</pre>

<p dir="auto">I know this kinda goes against <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1721673158" data-permission-text="Title is private" data-url="https://github.com/openstreetmap/openstreetmap-website/issues/4042" data-hovercard-type="pull_request" data-hovercard-url="/openstreetmap/openstreetmap-website/pull/4042/hovercard?comment_id=1966812213&comment_type=review_comment" href="https://github.com/openstreetmap/openstreetmap-website/pull/4042#discussion_r1966812213">#4042 (comment)</a>, but I'd prefer having the whole URL in the settings and basing the CSP on it like in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="3181359099" data-permission-text="Title is private" data-url="https://github.com/openstreetmap/openstreetmap-website/issues/6137" data-hovercard-type="pull_request" data-hovercard-url="/openstreetmap/openstreetmap-website/pull/6137/hovercard" href="https://github.com/openstreetmap/openstreetmap-website/pull/6137">#6137</a>:<br>
<a href="https://github.com/openstreetmap/openstreetmap-website/blob/7f98378630eaba699e152602046fa3a7eab924e1/app/controllers/application_controller.rb#L248-L249">https://github.com/openstreetmap/openstreetmap-website/blob/7f98378630eaba699e152602046fa3a7eab924e1/app/controllers/application_controller.rb#L248-L249</a></p>

<hr>

<p>On <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4042#discussion_r2177832123">app/assets/javascripts/leaflet.map.js</a>:</p>
<p dir="auto">This could instead be placed into a <code class="notranslate">leaflet.osm.vector.js</code> file and inserted at line 10 of <code class="notranslate">application.js</code></p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4042#pullrequestreview-2975740543">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLK2TDDU3ARGWEIY47D3GKQVBAVCNFSM6AAAAAAYLUCIYKVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDSNZVG42DANJUGM">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLOEGEFC6HPM6YJ62Z33GKQVBA5CNFSM6AAAAAAYLUCIYKWGG33NNVSW45C7OR4XAZNRKB2WY3CSMVYXKZLTORJGK5TJMV32UY3PNVWWK3TUL5UWJTVRLYZH6.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/pull/4042/review/2975740543</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/4042#pullrequestreview-2975740543",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/4042#pullrequestreview-2975740543",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>