diff --git a/library/ProfileLoader.vue b/library/ProfileLoader.vue index c70b612a7..56a3364ad 100644 --- a/library/ProfileLoader.vue +++ b/library/ProfileLoader.vue @@ -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