Skip to content

web/flows: fix hardcoded locale in identification stage's OR_LIST_FORMATTERS - #26017

Merged
BeryJu merged 1 commit into
goauthentik:mainfrom
nejedly-jan:fix/identification-or-list-formatter-locale
Sep 14, 2026
Merged

BeryJu merged 1 commit into
goauthentik:mainfrom
nejedly-jan:fix/identification-or-list-formatter-locale

Conversation

@nejedly-jan

Copy link
Copy Markdown

Details

What does this PR change?

Moves the "or" list formatter in the identification stage from a module-level constant to a function built at render time with the stage's active locale.

Why is this change needed?

OR_LIST_FORMATTERS was built once with Intl.ListFormat("default", ...). That resolves to the browser's own locale, not authentik's active locale. Field labels like "Email" and "Username" translate correctly through msg(), but the "or" joining them stays in the browser's language no matter what locale is active.

Verified directly in Node: Intl.ListFormat("default", ...) follows LANG/LC_ALL, not anything authentik sets.

LANG=en_US.UTF-8 -> "Email or Username"
LANG=cs_CZ.UTF-8 -> "Email nebo Username"

How was this tested?

  • Added utils.unit.test.ts: covers en-US, cs-CZ, de-DE, plus a regression check against the old "default" locale bug.
  • Ran tsc --noEmit, eslint, prettier --check, and vitest run on the changed files - all pass.

Linked issues

Closes #20632


AI disclosure

Root cause investigation, fix, and test were done with Claude Code (Anthropic). I reviewed the diagnosis, reproduced the locale bug myself in Node before accepting it, and verified the fix.


Checklist

  • The project has been linted, built, and tested (make all)
  • The documentation has been updated and formatted (make docs) - no docs needed, this restores existing intended behavior, not a new/changed feature
  • I have read the AI usage policy.

…MATTERS

OR_LIST_FORMATTERS was constructed once at module load with the locale
string "default", which resolves to the browser's own locale rather than
authentik's active locale. Individual field labels (e.g. "Username") are
translated correctly via msg(), but the "or" connecting them never was.

Move construction to render time via a createOrListFormatter(locale)
factory, using the stage's already-available this.activeLanguageTag
(BaseStage extends WithLocale(AKElement)) so it follows the active
locale, including changes at runtime.

Fixes goauthentik#20632
@nejedly-jan
nejedly-jan requested a review from a team as a code owner September 10, 2026 13:27
@netlify

netlify Bot commented Sep 10, 2026

Copy link
Copy Markdown

✅ Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit 4a469c8
🔍 Latest deploy log https://app.netlify.com/projects/authentik-storybook/deploys/6aa2b03609976e0007414a68
😎 Deploy Preview https://deploy-preview-26017--authentik-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@GirlBossRush
GirlBossRush self-requested a review September 10, 2026 13:37
@netlify

netlify Bot commented Sep 10, 2026

Copy link
Copy Markdown

✅ Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit 4a469c8
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/6aa2b0368aa3500007294560
😎 Deploy Preview https://deploy-preview-26017--authentik-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@BeryJu BeryJu added the backport/version-2026.8 Add this label to PRs to backport changes to version-2026.8 label Sep 14, 2026
@codecov

codecov Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.25%. Comparing base (8c8bd38) to head (4a469c8).
⚠️ Report is 83 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #26017      +/-   ##
==========================================
- Coverage   91.86%   91.25%   -0.61%     
==========================================
  Files        1169     1169              
  Lines       75451    75451              
  Branches     4054     4054              
==========================================
- Hits        69310    68854     -456     
- Misses       6099     6555     +456     
  Partials       42       42              
Flag Coverage Δ
conformance 33.75% <ø> (ø)
e2e ?
integration 30.01% <ø> (-0.45%) ⬇️
rust 42.92% <ø> (ø)
unit 93.41% <ø> (+<0.01%) ⬆️
unit-migrate 93.44% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@BeryJu
BeryJu merged commit 180d5ea into goauthentik:main Sep 14, 2026
125 of 127 checks passed
@authentik-cherry-pick

Copy link
Copy Markdown
Contributor

🍒 Cherry-pick to version-2026.8 created: #26131

BeryJu added a commit that referenced this pull request Sep 15, 2026
…MATTERS (cherry-pick #26017 to version-2026.8) (#26131)

* web/flows: fix hardcoded locale in identification stage's OR_LIST_FORMATTERS (#26017)

OR_LIST_FORMATTERS was constructed once at module load with the locale
string "default", which resolves to the browser's own locale rather than
authentik's active locale. Individual field labels (e.g. "Username") are
translated correctly via msg(), but the "or" connecting them never was.

Move construction to render time via a createOrListFormatter(locale)
factory, using the stage's already-available this.activeLanguageTag
(BaseStage extends WithLocale(AKElement)) so it follows the active
locale, including changes at runtime.

Fixes #20632

* sigh

Signed-off-by: Jens Langhammer <[email protected]>

---------

Signed-off-by: Jens Langhammer <[email protected]>
Co-authored-by: nejedly-jan <[email protected]>
Co-authored-by: Jens Langhammer <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/version-2026.8 Add this label to PRs to backport changes to version-2026.8

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Identification stage: OR_LIST_FORMATTERS uses hardcoded "default" locale instead of active locale

2 participants