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

Website does not detect user language #122

Open
gautierchomel opened this issue Nov 8, 2024 · 3 comments · May be fixed by #160
Open

Website does not detect user language #122

gautierchomel opened this issue Nov 8, 2024 · 3 comments · May be fixed by #160
Assignees

Comments

@gautierchomel
Copy link
Member

The user should receive a localised page when connecting to thorium.edrlab.org if it exists.

@arthur-lemeur
Copy link
Contributor

According to the internet "This is something that Hugo cannot do. All that Hugo does is generate static HTML (and optionally other file types). Hugo isn’t really a server (although we do have the hugo server command, but that’s primarily for local development).

You’ll likely need to use server-side software (perhaps Apache?) or client-side code (JavaScript) to determine the language of the browser, and whether that visitor should be directed to the English or French website."

@gautierchomel
Copy link
Member Author

I was thinking about using

client-side` code (JavaScript)

@danielweck
Copy link
Member

I'm using raw HTML fragments in another Hugo project, it is possible to insert raw CSS and raw JavaScript in the web page templates. So the Thorium doc website could read query params via JS and detect language, version, etc. A noscript tag could be used to inject a static link to help the user navigate to the correct language, and query params could be forwarded to the JS redirects, and possible to any hyperlinks in the page too (dynamic href replacement)

@arthur-lemeur arthur-lemeur linked a pull request Dec 18, 2024 that will close this issue
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 a pull request may close this issue.

3 participants