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
|
# Navigation
|
||||||
- id: toggleNavigation
|
- id: toggleNavigation
|
||||||
translation: "Toggle navigation"
|
translation: "Toggle navigation"
|
||||||
|
- id: languageSwitcherLabel
|
||||||
|
translation: "Language"
|
||||||
- id: gcseLabelShort
|
- id: gcseLabelShort
|
||||||
translation: "Search"
|
translation: "Search"
|
||||||
- id: gcseLabelLong
|
- id: gcseLabelLong
|
||||||
|
@ -28,6 +28,30 @@
|
|||||||
</li>
|
</li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ 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" }}
|
{{ if isset .Site.Params "gcse" }}
|
||||||
<li>
|
<li>
|
||||||
<a href="#modalSearch" data-toggle="modal" data-target="#modalSearch" style="outline: none;">
|
<a href="#modalSearch" data-toggle="modal" data-target="#modalSearch" style="outline: none;">
|
||||||
|
Loading…
Reference in New Issue
Block a user