core
core copied to clipboard
HTML lang attribute does not change
Current behavior
When changing the language through setDefaultLang(param);, the lang attribute of the html root ellement in the dom does not change, it's a major issue for screen readers ...
Expected behavior
HTML lang attribute changes.
How do you think that we should fix this?
Select the attribute and change his value when the language is changed.
Minimal reproduction of the problem with instructions
Just change the language using setDefaultLang() and check the html root element via the chrome inspector.
Environment
Angular CLI: 6.1.5 Node: 8.11.3 OS: win32 x64 Angular: 6.1.6 ngx-translate-core v10.0.2
Browser:
- [ ] Chromium (desktop) version 70.0.3518.0
This should helps you: https://github.com/ngx-translate/core/issues/565
@ocombe Any news regarding #565? +1
It's simple, you may do it yourself: https://stackoverflow.com/a/53995975
constructor(
@Inject(LOCALE_ID) locale: string,
@Inject(DOCUMENT) document: Document,
) {
document.documentElement.lang = locale;
}