aboutsummaryrefslogtreecommitdiff
path: root/layouts/partials/docs/languages.html
blob: 644f6ea343b9ef3fc44e2a28f66e6c83b6d206aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!-- Merge home and current page translations -->
{{ $bookTranslatedOnly := default false .Site.Params.BookTranslatedOnly }}
{{ $translations := dict }}
{{ if (eq $bookTranslatedOnly false ) }}
  {{ range .Site.Home.Translations }}
    {{ $translations = merge $translations (dict .Language.Lang .) }}
  {{ end }}
{{ end }}
{{ range .Translations }}
  {{ $translations = merge $translations (dict .Language.Lang .) }}
{{ end }}

<ul class="book-languages">
  <li>
    <input type="checkbox" id="languages" class="toggle" />
    <label for="languages" class="flex justify-between">
      <a role="button" class="flex align-center">
        <img src="{{ "svg/translate.svg" | relURL }}" class="book-icon" alt="Languages" />
        {{ $.Site.Language.LanguageName }}
      </a>
    </label>

    <ul>
      {{ range .Site.Languages }}{{ with index $translations .Lang }}
      <li>
        <a href="{{ .Permalink }}">
          {{ .Language.LanguageName }}
        </a>
      </li>
      {{ end }}{{ end }}
    </ul>
  </li>
</ul>