{{- $translatedLangs := slice -}} {{- range .AllTranslations -}} {{- $translatedLangs =
$translatedLangs | append .Language.Lang -}} {{- end -}}
<div class="lang-switcher">
  {{- range .AllTranslations -}} {{- $flag := .Language.Params.flag | default .Language.Lang -}} {{-
  if eq .Language.Lang $.Language.Lang -}}
  <span class="lang-active" aria-current="true" title="{{ .Language.LanguageName }}"
    >{{ $flag }}</span
  >
  {{- else -}}
  <a
    href="{{ .RelPermalink }}"
    hreflang="{{ .Language.Lang }}"
    lang="{{ .Language.Lang }}"
    title="{{ .Language.LanguageName }}"
    >{{ $flag }}</a
  >
  {{- end -}} {{- end -}} {{- range site.Home.AllTranslations -}} {{- if not (in $translatedLangs
  .Language.Lang) -}} {{- $flag := .Language.Params.flag | default .Language.Lang -}}
  <a
    href="{{ .RelPermalink }}"
    hreflang="{{ .Language.Lang }}"
    lang="{{ .Language.Lang }}"
    title="{{ .Language.LanguageName }}"
    >{{ $flag }}</a
  >
  {{- end -}} {{- end -}}
</div>
