mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2025-06-19 04:23:30 +08:00
feat: multilingual site switch
This commit is contained in:
parent
b3b8fa73ef
commit
0ac8af4639
@ -200,6 +200,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.menu-bottom-section {
|
||||||
|
margin-top: auto;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.social-menu {
|
.social-menu {
|
||||||
|
@ -158,3 +158,20 @@
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#i18n-switch {
|
||||||
|
color: var(--body-text-color);
|
||||||
|
display: inline-flex;
|
||||||
|
align-content: center;
|
||||||
|
|
||||||
|
select {
|
||||||
|
border: 0;
|
||||||
|
background-color: transparent;
|
||||||
|
color: var(--body-text-color);
|
||||||
|
|
||||||
|
option {
|
||||||
|
color: var(--card-text-color-main);
|
||||||
|
background-color: var(--card-background);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -73,6 +73,19 @@
|
|||||||
</li>
|
</li>
|
||||||
{{ end }}
|
{{ 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) }}
|
{{ if (default false .Site.Params.colorScheme.toggle) }}
|
||||||
<li id="dark-mode-toggle">
|
<li id="dark-mode-toggle">
|
||||||
{{ partial "helper/icon" "toggle-left" }}
|
{{ partial "helper/icon" "toggle-left" }}
|
||||||
@ -80,5 +93,6 @@
|
|||||||
<span>{{ T "darkMode" }}</span>
|
<span>{{ T "darkMode" }}</span>
|
||||||
</li>
|
</li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
</div>
|
||||||
</ol>
|
</ol>
|
||||||
</aside>
|
</aside>
|
||||||
|
Loading…
Reference in New Issue
Block a user