Repository navigation
web/i18n, core: Persist locale in a cookie and reload to switch - #25156
Conversation
✅ Deploy Preview for authentik-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for authentik-integrations ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for authentik-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
ef08347 to
36b0733
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #25156 +/- ##
=======================================
Coverage 92.29% 92.29%
=======================================
Files 1173 1174 +1
Lines 77508 77544 +36
Branches 4129 4129
=======================================
+ Hits 71534 71571 +37
+ Misses 5908 5907 -1
Partials 66 66
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
7aa4517 to
b79a58e
Compare
|
authentik PR Installation instructions Instructions for docker-composeAdd the following block to your AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-b79a58e6407f826c4183ea2588d8995166dd5f5d
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)sAfterwards, run the upgrade commands from the latest release notes. Instructions for KubernetesAdd the following block to your authentik:
outposts:
container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
global:
image:
repository: ghcr.io/goauthentik/dev-server
tag: gh-b79a58e6407f826c4183ea2588d8995166dd5f5dAfterwards, run the upgrade commands from the latest release notes. |
a44cf43 to
7643eab
Compare
7643eab to
5b166d7
Compare
Playwright e2eDownload this run's HTML report and traces, then open the report: gh run download 36944189187 -D playwright-artifacts
npx playwright show-report playwright-artifacts/playwright-reportInstallation instructionsInstructions for docker-composeAdd the following block to your AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-6d5e954ddc843bfb3ffcd880bf09da47e3f9969b
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)sAfterwards, run the upgrade commands from the latest release notes. Instructions for KubernetesAdd the following block to your authentik:
outposts:
container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
global:
image:
repository: ghcr.io/goauthentik/dev-server
tag: gh-6d5e954ddc843bfb3ffcd880bf09da47e3f9969bAfterwards, run the upgrade commands from the latest release notes. |
c078199 to
808a941
Compare
The @vendor-network tests load CAPTCHA widgets from the vendors' servers, which CI can't rely on reaching. They fail on nearly every run and use up the five-failure budget before other tests get to run. Skip them when CI is set; they still run locally.
808a941 to
464bc52
Compare
The ak-mdx link test expected relative docs links to resolve to next.goauthentik.io. That's only the pre-release docs host: a build with GIT_BUILD_HASH set, like the CI image, resolves them to the versioned host (version-<major>-<minor>.goauthentik.io). So the test failed whenever it ran in CI, and only looked intermittent because CI stops after five failures and the vendor CAPTCHA tests often used those up first. Accept either host. The application wizard's provider step now settles its fields before moving on, so the test's next "Next" click could land on that step's button again and leave the wizard short of the review step. Wait for the bindings step to show before continuing.
Locale becomes fixed for the lifetime of a page: instead of switching live in JavaScript, every locale-change path now persists the preference to the Django language cookie (which LocaleMiddleware already reads) and reloads, so the server re-renders every string — including server-rendered flow challenges — in the new locale. This structurally rules out the mixed client/server language state behind #18179 / #22954. - add persistLocale/applyLocaleChange helpers backed by the authentik_language cookie; switch the flow locale selector, the user-settings prompt stage, and the session controller's post-render locale application to persist + reload - drop the sessionStorage['authentik:locale'] path and remove it from autoDetectLanguage; the server-resolved hint (window.authentik.locale) is now authoritative, with navigator.languages only relevant on a first anonymous visit - honor ?locale= server-side in LocaleOverrideMiddleware (validated via check_for_language) so the shell and the web UI, which read the same parameter, cannot disagree. It sits directly after ImpersonateMiddleware, which wraps the rest of the chain in the user's saved locale, so an explicit override wins - unit-test the cookie helper; test the server-side ?locale= override Live-switching machinery (LocaleContextController observer, msg() thunks) is removed separately in a follow-up. Co-authored-by: Playpen Agent <[email protected]>
346be9a to
6d5e954
Compare
The locale is fixed per page since #25156, but the catalog still loaded from a component lifecycle hook, after every statically imported module had evaluated. Module-level msg() calls returned English. - each entrypoint awaits initializeLocale() before importing the interface - the lit-localize runtime moves to #common/ui/locale/runtime
…#27618) * web: move entrypoint bodies into importable modules Entrypoints import the moved module, with no change in behavior. This lets a later change run code before the interface modules evaluate. * web/i18n: load the locale catalog before the interface boots The locale is fixed per page since #25156, but the catalog still loaded from a component lifecycle hook, after every statically imported module had evaluated. Module-level msg() calls returned English. - each entrypoint awaits initializeLocale() before importing the interface - the lit-localize runtime moves to #common/ui/locale/runtime * web/i18n: remove live locale switching Switching locale reloads the page since #25156, and the catalog now loads before boot, so nothing observes a locale change after startup. - LocaleContextController only provides the runtime; drop the lang observer - drop the activeLanguageTag setter from WithLocale - drop LOCALE_STATUS_EVENT listeners in the admin interface, API locale middleware, captcha stage, and locale select * Fix type. * Unify types. * web/i18n: unwrap msg() thunks in label records The catalog now loads before any interface module evaluates, so label records can hold translated strings directly. - label records hold strings instead of MessageFormatter thunks - call sites read the value instead of calling it
Details
Locale becomes fixed for the lifetime of a page. Instead of swapping the language live in JS (the source of mixed client/server language state — #18179 / #22954), every locale-change path now persists the preference to the Django language cookie (
authentik_language, whichLocaleMiddlewarealready reads) and reloads, so the server re-renders every string — including server-rendered flow challenges — in the new locale.Change
persist.ts:persistLocale/applyLocaleChangewrite theauthentik_languagecookie + reload.SessionContextController's post-render locale application off livesetLocale.sessionStorage["authentik:locale"]path and drop it fromautoDetectLanguage; the server-resolved hint (window.authentik.locale) is now authoritative.InterfaceView.dispatchhonors?locale=server-side, validated viacheck_for_language(forcesTemplateResponse.render()inside theoverride, since it renders lazily).Tests
?locale=override (applied when valid, ignored when not).