authentik
authentik copied to clipboard
Locale Auto-detect doesn't work
Describe the bug Using a browser configured in French, but Authentik is in English when locale is "Auto-detect".
To Reproduce Steps to reproduce the behavior:
- Got to Authentik with a French browser
- View Authentik UI in English
Expected behavior Authentik UI in French.
Logs
Logs of Firefox and Chrome debug console
authentik(early): version 2023.1.2, apiBase /api/v3 [config.ts:105:8] authentik/locale: No matching locale for en-us [locale.ts:147:20] authentik/locale: Activating detected locale 'en' [locale.ts:143:20]
Version and Deployment (please complete the following information):
- 2023.1.2
- docker compose
Additional context Tested with multiple browser (Chrome Desktop 109.0.5414.120, Chrome Android 109.0.5414.117, Firefox 109.0)
Can you run navigator.language || navigator.userLanguage in the browser's developer console and post the output?
In Firefox: "fr" In Chrome: 'fr-FR'
same problem for me with 2023.2
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Problem still present in 2023.4.1
Not sure if it's the same issue, but it don't work in 2023.5.3. My preferred languages in Firefox and Chromium are (in priority order) :
- fr-ca
- fr
- en-ca
- en
But pages shows in english.
Also, in the user settings, the list of available languages appears oddly :
Edit : I found that I can force a language globally by adding this in the Attributes (in Other global settings) of my Tenant :
settings:
locale: fr
I'd like to report the same with Spanish and version 2023.6.0 I've tried Firefox and Chromium and both 'es' and 'es-ES'.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Not resolved in 2023.8.3
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Not resolved in 2023.10.5
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Not resolved in 2024.2.1.
To me it seems like the precedence of the locales is wrong.
In helpers.ts the following code is executed:
const localeCandidates: string[] = [
globalAK()?.locale ?? TOMBSTONE,
localeCodeFromUrl("locale"),
requestedCode ?? TOMBSTONE,
window.navigator?.language ?? TOMBSTONE,
DEFAULT_LOCALE,
].filter(isLocaleCandidate);
In my case this evaluates to: ['en-us', 'en', 'de', 'en']
If I add .map(getBestMatchLocale), de stays there but in 3rd place.
My browser is set to de and I would expect de to take precedence. But seems that currently globalAk()?.locale takes precedence?
The browser language seems to be respected correctly in 2024.4.1 now, thanks!
Yes it works now, thanks!