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

i18n problem #611

Open
Pathsis opened this issue Jan 29, 2023 · 4 comments
Open

i18n problem #611

Pathsis opened this issue Jan 29, 2023 · 4 comments

Comments

@Pathsis
Copy link

Pathsis commented Jan 29, 2023

After switching the site language, the header information shows that the site language is still the main language.

截屏2023-01-29 21 55 48

@Pathsis Pathsis changed the title i18 problem i18n problem Jan 29, 2023
@regisphilibert
Copy link
Member

regisphilibert commented Feb 3, 2023

Yes we're using site.LanguageCode here which is expecting the language to hold a languageCode key. Not sure how your language settings are set but from a regular config file you should have:

languages:
  en: 
    name: English
    languageCode: en
  fr:
    name: Français
    languageCode: fr-fr

I opened a ticket so that site.LanguageCode defaults on the language key when languageCode is not set for a given language.

Also, I think we can improve the theme to defaults on site.Language.Lang itself.

@Pathsis
Copy link
Author

Pathsis commented Feb 3, 2023

Yes we're using site.LanguageCode here which is expecting the language to hold a languageCode key. Not sure how your language settings are set but from a regular config file you should have:

languages:
  en: 
    name: English
    languageCode: en
  fr:
    name: Français
    languageCode: fr-fr

I opened a ticket so that site.LanguageCode defaults on the language key when languageCode is not set for a given language.

Also, I think we can improve the theme to defaults on site.Language.Lang itself.

The image above is a screenshot of the official demo, not my own website.

My parameters are set as follows.

截屏2023-02-04 00 52 55

When I don't set languageCode, the language will always be en; when I set languageCode = "zh", the language will always be zh.

@regisphilibert
Copy link
Member

when I set languageCode = "zh", the language will always be zh.
What do you mean by always? When navigating a language site, if that language as a languageCode set you should see as a html[lang] attribute this language's languageCode

We'll be fixing this on the theme pending soon (#615), but in the mean time, adding a languageCode key should work.

Thanks for pointing the configuration issue of the demo site, we'll fix this as well.

@Pathsis
Copy link
Author

Pathsis commented Feb 3, 2023

Yes, I mean, when switching the language menu of the navigation, the head always shows one language.

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

No branches or pull requests

2 participants