The engine logo's label follows the reader's language, on both engines

rega's row 34 (map controls in ar) found the engine logo's label English: "Mapbox homepage" /
"MapLibre logo" — one engine key with two meanings. engineUiLocale(lang, provider) now takes the engine
and sets LogoControl.Title from mapui.mapboxHomepage or mapui.maplibreLogo (11 locales). gospel-resources
and cities-internet build their maps RAW; engineUiLocale is documented as exported for them. (PinHint's
close button was already translated on main as aria.dismissHint.)
This commit is contained in:
Doxa Maps 2026-09-26 12:35:20 +00:00
parent 1f77810450
commit 36ad9ae73c
12 changed files with 42 additions and 15 deletions

View file

@ -41,7 +41,9 @@ const ENGINES = {
// THE ENGINE'S OWN CONTROL LABELS ("Zoom in", "Toggle attribution", the gesture hints…) in the reader's
// language. Both engines take a `locale` map of their UI strings at construction; without one they stay
// English under ar/es (rega's row 30). Strings live in library/i18n/locales/<lc>/mapui.json. The keys are
// the engines' own; an engine ignores the ones it does not use.
// the engines' own; an engine ignores the ones it does not use. EXPORTED for the maps built RAW
// (new gl.Map outside this composable, e.g. gospel-resources, cities-internet): pass
// `locale: engineUiLocale(lang, provider)` to their constructor, or their controls stay English.
const ENGINE_UI_KEYS = {
'Map.Title': 'map', 'Marker.Title': 'marker', 'Popup.Close': 'closePopup',
'NavigationControl.ZoomIn': 'zoomIn', 'NavigationControl.ZoomOut': 'zoomOut', 'NavigationControl.ResetBearing': 'resetBearing',
@ -54,12 +56,15 @@ const ENGINE_UI_KEYS = {
// Mapbox's names for the same gesture hints
'ScrollZoomBlocker.CtrlMessage': 'ctrlScroll', 'ScrollZoomBlocker.CmdMessage': 'cmdScroll', 'TouchPanBlocker.Message': 'twoFingers',
}
export function engineUiLocale(lang) {
export function engineUiLocale(lang, provider) {
const out = {}
for (const [engineKey, ours] of Object.entries(ENGINE_UI_KEYS)) {
const v = tStatic(`mapui.${ours}`, lang)
if (v) out[engineKey] = v
}
// The logo's label names its own engine ("Mapbox homepage" / "MapLibre logo"): one key, two meanings.
const logo = tStatic(provider === 'maplibre' ? 'mapui.maplibreLogo' : 'mapui.mapboxHomepage', lang)
if (logo) out['LogoControl.Title'] = logo
return out
}
@ -541,7 +546,7 @@ export function useMapInstance({
// day/night decision, not a guess made here. (Computed above the branch: the Mapbox
// branch's own `initialConfig` is scoped to that branch and is NOT visible here.)
style: maplibreStyle(effectiveStyle, _bootPreset),
locale: engineUiLocale(readerLang()),
locale: engineUiLocale(readerLang(), 'maplibre'),
center,
zoom,
minZoom: initialMinZoom,
@ -568,7 +573,7 @@ export function useMapInstance({
accessToken: token, // BP #1 from W1A — per-instance token; avoids last-writer-wins on multi-embed pages
container: containerRef.value, // real DOM element — never a string ID in shadow DOM
style: effectiveStyle,
locale: engineUiLocale(readerLang()),
locale: engineUiLocale(readerLang(), 'mapbox'),
// Pins a Standard basemap's lightPreset/theme BEFORE its first frame; without it the
// schema default 'day' paints one LIGHT frame before any setConfigProperty can run.
...(initialConfig ? { config: initialConfig } : {}),

View file

@ -15,5 +15,7 @@
"disableGlobe": "إيقاف الكرة الأرضية",
"ctrlScroll": "استخدم Ctrl مع التمرير لتكبير الخريطة",
"cmdScroll": "استخدم ⌘ مع التمرير لتكبير الخريطة",
"twoFingers": "استخدم إصبعين لتحريك الخريطة"
"twoFingers": "استخدم إصبعين لتحريك الخريطة",
"mapboxHomepage": "الصفحة الرئيسية لـ Mapbox",
"maplibreLogo": "شعار MapLibre"
}

View file

@ -15,5 +15,7 @@
"disableGlobe": "Globus ausschalten",
"ctrlScroll": "Strg + Scrollen zum Zoomen der Karte",
"cmdScroll": "⌘ + Scrollen zum Zoomen der Karte",
"twoFingers": "Mit zwei Fingern die Karte bewegen"
"twoFingers": "Mit zwei Fingern die Karte bewegen",
"mapboxHomepage": "Mapbox-Startseite",
"maplibreLogo": "MapLibre-Logo"
}

View file

@ -15,5 +15,7 @@
"disableGlobe": "Disable globe",
"ctrlScroll": "Use Ctrl + scroll to zoom the map",
"cmdScroll": "Use ⌘ + scroll to zoom the map",
"twoFingers": "Use two fingers to move the map"
"twoFingers": "Use two fingers to move the map",
"mapboxHomepage": "Mapbox homepage",
"maplibreLogo": "MapLibre logo"
}

View file

@ -15,5 +15,7 @@
"disableGlobe": "Desactivar globo",
"ctrlScroll": "Usa Ctrl + desplazamiento para hacer zoom en el mapa",
"cmdScroll": "Usa ⌘ + desplazamiento para hacer zoom en el mapa",
"twoFingers": "Usa dos dedos para mover el mapa"
"twoFingers": "Usa dos dedos para mover el mapa",
"mapboxHomepage": "Página de inicio de Mapbox",
"maplibreLogo": "Logotipo de MapLibre"
}

View file

@ -15,5 +15,7 @@
"disableGlobe": "Désactiver le globe",
"ctrlScroll": "Utilisez Ctrl + molette pour zoomer sur la carte",
"cmdScroll": "Utilisez ⌘ + molette pour zoomer sur la carte",
"twoFingers": "Utilisez deux doigts pour déplacer la carte"
"twoFingers": "Utilisez deux doigts pour déplacer la carte",
"mapboxHomepage": "Page d'accueil de Mapbox",
"maplibreLogo": "Logo MapLibre"
}

View file

@ -15,5 +15,7 @@
"disableGlobe": "ग्लोब बंद करें",
"ctrlScroll": "मानचित्र ज़ूम करने के लिए Ctrl + स्क्रॉल करें",
"cmdScroll": "मानचित्र ज़ूम करने के लिए ⌘ + स्क्रॉल करें",
"twoFingers": "मानचित्र हिलाने के लिए दो उँगलियों का उपयोग करें"
"twoFingers": "मानचित्र हिलाने के लिए दो उँगलियों का उपयोग करें",
"mapboxHomepage": "Mapbox मुखपृष्ठ",
"maplibreLogo": "MapLibre लोगो"
}

View file

@ -15,5 +15,7 @@
"disableGlobe": "Disattiva globo",
"ctrlScroll": "Usa Ctrl + scorrimento per ingrandire la mappa",
"cmdScroll": "Usa ⌘ + scorrimento per ingrandire la mappa",
"twoFingers": "Usa due dita per spostare la mappa"
"twoFingers": "Usa due dita per spostare la mappa",
"mapboxHomepage": "Home page di Mapbox",
"maplibreLogo": "Logo di MapLibre"
}

View file

@ -15,5 +15,7 @@
"disableGlobe": "Desativar globo",
"ctrlScroll": "Use Ctrl + rolagem para ampliar o mapa",
"cmdScroll": "Use ⌘ + rolagem para ampliar o mapa",
"twoFingers": "Use dois dedos para mover o mapa"
"twoFingers": "Use dois dedos para mover o mapa",
"mapboxHomepage": "Página inicial do Mapbox",
"maplibreLogo": "Logótipo do MapLibre"
}

View file

@ -15,5 +15,7 @@
"disableGlobe": "Dezactivează globul",
"ctrlScroll": "Folosește Ctrl + derulare pentru a mări harta",
"cmdScroll": "Folosește ⌘ + derulare pentru a mări harta",
"twoFingers": "Folosește două degete pentru a muta harta"
"twoFingers": "Folosește două degete pentru a muta harta",
"mapboxHomepage": "Pagina principală Mapbox",
"maplibreLogo": "Sigla MapLibre"
}

View file

@ -15,5 +15,7 @@
"disableGlobe": "Выключить глобус",
"ctrlScroll": "Используйте Ctrl + прокрутку для масштабирования карты",
"cmdScroll": "Используйте ⌘ + прокрутку для масштабирования карты",
"twoFingers": "Используйте два пальца, чтобы перемещать карту"
"twoFingers": "Используйте два пальца, чтобы перемещать карту",
"mapboxHomepage": "Главная страница Mapbox",
"maplibreLogo": "Логотип MapLibre"
}

View file

@ -15,5 +15,7 @@
"disableGlobe": "停用地球仪",
"ctrlScroll": "使用 Ctrl + 滚轮缩放地图",
"cmdScroll": "使用 ⌘ + 滚轮缩放地图",
"twoFingers": "使用两根手指移动地图"
"twoFingers": "使用两根手指移动地图",
"mapboxHomepage": "Mapbox 主页",
"maplibreLogo": "MapLibre 标志"
}