added translations

This commit is contained in:
Joren de Graaf
2026-10-01 22:43:45 +02:00
parent 2c4cd61a63
commit 5410fec8f2
76 changed files with 1787 additions and 291 deletions
+9 -8
View File
@@ -1,3 +1,4 @@
const t = window.BOOMCAST_I18N || {};
const mapElement = document.getElementById("event-map");
const h3Resolution = mapElement.dataset.h3Resolution;
@@ -7,7 +8,7 @@
compassControl.onAdd = () => {
const compass = L.DomUtil.create("div", "map-compass");
compass.setAttribute("role", "img");
compass.setAttribute("aria-label", "Map compass: north is up");
compass.setAttribute("aria-label", (t.mapCompass || "Map compass: north is up"));
compass.innerHTML = "<span class=\"compass-n\">N</span><span class=\"compass-e\">E</span><span class=\"compass-s\">S</span><span class=\"compass-w\">W</span><span class=\"compass-needle\">↑</span>";
L.DomEvent.disableClickPropagation(compass);
return compass;
@@ -28,8 +29,8 @@
}).addTo(map);
polygon.bindPopup(
"<span class=\"popup-title\">H3 " + cell.cell + "</span>" +
"<span class=\"popup-meta\">" + cell.reports + " reports · " + cell.occurrences +
" occurrences · resolution " + h3Resolution + "</span>"
"<span class=\"popup-meta\">" + cell.reports + " " + (cell.reports === 1 ? (t.report || "report") : (t.reports || "reports")) + " · " + cell.occurrences +
" " + (cell.occurrences === 1 ? (t.occurrence || "occurrence") : (t.occurrences || "occurrences")) + " · " + (t.resolution || "resolution") + " " + h3Resolution + "</span>"
);
bounds.extend(L.latLngBounds(cell.boundary));
});
@@ -60,17 +61,17 @@
className: "", html: "<div class=\"report-icon\">✦</div>", iconSize: [37, 37], iconAnchor: [19, 19],
});
reports.forEach((report) => {
const visualStatus = report.visually_confirmed ? "Visually confirmed" : "Not visually confirmed";
let detail = report.occurrences + " occurrence" + (report.occurrences === 1 ? "" : "s") +
" · " + visualStatus + "<br>Reported " + report.reported_on;
const visualStatus = report.visually_confirmed ? (t.visuallyConfirmed || "Visually confirmed") : (t.notVisuallyConfirmed || "Not visually confirmed");
let detail = report.occurrences + " " + (report.occurrences === 1 ? (t.occurrence || "occurrence") : (t.occurrences || "occurrences")) +
" · " + visualStatus + "<br>" + (t.reported || "Reported") + " " + report.reported_on;
if (report.direction_degrees !== null) {
detail += "<br>Compass direction " + Math.round(report.direction_degrees) + "° (" + cardinalDirection(report.direction_degrees) + ")";
detail += "<br>" + (t.compassDirection || "Compass direction") + " " + Math.round(report.direction_degrees) + "° (" + cardinalDirection(report.direction_degrees) + ")";
if (report.direction_accuracy_degrees !== null) {
detail += " (±" + Math.round(report.direction_accuracy_degrees) + "°)";
}
}
L.marker(report.center, { icon: reportIcon }).addTo(map).bindPopup(
"<span class=\"popup-title\">Manual report · H3 " + report.cell + "</span>" +
"<span class=\"popup-title\">" + (t.manualReport || "Manual report") + " · H3 " + report.cell + "</span>" +
"<span class=\"popup-meta\">" + detail + "</span>"
);