-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Is your feature request related to a problem? Please describe.
By default, Sphinx documentation does not include the language, for example in docs/conf.py
language = 'en'
result in built web pages:
<html lang="en">
This leads to the following accessibility issue identified by Lighthouse:
<html> element does not have a [lang] attribute
If a page doesn't specify a lang attribute, a screen reader assumes that the page is in the default language that the user chose when setting up the screen reader. If the page isn't actually in the default language, then the screen reader might not announce the page's text correctly. Learn more.`
Also, Sphinx sites thus do not by default take advantage of the features offered by setting the language.
This accessibility issue is present in major sites including NumPy.
Describe the solution you'd like
User already enters language when they run sphinx-quickstart:
For a list of supported codes, see
https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-language.
> Project language [en]:
so it should automatically set that language value in the generated conf.py file.
It would also be nice if there was some prompt to set the language of existing Sphinx installations, upon an update of Sphinx version, or build of the documentation, for example.
Describe alternatives you've considered
Status quo, which retains accessibility issue.
Additional context
Related issue: #10056.