In Angular Universal I have an index.html file. At the top it has
<html lang="en">
I would like to change this based on the page I am on. maldonadoattorney.com/es/jailreleases would be
<html lang="es">
maldonadoattorney.com/jailreleases would be
<html lang="en">
Is there an accepted way of doing this? Have read other questions and DOCUMENT is deprecated, so am wary of using it.
I have my site map set up with hreflang tags, but would like the html lang tag to be correct. Currently, I'm taking the lang="en" tag out of my index.html.
@Inject(LOCALE_ID) locale: string
in the constructor to get the language code and setlocale
tothis.document.documentElement.lang
. – Ewell