?lang= on the page turns every embedded map's direction and data language, not only its text

createAppI18n already read ?lang= / ?locale=, so an embed opened with ?lang=ar showed Arabic text, but
ProfileLoader's own lang read only profile-config, so dir stayed ltr and the data language did not follow.
The URL is now its last rung; profile-config still wins. From upg100-plugin (ProfileLoader.vue:161).
This commit is contained in:
Doxa Maps 2026-09-27 05:32:04 +00:00
parent 1173a992bd
commit a09dbbac90

View file

@ -17,7 +17,7 @@
import { computed, provide, inject, watchEffect, watch } from 'vue'
import { useSharedMapToken, publishMapToken, fetchMapToken } from './composables/useSharedMapToken.js'
import { retryableAsyncComponent } from './composables/retryableAsyncComponent.js'
import { SUPPORTED_LOCALES, RTL_LOCALES, setRuntimeLocale } from './i18n/index.js'
import { SUPPORTED_LOCALES, RTL_LOCALES, setRuntimeLocale, localeFromUrl } from './i18n/index.js'
// QA corner: COMPILE-TIME gated (__DOXA_QA__, vite define). In public builds
// the flag is false → this whole branch (and the widget's code, including its
// platform references) is eliminated from the bundle. Platform builds
@ -158,7 +158,10 @@ const showPinHint = computed(() => config.value?.pinHint !== false)
// shipped catalogs; an unknown/absent value leaves the i18n-detected default
// (document.documentElement.lang → 'en') untouched.
const lang = computed(() => {
const raw = (config.value?.locale || config.value?.lang || '').split('-')[0].toLowerCase()
// ?lang= / ?locale= on the page is the last rung: an embed opened with ?lang=ar already got Arabic TEXT
// (createAppI18n reads the URL) but this component's lang stayed '' so its dir and data language did not
// follow (upg100-plugin). profile-config still wins.
const raw = (config.value?.locale || config.value?.lang || localeFromUrl() || '').split('-')[0].toLowerCase()
return SUPPORTED_LOCALES.includes(raw) ? raw : ''
})
// CRITICAL: this component is the ROOT of a defineCustomElement. vue-i18n's