diff --git a/app/initializers/set-html-lang.js b/app/initializers/set-html-lang.js new file mode 100644 index 00000000000..4899cbf76f5 --- /dev/null +++ b/app/initializers/set-html-lang.js @@ -0,0 +1,16 @@ +export function initialize(appInstance) { + try { + const intl = appInstance.lookup('service:intl'); + + if (intl && typeof document !== 'undefined') { + const lang = intl?.locale?.[0] || 'en'; + document.documentElement.lang = lang; + } + } catch (e) { + console.error('Failed to set lang attribute:', e); + } +} + +export default { + initialize +};