Add language selection to index.html of a multilingual site

I put that here and asking to add that as featrue.

Add a best possible language selector to the index.html of an multilingual site. Surely, it needs research for all browser types, but in my oppinion its a good featrue.

Example

config.toml

defaultContentLanguageInSubdir = true
enableRobotsTXT = true

[languages]
[languages.en]
weight = 1
[languages]
[languages.xx]
weight = 1

Hugo will create an index.html like

<!DOCTYPE html>
<html>
  <head>
    <title>xxxx</title>
    <link rel="canonical" href="https://xxx/en"/>
    <meta name="robots" content="noindex">
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta http-equiv="refresh" content="0; url=https://xxx/en" />
  </head>
</html>

Some browser would be support an language selection based on meta datas. For example chrome
https://support.google.com/webmasters/answer/189077?hl=en

<!DOCTYPE html>
<html lang="{{$.Site.Language}}">
  <head>
    <title>xxxx</title>

    <!-- languages - Google way: <link rel="alternate" hreflang="es" href="http://es.example.com/" /> -->
    {{ if .Site.IsMultiLingual }}
    {{ range .Site.Languages }}
    {{ if ne . $.Site.Language }}
    <link rel="alternate" hreflang="{{.}}" href="{{ $.Site.BaseURL }}{{.}}/" />
    {{ end }}
    {{ end }}
    {{ end }}
    <link rel="alternate" hreflang="x-default" href="{{ $.Site.BaseURL }}" />

    <meta name="robots" content="noindex">
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta http-equiv="refresh" content="0; url=https://xxx/en" />
  </head>
</html>

Please research that topic for all available browsers and add that as a featrue to hugo.

This is the role of the template, and has been discussed before. Use search.