i18n: a page the plugin owns gets <html lang> = the locale, not only dir=rtl
This commit is contained in:
parent
a59db6c4a1
commit
1a48e26a82
1 changed files with 7 additions and 2 deletions
|
|
@ -148,10 +148,15 @@ export function createAppI18n() {
|
|||
// The element's OWN direction is not this code's business and never was: ProfileLoader binds
|
||||
// dir on .profile-loader from effectiveLocale (0f6d5049), so the plugin mirrors correctly
|
||||
// whether or not it owns the document. This is only about the page around it.
|
||||
//
|
||||
// LANG TRAVELS WITH DIR (rega, research.nuxtbase.app/?lang=ar): an owned page flipped to dir=rtl but
|
||||
// kept the generator's <html lang="en">, so a screen reader read the Arabic with an English voice (and
|
||||
// ?lang=fr left lang="en" too). The page is ours, so its lang is the locale in force.
|
||||
try {
|
||||
const ownsPage = typeof window !== 'undefined' && window.MAP_OWNS_PAGE === true
|
||||
if (ownsPage && RTL_LOCALES.has(locale) && document?.documentElement) {
|
||||
document.documentElement.dir = 'rtl'
|
||||
if (ownsPage && locale && document?.documentElement) {
|
||||
document.documentElement.lang = locale
|
||||
if (RTL_LOCALES.has(locale)) document.documentElement.dir = 'rtl'
|
||||
}
|
||||
} catch { /* no document (SSR/tests) — nothing to reflect */ }
|
||||
// ★ A DETACHED EFFECT SCOPE (P0, the Driver's console, 2026-09-27). vue-i18n's createGlobal() runs
|
||||
|
|
|
|||
Loading…
Reference in a new issue