chill_hugoplate/layouts/partials/components/language-switcher.html
2023-05-25 16:41:54 +06:00

22 lines
672 B
HTML

<!-- Language List -->
{{ $class := .Class }}
{{ $context := .Context }}
{{ if $context.IsTranslated }}
<select class="{{ $class }}" onchange="location = this.value">
{{ $siteLanguages := site.Home.AllTranslations }}
{{ $pageLang := $context.Lang }}
{{ range $siteLanguages }}
{{ if eq (string $pageLang) (string .Language) }}
<option id="{{ .Language }}" value="{{ .RelPermalink }}" selected>
{{ .Language.LanguageName }}
</option>
{{ else }}
<option id="{{ .Language }}" value="{{ .RelPermalink }}">
{{ .Language.LanguageName }}
</option>
{{ end }}
{{ end }}
</select>
{{ end }}