fix: Hugo language related deprecation (v0.158.0+) (#1334)
* language related deprecation fix Reference: https://github.com/gohugoio/hugo/releases/tag/v0.158.0 .Site.LanguageCode -> .Site.Language.Locale .Language.LanguageDirection -> .Language.Direction .Language.LanguageCode -> .Language.Locale Also, in the configuration hugo.toml, the user should change `languageCode` to `locale`. * Update languageCode to locale in configuration * fix(languages): update languageName to label in languages.toml * .Language.LanguageName -> .Language.Label * .Language.Lang -> .Language.Name --------- Co-authored-by: Jimmy Cai <jimmy@cai.im>
This commit is contained in:
@@ -64,7 +64,7 @@
|
||||
{{ end }}
|
||||
<li class="menu-bottom-section">
|
||||
<ol class="menu">
|
||||
{{- $currentLanguageCode := .Language.Lang -}}
|
||||
{{- $currentLanguageCode := .Language.Name -}}
|
||||
{{ if hugo.IsMultilingual }}
|
||||
<li id="i18n-switch">
|
||||
{{ partial "helper/icon" "language" }}
|
||||
@@ -72,11 +72,11 @@
|
||||
{{ range .Site.Home.AllTranslations }}
|
||||
{{ $target := . }}
|
||||
{{ range $.AllTranslations }}
|
||||
{{ if eq .Language.Lang $target.Language.Lang }}
|
||||
{{ if eq .Language.Name $target.Language.Name }}
|
||||
{{ $target = . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
<option value="{{ $target.RelPermalink }}" {{ if eq $target.Language.Lang $currentLanguageCode }}selected{{ end }}>{{ .Language.LanguageName }}</option>
|
||||
<option value="{{ $target.RelPermalink }}" {{ if eq $target.Language.Name $currentLanguageCode }}selected{{ end }}>{{ .Language.Label }}</option>
|
||||
{{ end }}
|
||||
</select>
|
||||
</li>
|
||||
|
||||
Reference in New Issue
Block a user