authentik icon indicating copy to clipboard operation
authentik copied to clipboard

Locale Auto-detect doesn't work

Open Izanagi52 opened this issue 2 years ago • 14 comments

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:

  1. Got to Authentik with a French browser
  2. 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)

Izanagi52 avatar Jan 29 '23 21:01 Izanagi52

Can you run navigator.language || navigator.userLanguage in the browser's developer console and post the output?

BeryJu avatar Jan 30 '23 09:01 BeryJu

In Firefox: "fr" In Chrome: 'fr-FR'

Izanagi52 avatar Jan 30 '23 10:01 Izanagi52

same problem for me with 2023.2

xavierjulie avatar Feb 22 '23 08:02 xavierjulie

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.

stale[bot] avatar Apr 23 '23 09:04 stale[bot]

Problem still present in 2023.4.1

Izanagi52 avatar Apr 23 '23 10:04 Izanagi52

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 : image

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

manuviens avatar Jun 06 '23 01:06 manuviens

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'.

serxoz avatar Jul 10 '23 10:07 serxoz

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

Izanagi52 avatar Oct 21 '23 13:10 Izanagi52

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

Izanagi52 avatar Dec 22 '23 17:12 Izanagi52

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.

Izanagi52 avatar Mar 01 '24 10:03 Izanagi52

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?

felixscheinost avatar Mar 26 '24 16:03 felixscheinost

The browser language seems to be respected correctly in 2024.4.1 now, thanks!

felixscheinost avatar Apr 27 '24 06:04 felixscheinost

Yes it works now, thanks!

Izanagi52 avatar Apr 28 '24 16:04 Izanagi52