Set the right HTML lang attribute
See original GitHub issueIndependent of uplifting or unfreezing or “dropping” locales, we’re still rendering localized content. So we should get the <html lang="en">
tag right. E.g. view-source:https://developer.allizom.org/fr/docs/Web
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Declaring language in HTML - W3C
The xml:lang attribute is the standard way to identify language information in XML. Ensure that the values for both attributes are identical.
Read more >lang - HTML: HyperText Markup Language - MDN Web Docs
The lang global attribute helps define the language of an element: the language that non-editable elements are written in, or the language ......
Read more >Using the HTML lang attribute - TPGi
The HTML lang attribute is used to identify the language of text content on the web. This information helps search engines return language ......
Read more >How to fix: Consider adding a “lang” attribute to the “html” start ...
Always use a language attribute on the <html> tag to declare the default language of the text in the page, using the lang...
Read more ><html> element must have a lang attribute | Axe Rules
Add a lang attribute to the html element (e.g. <html lang="en"> ) whose value represents the primary language of document. Make sure you...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Then, let’s just do it. The code for figuring out the
lang
based on thelocale
is probably the same as we do for thehreflang
meta tags. I’ll attempt this next week.A screenreader will switch pronounciation accordingly.
For example,
Berlin
is pronounced differently depending on your language: https://en.wiktionary.org/wiki/Berlin (the speaker within that article play back some audio file)It can have a serious effect on their UX: https://webaim.org/techniques/screenreader/#video (English text spelled with Czech pronounciation for demo purposes).
Also, it might help crawlers to categorise the content a bit better.