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

detect language from query params #160

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

arthur-lemeur
Copy link
Contributor

Fixes #122

@arthur-lemeur
Copy link
Contributor Author

I've been asked to ensure that if the site is accessed via Thorium (application), the language is passed as a query parameter, and the site adapts accordingly and if the site is accessed directly from a browser without any query parameters, the site should infer the browser’s language.

After trying several iterations (including basic conditions all the way to use of the localStorage) and considering how Hugo generates and manages pages, I don’t think it’s ultimately possible to implement this in a seamless way. A choice needs to be made between the language sent by Thorium and the browser's language. Despite my best efforts to account for both scenarios, I’ve run into an issue with manual language selection once on the site: my script overrides the manual changes, making it impossible to switch languages manually.

I think the best solution is to leave things as they are currently. If the user accesses the site via Thorium, the app's language information is passed through. If they visit the site directly from a browser, the default version is English, and they’ll need to change it manually from the navigation bar if desired (which is the case for many websites).

If anyone has an idea on how to reconcile all three approaches (Thorium language, browser language, and manual selection on the site), I'm all ears.

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.

Website does not detect user language
1 participant