Skip to content

Comments

Add multilingual check to optionally display language selection. Fixe…#82

Open
zandi wants to merge 1 commit intojoeroe:mainfrom
zandi:fixes/issue-71-language-switcher-displayed
Open

Add multilingual check to optionally display language selection. Fixe…#82
zandi wants to merge 1 commit intojoeroe:mainfrom
zandi:fixes/issue-71-language-switcher-displayed

Conversation

@zandi
Copy link

@zandi zandi commented Jun 12, 2024

…s #71

The hugo.IsMultilingual function
(https://gohugo.io/functions/hugo/ismultilingual/) can be used to test if there is more than one configured language. If not, we just skip including the language selection partial layout. It can mistakenly appear for mono-lingual sites/content because it is always included, and the lang.html partial layout seems to iterate through the entire range of configured languages, even when it's only one language.

Requires Hugo v0.124.0 or newer.

…joeroe#71

The `hugo.IsMultilingual` function
(https://gohugo.io/functions/hugo/ismultilingual/) can be used to test if there
is more than one configured language. If not, we just skip including the
language selection partial layout. It can mistakenly appear for mono-lingual
sites/content because it is always included, and the `lang.html` partial layout
seems to iterate through the entire range of configured languages, even when
it's only one language.

Requires Hugo v0.124.0 or newer.
@zandi
Copy link
Author

zandi commented Jun 12, 2024

I ran across the "$echo $LANG" issue and came up with a quick solution. I haven't read your repo enough to know if you have requirements for supporting older versions of Hugo, but the function I'm using was added a few months ago.

This was just a quick change, let me know if there's any adjustments you need before accepting the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant