Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow LanguageDirection and LanguageName in root of configuration #11027

Closed
jmooring opened this issue May 26, 2023 · 3 comments
Closed

Allow LanguageDirection and LanguageName in root of configuration #11027

jmooring opened this issue May 26, 2023 · 3 comments

Comments

@jmooring
Copy link
Member

jmooring commented May 26, 2023

This would:

  1. Mirror the API for .Site.LanguageCode

  2. Allow you to do this on monolingual and multilingual sites

    <html lang="{{ site.LanguageCode }}" dir="{{ site.LanguageDirection }}">

To me, this is the basic configuration for a language:

[languages.en]
languageCode = 'en-US'  
languageDirection = 'ltr' 
languageName = 'English'
weight = 1

But the way you access the values is (conceptually) inconsistent:

Key Code Notes
languageCode {{ .Site.LanguageCode }} {{ .Site.Language.LanguageCode }} does not work
languageDirection {{ .Site.Language.LanguageDirection }}
languageName {{ .Site.Language.LanguageName }}
weight {{ .Site.Language.Weight }} Not sure why this is exposed
@bep
Copy link
Member

bep commented May 26, 2023

I will suggest we do it the other way, we (conceptually) move LanuageCode down to Language. It should be easy to make the old work, but that field belongs on Language-- the only reason it's not there is because it came before ...

That will also make the smallest change set and keep some values in Language.

We should also remove (deprecate) weight

  • deprecate weight.
  • move languageCode => language (but keep site.LanguageCode as an alias)

@jmooring
Copy link
Member Author

Sounds good to me.

@bep bep removed the NeedsTriage label May 27, 2023
@bep bep added this to the v0.112.4 milestone May 27, 2023
@bep bep added Enhancement and removed Proposal labels May 27, 2023
bep added a commit to bep/hugo that referenced this issue May 27, 2023
But keep an alias at Site

Closes gohugoio#11027
@bep bep closed this as completed in 6c2db0d May 27, 2023
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants