From 1f1edb6c4db0c2c8f7c46dc29b595ae8f25e4914 Mon Sep 17 00:00:00 2001 From: Doxa Maps Date: Sat, 26 Sep 2026 12:50:05 +0000 Subject: [PATCH] The engine's own controls speak the reader's language MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This leaf calls `new gl.Map` directly rather than going through useMapInstance, so it never inherited the locale map the shared composable passes: under Arabic every string we own was Arabic and the engine's own were not — "Toggle attribution", and the canvas's accessible name, which is what a screen reader announces the map as. The strings were already in the bundle; nothing was handing them to the engine. Measured that way: the Arabic mapui catalogue is present in the built bundle both before and after, while ENGINE_UI_KEYS — the map from the engine's key names to ours — appears only after. Set at construction, the only time either engine reads it. Needs eyes to confirm on screen. The one English legend tooltip now goes through t(), with the English kept in the template as the fallback so it renders exactly as it does today until the key lands, rather than showing "gospel.legend.hnrTip" in a tooltip. --- .../gospel-resources/resources-map.vue | 19 ++++++++- public/dx-maps/doxa-maps-spa/manifest.json | 12 +++--- .../gospel-resources/charts/index.html | 2 +- .../gospel-resources/data-tables/index.html | 2 +- .../gospel-dashboard/index.html | 2 +- .../gospel-resources/gospel-resources.js | 42 +++++++++---------- .../resources-list/index.html | 2 +- .../gospel-resources/resources-map/index.html | 2 +- public/dx-maps/manifest.json | 12 +++--- 9 files changed, 56 insertions(+), 39 deletions(-) diff --git a/plugin-designs/gospel-resources/resources-map.vue b/plugin-designs/gospel-resources/resources-map.vue index cc1dc8579..9b5b9834e 100644 --- a/plugin-designs/gospel-resources/resources-map.vue +++ b/plugin-designs/gospel-resources/resources-map.vue @@ -76,6 +76,7 @@ import { applyPeopleGroupList } from '@map/lists/peopleGroupList.js' import { EN_MESSAGES } from '@map/i18n/index.js' import { useShadowStyles } from '@map/composables/useShadowStyles.js' import { addMapAttribution } from '@map/composables/useMapAttribution' +import { engineUiLocale } from '@map/composables/useMapInstance.js' // Map toolbar — canonical modular control rail (MapToolbar slot-wrapper + button // children). ThemeToggleButton is omitted: this profile's isDark is a read-only @@ -732,6 +733,16 @@ try { const isEnglish = (() => { try { return String(useI18n().locale.value || 'en').split('-')[0] === 'en' } catch { return true } })() +/* The reader's language as a bare tag, for the ENGINE's own control labels. Read the same way + isEnglish is, so the engine's chrome and ours can never disagree about who is reading. */ +const readerLang = () => { + try { return String(useI18n().locale.value || 'en') } catch { return 'en' } +} +/* A TRANSLATION WHERE ONE EXISTS, TODAY'S ENGLISH WHERE IT DOES NOT — never the key name. + t() falls back to the key when a catalogue has no entry, which on a `title` attribute would + put "gospel.legend.hnrTip" in a tooltip: worse than the English it replaced. This keeps the + English in the template until the key lands, and switches the moment it does. */ +const tOr = (key, english) => { const v = t(key); return v && v !== key ? v : english } const SE_KIND = { PDF: 'PDF', audio: 'audio', sab: 'app', study: 'study notes', viewer: 'read online' } const seKinds = (k) => (Array.isArray(k) ? k : []).map((x) => SE_KIND[x] || x).join(', ') @@ -1443,6 +1454,12 @@ onMounted(async () => { style: resolveNamedStyle(isDark.value ? 'ink' : 'paper', grProvider).style || (isDark.value ? 'mapbox://styles/mapbox/dark-v11' : 'mapbox://styles/mapbox/light-v11'), accessToken: mapboxToken.value, + /* THE ENGINE'S OWN STRINGS, IN THE READER'S LANGUAGE (rega row 34). This leaf calls + `new gl.Map` directly instead of going through useMapInstance, so it did not inherit + the locale map the shared composable passes — "Toggle attribution" and the canvas's + accessible name "Map" stayed English under ar while every string we own was Arabic. + Set at construction because that is the only time either engine reads it. */ + locale: engineUiLocale(readerLang()), /* A starting zoom is a guess about the canvas. It was 1.3, which framed the world while this leaf was running WITHOUT the engine's stylesheet; once mapbox-gl.css reached the shadow root the canvas sized correctly and the same 1.3 cut the visible @@ -1973,7 +1990,7 @@ useShadowStyles( diff --git a/public/dx-maps/doxa-maps-spa/manifest.json b/public/dx-maps/doxa-maps-spa/manifest.json index 8957436ea..2884cfb67 100644 --- a/public/dx-maps/doxa-maps-spa/manifest.json +++ b/public/dx-maps/doxa-maps-spa/manifest.json @@ -578,7 +578,7 @@ "bundle": "gospel-resources", "scriptUrl": "./gospel-resources/gospel-resources.js", "output": "dx-maps/gospel-resources/gospel-resources.js", - "integrity": "sha384-4BpQjymqFNDY37MkPyDKIv9qW7LWezKuwSYw9NrPIc96Irp3jmMfkiy0I9RuXMCx", + "integrity": "sha384-uYb00jB2wp6U3UUda8LJsA79kAHuNP7Tcq/nWIsL4yNPbKMy6Dqa1GLW1y/yzH99", "elements": [ "gospel-resources-map" ], @@ -598,7 +598,7 @@ "scriptUrl": "./gospel-resources/gospel-resources.js", "embed": { "iframe": "", - "script": "\n\n" + "script": "\n\n" } }, { @@ -612,7 +612,7 @@ "scriptUrl": "./gospel-resources/gospel-resources.js", "embed": { "iframe": "", - "script": "\n\n" + "script": "\n\n" } }, { @@ -626,7 +626,7 @@ "scriptUrl": "./gospel-resources/gospel-resources.js", "embed": { "iframe": "", - "script": "\n\n\n\n" + "script": "\n\n\n\n" } }, { @@ -640,7 +640,7 @@ "scriptUrl": "./gospel-resources/gospel-resources.js", "embed": { "iframe": "", - "script": "\n\n" + "script": "\n\n" } }, { @@ -654,7 +654,7 @@ "scriptUrl": "./gospel-resources/gospel-resources.js", "embed": { "iframe": "", - "script": "\n\n\n\n" + "script": "\n\n\n\n" } } ] diff --git a/public/dx-maps/gospel-resources/charts/index.html b/public/dx-maps/gospel-resources/charts/index.html index 0cce96c82..71fcbf39a 100644 --- a/public/dx-maps/gospel-resources/charts/index.html +++ b/public/dx-maps/gospel-resources/charts/index.html @@ -32,7 +32,7 @@ - + - + - + - + - + \n\n" + "script": "\n\n" } }, { @@ -612,7 +612,7 @@ "scriptUrl": "./gospel-resources/gospel-resources.js", "embed": { "iframe": "", - "script": "\n\n" + "script": "\n\n" } }, { @@ -626,7 +626,7 @@ "scriptUrl": "./gospel-resources/gospel-resources.js", "embed": { "iframe": "", - "script": "\n\n\n\n" + "script": "\n\n\n\n" } }, { @@ -640,7 +640,7 @@ "scriptUrl": "./gospel-resources/gospel-resources.js", "embed": { "iframe": "", - "script": "\n\n" + "script": "\n\n" } }, { @@ -654,7 +654,7 @@ "scriptUrl": "./gospel-resources/gospel-resources.js", "embed": { "iframe": "", - "script": "\n\n\n\n" + "script": "\n\n\n\n" } } ]