diff options
author | Jimmy Cai <github@jimmycai.com> | 2022-02-27 12:51:02 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-27 12:51:02 +0300 |
commit | 2712887c7c81b7dd0309910859b1d46252f82677 (patch) | |
tree | 3547cce643a9f2cf02195cca87f431c0953e4716 /layouts | |
parent | b3b8fa73ef5f82bed55e12221526fbeddc03374f (diff) |
feat: multilingual site switch (#512)
* feat: multilingual site switch
* fix menu item margin
switch to flexbox gap
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/partials/sidebar/left.html | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/layouts/partials/sidebar/left.html b/layouts/partials/sidebar/left.html index 4442dfe..35d1c11 100644 --- a/layouts/partials/sidebar/left.html +++ b/layouts/partials/sidebar/left.html @@ -73,12 +73,26 @@ </li> {{ end }} - {{ if (default false .Site.Params.colorScheme.toggle) }} - <li id="dark-mode-toggle"> - {{ partial "helper/icon" "toggle-left" }} - {{ partial "helper/icon" "toggle-right" }} - <span>{{ T "darkMode" }}</span> - </li> - {{ end }} + <div class="menu-bottom-section"> + {{- $currentLanguageCode := .Language.Lang -}} + {{ with .Site.Home.AllTranslations }} + <li id="i18n-switch"> + {{ partial "helper/icon" "language" }} + <select name="language" onchange="window.location.href = this.selectedOptions[0].value"> + {{ range . }} + <option value="{{ .Permalink }}" {{ if eq .Language.Lang $currentLanguageCode }}selected{{ end }}>{{ .Language.LanguageName }}</option> + {{ end }} + </select> + </li> + {{ end }} + + {{ if (default false .Site.Params.colorScheme.toggle) }} + <li id="dark-mode-toggle"> + {{ partial "helper/icon" "toggle-left" }} + {{ partial "helper/icon" "toggle-right" }} + <span>{{ T "darkMode" }}</span> + </li> + {{ end }} + </div> </ol> </aside> |