Improve language picker usability

This commit is contained in:
BBaoVanC 2021-11-19 17:22:25 -06:00
parent 15d9ad52e9
commit 7a73432238
Signed by: bbaovanc
GPG Key ID: 18089E4E3CCF1D3A
2 changed files with 26 additions and 1 deletions

View File

@ -236,6 +236,15 @@ footer {
list-style: none; list-style: none;
} }
.langpicker .unavailable {
color: inherit;
}
.langpicker .unavailable:hover {
cursor: not-allowed;
text-decoration: none;
}
/* Basic elements */ /* Basic elements */

View File

@ -26,11 +26,27 @@
{{ partial "icon.html" "world" -}} {{ partial "icon.html" "world" -}}
</summary> </summary>
<ul class="languages"> <ul class="languages">
{{ range .Site.Home.AllTranslations }} {{ range .AllTranslations }}
<li> <li>
<a class="langpicker-item{{ if eq .Language $.Site.Language }} active{{ end }}" href="{{ .Permalink }}">{{ .Language.LanguageName }}</a> <a class="langpicker-item{{ if eq .Language $.Site.Language }} active{{ end }}" href="{{ .Permalink }}">{{ .Language.LanguageName }}</a>
</li> </li>
{{ end }} {{ end }}
{{ $site_translations := slice }}
{{ range .Site.Languages }}
{{ $site_translations = $site_translations | append .LanguageName }}
{{ end }}
{{ $translation_codes := slice }}
{{ range .AllTranslations }}
{{ $translation_codes = $translation_codes | append .Language }}
{{ end }}
{{ range (.Site.Languages | complement $translation_codes) }}
<li>
<a class="langpicker-item unavailable">{{ .LanguageName }}</a>
</li>
{{ end }}
</ul> </ul>
</details> </details>
{{ end }} {{ end }}