Dynamic update of <html lang="en"> with FastBoot support
Closed this issue · 2 comments
daniel-de-wit commented
How do I dynamically update the language attribute of the html tag:<html lang="en">
?
lifeart commented
@daniel-de-wit document.documentElement.setAttribute('lang','ru')
daniel-de-wit commented
@lifeart Thanks, I was hoping for a built-in solution that works with FastBoot as well. I've should have made that more clear, I updated the title.
Using an instance-initializer I seem to get it working:
export default {
after: 'ember-i18n',
name: 'set-app-locale',
initialize(application) {
application.lookup('service:-document').documentElement.setAttribute('lang', 'nl');
},
};