Cities with Internet: the map's own labels speak the reader's language
The connectivity map is built raw (new gl.Map), not through useMapInstance, so it never handed the engine a UI locale: the canvas's "Map" name, "Zoom in", "Toggle attribution" and the gesture hints stayed English under ar on both engines (rega, row 34, _qa-cycle/rega/rows31-34-0f136d25/). It now passes locale: engineUiLocale(readerLang(), provider) at construction, with the same reader-language ladder useMapInstance uses (ProfileLoader's lang, profile-config, ?lang=, <html lang>). The provider argument is ready for studio's per-engine logo label; today's engineUiLocale ignores it. Headless: the bundle builds and carries the engine key map (Map.Title...), the ar catalogue has mapui.map = "الخريطة", and check:no-free-identifiers, profiles-mount and universal-props pass. Not rendered in a browser.
This commit is contained in:
parent
49992a5ddd
commit
bb7a6d869f
1 changed files with 12 additions and 1 deletions
|
|
@ -49,7 +49,7 @@ import FullscreenButton from '@map/components/map-controls/FullscreenButton.vue'
|
|||
import ShareButton from '@map/components/map-controls/ShareButton.vue'
|
||||
import { resolveAssetsBase } from '@map/utils/embedBase.js'
|
||||
import { resolveMapProvider } from '@map/composables/useMapProvider.js'
|
||||
import { ensureEngineScript, engineGlobal, ensureEngineCSS, engineStylesheetUrl } from '@map/composables/useMapInstance.js'
|
||||
import { ensureEngineScript, engineGlobal, ensureEngineCSS, engineStylesheetUrl, engineUiLocale } from '@map/composables/useMapInstance.js'
|
||||
import { resolveNamedStyle } from '@map/styles/registry.js'
|
||||
import { installRtlTextPlugin } from '@map/maps/rtl-text.js'
|
||||
// People-group dots open the SAME detail panel as Prayer Progress (doxa-simple-map): the
|
||||
|
|
@ -92,6 +92,16 @@ const selectedAdm1 = ref(null)
|
|||
const PG_DOT = '#e11d48'
|
||||
const uiStore = inject('uiStore', null)
|
||||
const _lang = (() => { const v = inject('lang', null)?.value; return (v && v !== 'en') ? v : null })()
|
||||
// The reader's language for the ENGINE'S OWN labels (the canvas's "Map" name, "Zoom in", attribution…).
|
||||
// This map is built raw, not through useMapInstance, so it must hand the engine that locale itself;
|
||||
// without it they stayed English under ar on both engines (rega, row 34). Same ladder as
|
||||
// useMapInstance's readerLang: ProfileLoader's lang, then profile-config, then ?lang=, then <html lang>.
|
||||
const readerLang = () => {
|
||||
if (_lang) return _lang
|
||||
const pc = profileConfig.value
|
||||
if (pc && (pc.locale || pc.lang)) return String(pc.locale || pc.lang)
|
||||
try { const q = new URLSearchParams(location.search); return q.get('lang') || q.get('locale') || document.documentElement.lang || 'en' } catch { return 'en' }
|
||||
}
|
||||
const dsm = new DataSourceManager({ locale: _lang, profileConfig })
|
||||
const groups = shallowRef([])
|
||||
const dotCount = ref(0)
|
||||
|
|
@ -383,6 +393,7 @@ onMounted(async () => {
|
|||
style: resolveNamedStyle(isDark.value ? 'ink' : 'paper', ciProvider).style
|
||||
|| (isDark.value ? 'mapbox://styles/mapbox/dark-v11' : 'mapbox://styles/mapbox/light-v11'),
|
||||
accessToken: mapboxToken.value,
|
||||
locale: engineUiLocale(readerLang(), ciProvider),
|
||||
center: [42, 18], zoom: 1.3, projection: 'mercator', attributionControl: false,
|
||||
})
|
||||
mapRef.value = markRaw(map)
|
||||
|
|
|
|||
Loading…
Reference in a new issue