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

<hr>

<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/6127#discussion_r2183840012">app/assets/javascripts/index/element.js</a>:</p>
<pre style='color:#555'>> @@ -1,10 +1,16 @@
 (function () {
+  let abortController = null;
+  const langs = [...new Set([...OSM.preferred_languages.map(l => l.toLowerCase()), "mul", "en"])];
+  const wikis = [...new Set(langs.map(l => l.split("-")[0] + "wiki"))];
</pre>
<p dir="auto">Wikimedia wiki codes don’t quite conform to ISO 639. For example, the response will include <code class="notranslate">be_x_oldwiki</code> for what this repository calls <code class="notranslate">be-Tarask</code>. But this will affect only a handful of locales that we have localizations for, so it probably isn’t critical.</p>

<hr>

<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/6127#discussion_r2183842309">app/assets/javascripts/index/element.js</a>:</p>
<pre style='color:#555'>> @@ -101,4 +110,97 @@
       scrollableList.scrollLeft = scrollableList.scrollWidth - scrollableList.offsetWidth;
     }
   }
+
+  function previewWikidataValue($btn) {
+    if (!OSM.WIKIDATA_API_URL) return;
+    const items = $btn.data("qids");
+    if (!items?.length) return;
+    $btn.addClass("disabled").removeClass("wdt-preview");
+    fetch(OSM.WIKIDATA_API_URL + "?" + new URLSearchParams({
+      action: "wbgetentities",
+      format: "json",
+      origin: "*",
+      ids: items.join("|"),
+      props: "labels|sitelinks|claims|descriptions",
</pre>
<p dir="auto">We can request <code class="notranslate">sitelinks/urls</code> here, so that each object in <code class="notranslate">sitelinks</code> will contain a <code class="notranslate">url</code> property set to the absolute URL to the article.</p>

<hr>

<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/6127#discussion_r2183848567">app/assets/javascripts/index/element.js</a>:</p>
<pre style='color:#555'>> +      $("<a>")
+        .attr("href", OSM.WIKIMEDIA_COMMONS_URL + "File:" + encodeURIComponent(data.icon))
+        .append($("<img>").attr({ src, height: "32" }))
+        .addClass("float-end mb-1 ms-2")
+        .appendTo(cell);
+    }
+    if (data.label) {
+      $btn
+        .siblings(`a[href*="wikidata.org/entity/${data.qid}"]`)
+        .clone()
+        .text(data.label)
+        .addClass("me-1")
+        .appendTo(cell);
+    }
+    if (data.article) {
+      const lang = data.article.site.slice(0, -4);
</pre>
<p dir="auto">Is this trimming “wiki” from the end of the sitename?</p>

<hr>

<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/6127#discussion_r2183857227">app/assets/javascripts/index/element.js</a>:</p>
<pre style='color:#555'>> +      $("<a>")
+        .attr("href", OSM.WIKIMEDIA_COMMONS_URL + "File:" + data.icon)
+        .append($("<img>").attr({ src: OSM.WIKIMEDIA_COMMONS_URL + "Special:FilePath/" + data.icon, height: "32" }))
+        .addClass("float-end mb-1 ms-2")
+        .appendTo(cell);
+    }
+    if (data.label) {
+      $btn
+        .siblings(`a[href*="wikidata.org/entity/${data.qid}"]`)
+        .clone()
+        .text(data.label)
+        .addClass("me-1")
+        .appendTo(cell);
+    }
+    if (data.article) {
+      $(`<${data.label ? "sup" : "div"}>`)
</pre>
<p dir="auto">This feature hooks into something labeled <code class="notranslate">wikidata</code> with a Wikidata icon, so there should probably be an explicit reference to Wikipedia to counter the assumption that the link goes to Wikidata. The reference to Wikipedia would be more relevant than the language name, since most of the time it’s going to be the user’s preferred language anyways. If we don’t want to bother with a Wikipedia icon, “(Wikipedia)” in regular text would communicate the link target pretty well.</p>

<hr>

<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/6127#discussion_r2183846225">app/assets/javascripts/index/element.js</a>:</p>
<pre style='color:#555'>> +        .append($("<img>").attr({ src: OSM.WIKIMEDIA_COMMONS_URL + "Special:FilePath/" + data.icon, height: "32" }))
+        .addClass("float-end mb-1 ms-2")
+        .appendTo(cell);
+    }
+    if (data.label) {
+      $btn
+        .siblings(`a[href*="wikidata.org/entity/${data.qid}"]`)
+        .clone()
+        .text(data.label)
+        .addClass("me-1")
+        .appendTo(cell);
+    }
+    if (data.article) {
+      $(`<${data.label ? "sup" : "div"}>`)
+        .append($("<a>")
+          .attr("href", `https://${data.article.site.slice(0, -4)}.wikipedia.org/wiki/` + encodeURIComponent(data.article.title))
</pre>
<p dir="auto">Oh, I think I misread this part of the diff. I didn’t realize we’re always showing the label if available, followed by the superscript link to Wikipedia. I thought it was all one link based on an earlier screenshot.</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/6127#pullrequestreview-2984838528">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLNNJLL5RWRMZ2NXAD33GWVALAVCNFSM6AAAAAB75WISWSVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDSOBUHAZTQNJSHA">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLPBNYE7XULIIELJQ233GWVALA5CNFSM6AAAAAB75WISWSWGG33NNVSW45C7OR4XAZNRKB2WY3CSMVYXKZLTORJGK5TJMV32UY3PNVWWK3TUL5UWJTVR5ECYA.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/6127/review/2984838528</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/6127#pullrequestreview-2984838528",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/6127#pullrequestreview-2984838528",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>