Set title lang to match locale of content #862
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See alphagov/govuk_template#342
Currently we set the html level lang to "en" and add a lang attribute to the "main" element with the locale of the content.
This causes screen readers to interpret the page title in english. We should instead markup the title with the same langugage (both the title and main content are in the content item's language).
I think we should also update the core layout in static and/or govuk_template, to allow for a title lang variable to be passed in, but it doesn't seem to be necessary for formats rendered by government frontend (please correct me if I'm wrong).
Government frontend seems like a sensible place to start because it renders news which accounts for most non english content iirc.
Visual regression results:
https://government-frontend-pr-862.surge.sh/gallery.html
Component guide for this PR:
https://government-frontend-pr-862.herokuapp.com/component-guide