Skip to content
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

Set a lang attribute in html tag #331

Closed
pohodnya opened this issue Jan 10, 2017 · 4 comments
Closed

Set a lang attribute in html tag #331

pohodnya opened this issue Jan 10, 2017 · 4 comments

Comments

@pohodnya
Copy link

How can i set a lang attribute in html tag for fastboot-rendered page?

Now I do it in root route:

afterModel: (locale) ->
  unless @get('fastboot.isFastBoot')
    document.getElementsByTagName("html")[0].setAttribute("lang", locale.get('name'))
@jasonmit
Copy link
Contributor

Related to ember-fastboot/fastboot#101

@eshtadc
Copy link

eshtadc commented Jun 6, 2017

I don't see a way that this is possible in the way fastboot renders the html. Linked an issue in the fastboot repo to this one.

@SergeAstapov
Copy link
Contributor

SergeAstapov commented Nov 6, 2017

SimpleDOM has a documentElement reference https://github.com/ember-fastboot/simple-dom/blob/master/src/simple-dom/document.ts

Seems this can be handled in a similar way as ember-fastboot/fastboot#171

It can be accessed as

getOwner(this).lookup('service:-document').documentElement.setAttribute('lang', 'es')

and then it needs to be handled in insertIntoIndexHTML function in fastboot in src/result.js similar to how bodyAttributes assigned to <body>.

Does it make sense? I'm missing anything?

@rwjblue
Copy link
Member

rwjblue commented Nov 6, 2017

Nope, seems good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants