-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Fix : Dynamically set html lang attribute based on selected language (#9193) #9199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Fix : Dynamically set html lang attribute based on selected language (#9193) #9199
Conversation
Reviewer's GuideIntroduces an Ember initializer that dynamically sets the Sequence diagram for setting the html lang attribute at app bootsequenceDiagram
participant AppInstance
participant IntlService
participant Document
AppInstance->>IntlService: lookup('service:intl')
IntlService-->>AppInstance: return current locale
AppInstance->>Document: set document.documentElement.lang = locale
Note right of Document: If locale unavailable, defaults to 'en'
AppInstance->>AppInstance: catch errors and log if any
Class diagram for the new set-html-lang initializerclassDiagram
class SetHtmlLangInitializer {
+initialize(appInstance)
}
class IntlService {
+locale: Array
}
SetHtmlLangInitializer ..> IntlService : uses
SetHtmlLangInitializer ..> Document : sets lang attribute
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Shivang14d04 - I've reviewed your changes and they look great!
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Fixes #9193
Short description of what this resolves:
This resolves an issue where the
<html lang="en">
attribute was hardcoded, preventing proper accessibility and locale-based styling. It sets thelang
attribute dynamically based on the active language in the app.Changes proposed in this pull request:
set-html-lang
appInstance.lookup('service:intl')
to get the current localedocument.documentElement.lang
dynamically at app bootChecklist
development
branch.Summary by Sourcery
Initialize the HTML lang attribute dynamically from the Ember Intl service on application boot
Bug Fixes:
Enhancements: