mirror of
https://github.com/alex-shpak/hugo-book.git
synced 2024-11-25 04:43:04 +00:00
c828c6660f
* Add OnlyTranslated property Signed-off-by: Alex Ivanov <ai@contributor.pw> * Add newlines Signed-off-by: Alex Ivanov <ai@contributor.pw> * rename property Signed-off-by: Alex Ivanov <ai@contributor.pw>
32 lines
1.1 KiB
HTML
32 lines
1.1 KiB
HTML
<!-- Merge home and current page translations -->
|
|
{{ $bookTranslatedOnly := default false .Site.Params.BookTranslatedOnly }}
|
|
{{ $translations := dict }}
|
|
{{ if (eq $bookTranslatedOnly false ) }}
|
|
{{ range .Site.Home.AllTranslations }}
|
|
{{ $translations = merge $translations (dict .Language.Lang .) }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ range .Translations }}
|
|
{{ $translations = merge $translations (dict .Language.Lang .) }}
|
|
{{ end }}
|
|
|
|
<div class="book-languages" tabindex="0" aria-haspopup="true">
|
|
<ul>
|
|
<li class="flex align-center">
|
|
<img src="{{ "svg/translate.svg" | relURL }}" class="book-icon" alt="Languages" />
|
|
{{ $.Site.Language.LanguageName }}
|
|
</li>
|
|
</ul>
|
|
|
|
<ul class="book-languages-list">
|
|
{{ range .Site.Languages }}{{ with index $translations .Lang }}
|
|
<li class="{{ if (eq $.Site.Language .Language) }}active{{ end }}">
|
|
<a href="{{ .Permalink }}" class="flex align-center">
|
|
<img src="{{ "svg/translate.svg" | relURL }}" class="book-icon" alt="Languages" />
|
|
{{ .Language.LanguageName }}
|
|
</a>
|
|
</li>
|
|
{{ end }}{{ end }}
|
|
</ul>
|
|
</div>
|