Setting the x-default in the .IsTranslated loop as I want

{{- if .IsTranslated -}}
    {{ range .AllTranslations }}
    {{- if eq .Language.Lang "en" -}}
    <link rel="alternate" hreflang="x-default" href="{{ .Permalink }}" />
    {{- end -}}
    <link rel="alternate" hreflang="{{ .Language.Lang }}" href="{{ .Permalink }}" />
    {{- end -}}
{{ end }}

I solved the problem with this code, thank you for what you wrote anyway.