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

Automatic language detection for the website #356

Open
milotype opened this issue Dec 23, 2023 · 1 comment
Open

Automatic language detection for the website #356

milotype opened this issue Dec 23, 2023 · 1 comment

Comments

@milotype
Copy link
Contributor

Feature request:
Implement automatic language detection for the website Kimai - Open Source time-tracker according to the language setting of the user's browser or the user's system language setting.

If you don't want that, I'd suggest to place the language dropdown menu into the navigation bar at the top of the webpage instead of at the footer of the webpage.

@kevinpapst
Copy link
Member

Implementation idea:

Could use

var lang = navigator.language || navigator.userLanguage;

and then compare with <html lang="en">.

For example if de is detected, check if there is a <link rel="alternate" hreflang="de" href="https://www.kimai.org/de/"> and redirect there.

If not existing, check if one of the users fallback languages is existing and redirect.

If redirect happens, set a session cookie.
If a language is chosen manually in the dropdown, set the session cookie as well.

ONLY execute the above logic on https://www.kimai.org
Do NOT redirect if cookie is existing, to prevent redirect-loops.

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