Add a language switcher to the navigation
This ignores whether the current page has a translation in a given language, but it's a start.
This commit is contained in:
parent
0f74f45531
commit
655c2011fe
@ -25,6 +25,8 @@
|
||||
# Navigation
|
||||
- id: toggleNavigation
|
||||
translation: "Toggle navigation"
|
||||
- id: languageSwitcherLabel
|
||||
translation: "Language"
|
||||
- id: gcseLabelShort
|
||||
translation: "Search"
|
||||
- id: gcseLabelLong
|
||||
|
@ -28,6 +28,30 @@
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if .Site.IsMultiLingual }}
|
||||
{{ if ge (len .Site.Languages) 3 }}
|
||||
<li class="navlinks-container">
|
||||
<a class="navlinks-parent" href="javascript:void(0)">{{ i18n "languageSwitcherLabel" }}</a>
|
||||
<div class="navlinks-children">
|
||||
{{ range .Site.Languages }}
|
||||
{{ if not (eq .Lang $.Site.Language.Lang) }}
|
||||
<a href="/{{ .Lang }}">{{ default .Lang .LanguageName }}</a>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</li>
|
||||
{{ else }}
|
||||
<li>
|
||||
{{ range .Site.Languages }}
|
||||
{{ if not (eq .Lang $.Site.Language.Lang) }}
|
||||
<a href="/{{ .Lang }}">{{ default .Lang .LanguageName }}</a>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if isset .Site.Params "gcse" }}
|
||||
<li>
|
||||
<a href="#modalSearch" data-toggle="modal" data-target="#modalSearch" style="outline: none;">
|
||||
|
Loading…
Reference in New Issue
Block a user