rootdo/themes/risotto/layouts/partials/lang.html

29 lines
859 B
HTML
Raw Permalink Normal View History

2024-10-04 12:44:59 +00:00
<p>
{{ $siteLanguages := .Site.Languages }}
{{ $pageLang := .Page.Lang }}
{{ $currentPage := . }}
{{ $pageName := "" }}
{{ range .Site.Menus.main }}
{{ if eq ($currentPage.Permalink) (.URL | absLangURL) }}
{{ $pageName = .Name }}
{{ end }}
{{ end }}
{{ range .Page.AllTranslations }}
{{ $translation := .}}
{{ range $siteLanguages }}
{{ if eq $translation.Lang .Lang }}
{{ $selected := false }}
{{ if eq $pageLang .Lang }}
<br/><span class="active">$ echo $LANG<br/><b>{{ .LanguageName }}</b></span><br/>
{{ else }}
<br/><a href="{{ $translation.Permalink }}">export LANG={{ .LanguageName }}; ./{{ $pageName }}</a><br/>
{{ end }}
{{ end }}
{{ end }}
{{ end }}
</p>
<br /><br />