Skip to content

Commit

Permalink
navbar: Add a language chooser (#151, #67)
Browse files Browse the repository at this point in the history
  • Loading branch information
ronnychevalier authored and gcushen committed Apr 16, 2017
1 parent 8107292 commit d5c27af
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
10 changes: 10 additions & 0 deletions data/i18n/languages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"de": "Deutsch"
"en": "English"
"es": "Español"
"eu": "Euskara"
"fr": "Français"
"nl": "Nederlands"
"ru": "русский язык"
"tr": "Türkçe"
"vi": "Tiếng Việt"
"zh": "中文 (简体)"
20 changes: 19 additions & 1 deletion layouts/partials/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<span>{{ .Name }}</span>
</a>
</li>
{{end}}
{{ end }}
</ul>
</li>

Expand All @@ -49,6 +49,24 @@

{{ end }}
{{ end }}

{{ if .IsTranslated }}
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true">
<i class="fa fa-globe" aria-hidden="true"></i>
<span>{{ index .Site.Data.i18n.languages .Lang }}</span>
</a>
<ul class="dropdown-menu">
{{ range .Translations }}
<li class="nav-item">
<a href="{{ .URL }}"{{ if $.IsHome }} data-target="{{ .URL }}"{{ end }}>
<span>{{ index .Site.Data.i18n.languages .Lang }}</span>
</a>
</li>
{{ end }}
</ul>
</li>
{{ end }}
</ul>

</div><!-- /.navbar-collapse -->
Expand Down

0 comments on commit d5c27af

Please sign in to comment.