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

Chinese set as language by default #521

Open
gruetter opened this issue Apr 24, 2023 · 14 comments · May be fixed by #567
Open

Chinese set as language by default #521

gruetter opened this issue Apr 24, 2023 · 14 comments · May be fixed by #567
Assignees
Labels
bug Something isn't working

Comments

@gruetter
Copy link
Contributor

Describe the bug
When opening pages on innersourcecommons.org, the chinese language is chose as the default language regardless of the browser language. This behaviour was confirmed by multiple users using different browsers. Example to reproduce: https://innersourcecommons.org/learn

Expected behavior
The language should be chosen based on the browser language with English being the default, if the browser language doesn't match any of the languages supported by the site.

/FYI @rrrutledge , @dellagustin

@gruetter gruetter added the bug Something isn't working label Apr 24, 2023
@rrrutledge
Copy link
Contributor

For me I see that happen when first visiting a page that doesn't exist - e.g. https://innersourcecommons.org/learning-path/ Thereafter I am always on Chinese pages. Here is a video:

innersourcecommons.org.language.bug-20230426_152333-Meeting.Recording.mp4

@yuhattor yuhattor assigned yuhattor and unassigned voborgus Jun 19, 2023
@yuhattor
Copy link
Member

Sorry for the late response, let me address the issue

yuhattor added a commit that referenced this issue Jun 19, 2023
@yuhattor yuhattor linked a pull request Jun 19, 2023 that will close this issue
@rrrutledge
Copy link
Contributor

Thanks for taking a look, @yuhattor

@yuhattor
Copy link
Member

yuhattor commented Jun 19, 2023

I'm still investigating, but have found this to be the case once the 404 is displayed. Looking at the built artifacts, it seems unlikely that zh would default otherwise.
This seems to be a common error with hugo, so I guess the key is how 404.html is created.

I tried deleting the Chinese language in the first place, and the default language for 404 is now Russian. I think it's because the locale IDs are referenced in descending order, zh -> ru. I don't know why it doesn't have a default language set for it, and why language priority isn't applied, but maybe something weird is going on in the build process...

image

@rrrutledge
Copy link
Contributor

That is odd!

@yuhattor
Copy link
Member

In conclusion, hugo does not support multilingual 404 pages, so I found that a hack is necessary in the current situation.

I created the PR #567 here. I added a little processing at build worklow

@yuhattor
Copy link
Member

Please review the PR!

@rrrutledge
Copy link
Contributor

Great that you found something! Will take a look sometime this week.

@spier
Copy link
Member

spier commented Jun 20, 2023

@yuhattor are you sure that this issue is caused by the 404 pages?

Here is one other example that I found today that seems unrelated to 404 pages:

Steps:

@yuhattor
Copy link
Member

yuhattor commented Jun 20, 2023

Thank you

The redirection is suspicious.
The reason why it is in China seems to be that hugo is not finding the English file properly.
Also, need to check the version. The current version of hugo is 0.80.0, which is far from the latest 0.113.0.

@yuhattor
Copy link
Member

hugo is obviously behaving strangely.

The base language set is created by hugo --minify like normal
en/
en/
fr/

On the other hand, a file like 404.html is created in root, which for some reason is overwritten with the language file generated by loop, without reference to the defaultLanguage setting.
So the generated files have 'zh' embedded at the top in descending order of locale.

This seems like a bug in hugo.

Area.2023-06-21.00.59.11.Jun.21.2023.0101.AM.mp4
image

@yuhattor
Copy link
Member

I think this is a pretty deep-rooted problem, and I'm looking at hugo's source code, but I don't know much about it yet, including the fact that I'm not a go pro.
Might need more time.

@rrrutledge
Copy link
Contributor

That's interesting - it feels like there should be some way to get this, but I don't know how our localization was set up and if it conflicts with any assumptions from Hugo. Thanks for checking this out!

@andrea-kyurchiev
Copy link
Collaborator

andrea-kyurchiev commented Aug 6, 2023

Within the announcement files it seems to only be occurring with files that use aliases. Ex:
https://innersourcecommons.org/about/announcements/2023-08-new-executive-director/

and the example @spier gave.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants